[PATCH v7 19/26] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS
From: Finn Thain <hidden>
Date: 2015-11-01 10:49:22
Also in:
linux-m68k, lkml
Switch PPC32 kernels from the generic_nvram module to the nvram module.
Also fix a theoretical bug where CHRP omits the chrp_nvram_init()
call when CONFIG_NVRAM_MODULE=m.
Signed-off-by: Finn Thain <redacted>
---
The change in the name of the module is visible to userspace. The module that
implements /dev/nvram on PowerPC now has suitable aliases, i.e.
MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
MODULE_ALIAS("devname:nvram");
so that the device special file can be automatically created and the
module automatically loaded when needed. Previously this was not the case.
---
Changes since v1:
- Small indentation fix.
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/setup_32.c | 2 +-
arch/powerpc/platforms/chrp/Makefile | 2 +-
arch/powerpc/platforms/chrp/setup.c | 2 +-
arch/powerpc/platforms/powermac/setup.c | 3 +--
drivers/char/Kconfig | 10 ++++++----
6 files changed, 11 insertions(+), 10 deletions(-)
Index: linux/arch/powerpc/Kconfig
===================================================================--- linux.orig/arch/powerpc/Kconfig 2015-11-01 21:41:23.000000000 +1100
+++ linux/arch/powerpc/Kconfig 2015-11-01 21:41:48.000000000 +1100@@ -185,7 +185,7 @@ config SYSVIPC_COMPAT default y # All PPC32s use generic nvram driver through ppc_md -config GENERIC_NVRAM +config HAVE_ARCH_NVRAM_OPS bool default y if PPC32
Index: linux/arch/powerpc/kernel/setup_32.c ===================================================================
--- linux.orig/arch/powerpc/kernel/setup_32.c 2015-11-01 21:41:45.000000000 +1100
+++ linux/arch/powerpc/kernel/setup_32.c 2015-11-01 21:41:48.000000000 +1100@@ -174,7 +174,7 @@ int __init ppc_setup_l3cr(char *str) } __setup("l3cr=", ppc_setup_l3cr); -#ifdef CONFIG_GENERIC_NVRAM +#if IS_ENABLED(CONFIG_NVRAM) static unsigned char ppc_nvram_read_byte(int addr) {
Index: linux/arch/powerpc/platforms/chrp/Makefile ===================================================================
--- linux.orig/arch/powerpc/platforms/chrp/Makefile 2015-11-01 21:41:23.000000000 +1100
+++ linux/arch/powerpc/platforms/chrp/Makefile 2015-11-01 21:41:48.000000000 +1100@@ -1,3 +1,3 @@ obj-y += setup.o time.o pegasos_eth.o pci.o obj-$(CONFIG_SMP) += smp.o -obj-$(CONFIG_NVRAM) += nvram.o +obj-$(CONFIG_NVRAM:m=y) += nvram.o
Index: linux/arch/powerpc/platforms/chrp/setup.c ===================================================================
--- linux.orig/arch/powerpc/platforms/chrp/setup.c 2015-11-01 21:41:23.000000000 +1100
+++ linux/arch/powerpc/platforms/chrp/setup.c 2015-11-01 21:41:48.000000000 +1100@@ -557,7 +557,7 @@ void __init chrp_init_IRQ(void) void __init chrp_init2(void) { -#ifdef CONFIG_NVRAM +#if IS_ENABLED(CONFIG_NVRAM) chrp_nvram_init(); #endif
Index: linux/arch/powerpc/platforms/powermac/setup.c ===================================================================
--- linux.orig/arch/powerpc/platforms/powermac/setup.c 2015-11-01 21:41:23.000000000 +1100
+++ linux/arch/powerpc/platforms/powermac/setup.c 2015-11-01 21:41:48.000000000 +1100@@ -321,8 +321,7 @@ static void __init pmac_setup_arch(void) find_via_pmu(); smu_init(); -#if defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) || \ - defined(CONFIG_PPC64) +#if IS_ENABLED(CONFIG_NVRAM) || defined(CONFIG_PPC64) pmac_nvram_init(); #endif
Index: linux/drivers/char/Kconfig ===================================================================
--- linux.orig/drivers/char/Kconfig 2015-11-01 21:41:36.000000000 +1100
+++ linux/drivers/char/Kconfig 2015-11-01 21:41:48.000000000 +1100@@ -247,7 +247,7 @@ source "drivers/char/hw_random/Kconfig" config NVRAM tristate "/dev/nvram support" - depends on X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM || HAVE_ARCH_NVRAM_OPS + depends on X86 || (ARM && RTC_DRV_CMOS) || HAVE_ARCH_NVRAM_OPS ---help--- If you say Y here and create a character special file /dev/nvram with major number 10 and minor number 144 using mknod ("man mknod"),
@@ -256,9 +256,11 @@ config NVRAM and most Ataris. The actual number of bytes varies, depending on the nvram in the system, but is usually 114 (128-14 for the RTC). - This memory is conventionally called "CMOS RAM" on PCs and "NVRAM" - on Ataris. /dev/nvram may be used to view settings there, or to - change them (with some utility). It could also be used to frequently + This memory is conventionally called "CMOS RAM" on PCs, + "NVRAM" on Ataris and "PRAM" on Macintoshes. + + /dev/nvram may be used to view settings in NVRAM, or to change them + (with some utility). It could also be used to frequently save a few bits of very important data that may not be lost over power-off and for which writing to disk is too insecure. Note however that most NVRAM space in a PC belongs to the BIOS and you