[RFC v6 19/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS

From: Finn Thain
Date: Sun Aug 23 2015 - 07:14:32 EST


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 <fthain@xxxxxxxxxxxxxxxxxxx>

---

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-08-23 20:40:53.000000000 +1000
+++ linux/arch/powerpc/Kconfig 2015-08-23 20:41:18.000000000 +1000
@@ -180,7 +180,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-08-23 20:41:14.000000000 +1000
+++ linux/arch/powerpc/kernel/setup_32.c 2015-08-23 20:41:18.000000000 +1000
@@ -168,7 +168,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-08-23 20:40:53.000000000 +1000
+++ linux/arch/powerpc/platforms/chrp/Makefile 2015-08-23 20:41:18.000000000 +1000
@@ -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-08-23 20:40:53.000000000 +1000
+++ linux/arch/powerpc/platforms/chrp/setup.c 2015-08-23 20:41:18.000000000 +1000
@@ -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-08-23 20:40:53.000000000 +1000
+++ linux/arch/powerpc/platforms/powermac/setup.c 2015-08-23 20:41:18.000000000 +1000
@@ -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-08-23 20:41:05.000000000 +1000
+++ linux/drivers/char/Kconfig 2015-08-23 20:41:18.000000000 +1000
@@ -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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/