From patchwork Fri May 18 22:26:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 8828 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D3A5823EB5 for ; Fri, 18 May 2012 22:27:49 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 8DA7CA1871C for ; Fri, 18 May 2012 22:27:49 +0000 (UTC) Received: by yhpp61 with SMTP id p61so4114133yhp.11 for ; Fri, 18 May 2012 15:27:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=ysw3WvvOYWrm6Z57EWbOOsskKgVphWKIQ/BTGXlVkAg=; b=etMMjZRe9cblM5E7Grqk5ucCBySW9f8K5nYD3Zgo/FTiIj5gIysB9jLvDJ05yHCRIf zYR0qBx7pNkJRXL2GImhoX69vNdfxnUO9bRU67NVX+BUwoQIsxk/g89uLSKBw3+GkCks m/Ht9GPvlIcMY/hdGHQvI6jI52X62CTn2rDDaAQDl4cB1gXf2mlCCrV3CvnD9Rk29ESb ZebQpaIWqnpkGop4xMFUXK6PJ/Fll1uDat2HhEClkov6+i5rT1Xy0QH5HEaO5kxkVVog 0a1CLKh9G9MGpJnthw5nxTV8lap2k9BIH1DJ7V5fWYG1NM0rc509XL/SSMPB2HgsXPS5 AUkQ== Received: by 10.43.63.193 with SMTP id xf1mr1792252icb.48.1337380068617; Fri, 18 May 2012 15:27:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp135327ibd; Fri, 18 May 2012 15:27:48 -0700 (PDT) Received: by 10.68.192.5 with SMTP id hc5mr2352277pbc.49.1337380067871; Fri, 18 May 2012 15:27:47 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id qa10si17675425pbb.174.2012.05.18.15.27.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 May 2012 15:27:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id rr4so5393549pbb.37 for ; Fri, 18 May 2012 15:27:47 -0700 (PDT) Received: by 10.68.138.196 with SMTP id qs4mr22103477pbb.149.1337380067627; Fri, 18 May 2012 15:27:47 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id rv5sm14125847pbc.56.2012.05.18.15.27.45 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 May 2012 15:27:46 -0700 (PDT) Date: Fri, 18 May 2012 15:26:18 -0700 From: Anton Vorontsov To: Greg Kroah-Hartman , Kees Cook , Colin Cross , Tony Luck Cc: Arnd Bergmann , John Stultz , Shuah Khan , arve@android.com, Rebecca Schultz Zavin , Jesper Juhl , Randy Dunlap , Stephen Boyd , Thomas Meyer , Andrew Morton , Marco Stornelli , WANG Cong , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: [PATCH 12/14] staging/android: Remove ram_console driver Message-ID: <20120518222617.GL23089@lizard> References: <20120518222314.GA9425@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120518222314.GA9425@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQmcW4PVC7n6WUUBgZFvbvK1WmbnsuWh+NBCeYBHQ1thqzxvYkRbROWTPiRPqMJA7Om2uOqn All the functionality is now supported by pstore and pstore_ram drivers. Signed-off-by: Anton Vorontsov Acked-by: Kees Cook Acked-by: Colin Cross --- drivers/staging/android/Kconfig | 5 - drivers/staging/android/Makefile | 1 - drivers/staging/android/ram_console.c | 179 --------------------------------- 3 files changed, 185 deletions(-) delete mode 100644 drivers/staging/android/ram_console.c diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 63f9822..df42c6b 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -25,11 +25,6 @@ config ANDROID_LOGGER tristate "Android log driver" default n -config ANDROID_RAM_CONSOLE - bool "Android RAM buffer console" - depends on !S390 && !UML && HAVE_MEMBLOCK && PSTORE_RAM=y - default n - config ANDROID_TIMED_OUTPUT bool "Timed output class driver" default y diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile index 4677e7b..5f3ef2e 100644 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o obj-$(CONFIG_ASHMEM) += ashmem.o obj-$(CONFIG_ANDROID_LOGGER) += logger.o -obj-$(CONFIG_ANDROID_RAM_CONSOLE) += ram_console.o obj-$(CONFIG_ANDROID_TIMED_OUTPUT) += timed_output.o obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o diff --git a/drivers/staging/android/ram_console.c b/drivers/staging/android/ram_console.c deleted file mode 100644 index 82323bb..0000000 --- a/drivers/staging/android/ram_console.c +++ /dev/null @@ -1,179 +0,0 @@ -/* drivers/android/ram_console.c - * - * Copyright (C) 2007-2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ram_console.h" - -static struct persistent_ram_zone *ram_console_zone; -static const char *bootinfo; -static size_t bootinfo_size; - -static void -ram_console_write(struct console *console, const char *s, unsigned int count) -{ - struct persistent_ram_zone *prz = console->data; - persistent_ram_write(prz, s, count); -} - -static struct console ram_console = { - .name = "ram", - .write = ram_console_write, - .flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME, - .index = -1, -}; - -void ram_console_enable_console(int enabled) -{ - if (enabled) - ram_console.flags |= CON_ENABLED; - else - ram_console.flags &= ~CON_ENABLED; -} - -static int __init ram_console_probe(struct platform_device *pdev) -{ - struct ram_console_platform_data *pdata = pdev->dev.platform_data; - struct persistent_ram_zone *prz; - - prz = persistent_ram_init_ringbuffer(&pdev->dev, true); - if (IS_ERR(prz)) - return PTR_ERR(prz); - - - if (pdata) { - bootinfo = kstrdup(pdata->bootinfo, GFP_KERNEL); - if (bootinfo) - bootinfo_size = strlen(bootinfo); - } - - ram_console_zone = prz; - ram_console.data = prz; - - register_console(&ram_console); - - return 0; -} - -static struct platform_driver ram_console_driver = { - .driver = { - .name = "ram_console", - }, -}; - -static int __init ram_console_module_init(void) -{ - return platform_driver_probe(&ram_console_driver, ram_console_probe); -} - -#ifndef CONFIG_PRINTK -#define dmesg_restrict 0 -#endif - -static ssize_t ram_console_read_old(struct file *file, char __user *buf, - size_t len, loff_t *offset) -{ - loff_t pos = *offset; - ssize_t count; - struct persistent_ram_zone *prz = ram_console_zone; - size_t old_log_size = persistent_ram_old_size(prz); - const char *old_log = persistent_ram_old(prz); - char *str; - int ret; - - if (dmesg_restrict && !capable(CAP_SYSLOG)) - return -EPERM; - - /* Main last_kmsg log */ - if (pos < old_log_size) { - count = min(len, (size_t)(old_log_size - pos)); - if (copy_to_user(buf, old_log + pos, count)) - return -EFAULT; - goto out; - } - - /* ECC correction notice */ - pos -= old_log_size; - count = persistent_ram_ecc_string(prz, NULL, 0); - if (pos < count) { - str = kmalloc(count, GFP_KERNEL); - if (!str) - return -ENOMEM; - persistent_ram_ecc_string(prz, str, count + 1); - count = min(len, (size_t)(count - pos)); - ret = copy_to_user(buf, str + pos, count); - kfree(str); - if (ret) - return -EFAULT; - goto out; - } - - /* Boot info passed through pdata */ - pos -= count; - if (pos < bootinfo_size) { - count = min(len, (size_t)(bootinfo_size - pos)); - if (copy_to_user(buf, bootinfo + pos, count)) - return -EFAULT; - goto out; - } - - /* EOF */ - return 0; - -out: - *offset += count; - return count; -} - -static const struct file_operations ram_console_file_ops = { - .owner = THIS_MODULE, - .read = ram_console_read_old, -}; - -static int __init ram_console_late_init(void) -{ - struct proc_dir_entry *entry; - struct persistent_ram_zone *prz = ram_console_zone; - - if (!prz) - return 0; - - if (persistent_ram_old_size(prz) == 0) - return 0; - - entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL); - if (!entry) { - printk(KERN_ERR "ram_console: failed to create proc entry\n"); - persistent_ram_free_old(prz); - return 0; - } - - entry->proc_fops = &ram_console_file_ops; - entry->size = persistent_ram_old_size(prz) + - persistent_ram_ecc_string(prz, NULL, 0) + - bootinfo_size; - - return 0; -} - -late_initcall(ram_console_late_init); -postcore_initcall(ram_console_module_init);