Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1182319

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

From Finn Thain <fthain@telegraphics.com.au>
Newsgroups linux.kernel
Subject [RFC v4 19/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS
Date 2015-07-12 12:50 +0200
Message-ID <pLmZB-7cl-29@gated-at.bofh.it> (permalink)
References <pLmZz-7cl-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

As before, when CONFIG_PPC && !CONFIG_PPC_PMAC, the IOC_NVRAM_GET_OFFSET
ioctl is unimplemented. For the nvram module, unimplemented ioctls return
-ENOTTY. Whereas, for the superseded generic_nvram module they would
return -EINVAL.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>

---

This ioctl change is visible to userspace code but only in an error path.
I didn't find any userspace code that uses the IOC_NVRAM_GET_OFFSET ioctl.

The change in the name of the module is also visible. 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-07-12 20:24:53.000000000 +1000
+++ linux/arch/powerpc/Kconfig	2015-07-12 20:25:16.000000000 +1000
@@ -178,7 +178,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-07-12 20:25:13.000000000 +1000
+++ linux/arch/powerpc/kernel/setup_32.c	2015-07-12 20:25:16.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-07-12 20:24:53.000000000 +1000
+++ linux/arch/powerpc/platforms/chrp/Makefile	2015-07-12 20:25:16.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-07-12 20:24:53.000000000 +1000
+++ linux/arch/powerpc/platforms/chrp/setup.c	2015-07-12 20:25:16.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-07-12 20:24:53.000000000 +1000
+++ linux/arch/powerpc/platforms/powermac/setup.c	2015-07-12 20:25:16.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-07-12 20:25:05.000000000 +1000
+++ linux/drivers/char/Kconfig	2015-07-12 20:25:16.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v4 00/25] Re-use nvram module Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 11/25] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 16/25] powerpc: Implement nvram sync ioctl Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 15/25] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 24/25] m68k/mac: Fix PRAM accessors Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 18/25] nvram: Drop nvram_* symbol exports and prototypes Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 14/25] powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMac  Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 19/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 09/25] char/nvram: Implement NVRAM read/write methods Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 13/25] powerpc: Cleanup nvram includes Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 10/25] char/nvram: Use generic fixed_size_llseek() Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 08/25] char/nvram: Allow the set_checksum and initialize ioctls to be omitted Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 01/25] scsi/atari_scsi: Dont select CONFIG_NVRAM Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 12/25] char/nvram: Add "devname:nvram" module alias Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
    Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of  drivers/char/nvram.c Finn Thain <fthain@telegraphics.com.au> - 2015-07-14 10:20 +0200
      Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c Geert Uytterhoeven <geert@linux-m68k.org> - 2015-07-14 10:30 +0200
        Re: [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c Andreas Schwab <schwab@linux-m68k.org> - 2015-07-14 10:40 +0200
  [RFC v4 21/25] powerpc: Adopt nvram module for PPC64 Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 25/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 23/25] m68k/mac: Use macros for RTC accesses not magic numbers Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 22/25] m68k/mac: Adopt naming and calling conventions for PRAM routines Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  [RFC v4 04/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops Finn Thain <fthain@telegraphics.com.au> - 2015-07-12 12:50 +0200
  Re: [RFC v4 00/25] Re-use nvram module Geert Uytterhoeven <geert@linux-m68k.org> - 2015-07-13 10:00 +0200

csiph-web