linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: dri-devel@lists.freedesktop.org, linux-m68k@lists.linux-m68k.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-fbdev@vger.kernel.org
Subject: [PATCH v9 06/22] powerpc: Replace nvram_* extern declarations with standard header
Date: Tue, 15 Jan 2019 15:18:56 +1100	[thread overview]
Message-ID: <0792e10d71abdf3152b74bddbb9da68c1f17e48c.1547525936.git.fthain@telegraphics.com.au> (raw)
In-Reply-To: <cover.1547525936.git.fthain@telegraphics.com.au>

Remove the nvram_read_byte() and nvram_write_byte() declarations in
powerpc/include/asm/nvram.h and use the cross-platform static functions
in linux/nvram.h instead.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
Changed since v8:
 - Added nvram_read_byte() and nvram_write_byte() functions to avoid a
potential build failure during 'git bisect'.
 - Brought forward some powerpc cleanup to avoid naming collisions with
nvram.h functions.
 - Replaced the ppc_md.nvram_* method wrappers with the ones in nvram.h.
---
 arch/powerpc/include/asm/nvram.h           |  6 ------
 arch/powerpc/kernel/setup_32.c             | 25 +---------------------
 drivers/char/generic_nvram.c               |  1 +
 drivers/video/fbdev/matrox/matroxfb_base.c |  2 +-
 include/linux/nvram.h                      |  3 +++
 5 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
index 09a518bb7c03..56a388da9c4f 100644
--- a/arch/powerpc/include/asm/nvram.h
+++ b/arch/powerpc/include/asm/nvram.h
@@ -98,10 +98,4 @@ extern int nvram_write_os_partition(struct nvram_os_partition *part,
 				    unsigned int err_type,
 				    unsigned int error_log_cnt);
 
-/* Determine NVRAM size */
-extern ssize_t nvram_get_size(void);
-
-/* Normal access to NVRAM */
-extern unsigned char nvram_read_byte(int i);
-extern void nvram_write_byte(unsigned char c, int i);
 #endif /* _ASM_POWERPC_NVRAM_H */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 947f904688b0..f5107796e2d7 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -17,6 +17,7 @@
 #include <linux/console.h>
 #include <linux/memblock.h>
 #include <linux/export.h>
+#include <linux/nvram.h>
 
 #include <asm/io.h>
 #include <asm/prom.h>
@@ -149,30 +150,6 @@ __setup("l3cr=", ppc_setup_l3cr);
 
 #ifdef CONFIG_GENERIC_NVRAM
 
-/* Generic nvram hooks used by drivers/char/gen_nvram.c */
-unsigned char nvram_read_byte(int addr)
-{
-	if (ppc_md.nvram_read_val)
-		return ppc_md.nvram_read_val(addr);
-	return 0xff;
-}
-EXPORT_SYMBOL(nvram_read_byte);
-
-void nvram_write_byte(unsigned char val, int addr)
-{
-	if (ppc_md.nvram_write_val)
-		ppc_md.nvram_write_val(addr, val);
-}
-EXPORT_SYMBOL(nvram_write_byte);
-
-ssize_t nvram_get_size(void)
-{
-	if (ppc_md.nvram_size)
-		return ppc_md.nvram_size();
-	return -1;
-}
-EXPORT_SYMBOL(nvram_get_size);
-
 void nvram_sync(void)
 {
 	if (ppc_md.nvram_sync)
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index ff5394f47587..0c22b9503e84 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -20,6 +20,7 @@
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/mutex.h>
+#include <linux/nvram.h>
 #include <linux/pagemap.h>
 #include <linux/uaccess.h>
 #include <asm/nvram.h>
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index 838869c6490c..0a4e5bad33f4 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -111,12 +111,12 @@
 #include "matroxfb_g450.h"
 #include <linux/matroxfb.h>
 #include <linux/interrupt.h>
+#include <linux/nvram.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 
 #ifdef CONFIG_PPC_PMAC
 #include <asm/machdep.h>
-unsigned char nvram_read_byte(int);
 static int default_vmode = VMODE_NVRAM;
 static int default_cmode = CMODE_NVRAM;
 #endif
diff --git a/include/linux/nvram.h b/include/linux/nvram.h
index a1e01dc89759..79431dab87a1 100644
--- a/include/linux/nvram.h
+++ b/include/linux/nvram.h
@@ -15,8 +15,11 @@ extern const struct nvram_ops arch_nvram_ops;
 
 static inline ssize_t nvram_get_size(void)
 {
+#ifdef CONFIG_PPC
+#else
 	if (arch_nvram_ops.get_size)
 		return arch_nvram_ops.get_size();
+#endif
 	return -ENODEV;
 }
 
-- 
2.19.2


  parent reply	other threads:[~2019-01-15  4:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15  4:18 [PATCH v9 00/22] Re-use nvram module Finn Thain
2019-01-15  4:18 ` [PATCH v9 05/22] m68k/atari: Implement arch_nvram_ops struct Finn Thain
2019-01-15  4:18 ` [PATCH v9 21/22] char/generic_nvram: Remove as unused Finn Thain
2019-01-15  4:18 ` [PATCH v9 08/22] char/nvram: Allow the set_checksum and initialize ioctls to be omitted Finn Thain
2019-01-15  4:18 ` [PATCH v9 16/22] char/nvram: Add "devname:nvram" module alias Finn Thain
2019-01-15  4:18 ` [PATCH v9 15/22] m68k: Dispatch nvram_ops calls to Atari or Mac functions Finn Thain
2019-01-22  9:19   ` Greg Kroah-Hartman
2019-01-22  9:22     ` Greg Kroah-Hartman
2019-01-15  4:18 ` [PATCH v9 14/22] macintosh/via-cuda: Don't rely on Cuda to end a transfer Finn Thain
2019-01-15  4:18 ` [PATCH v9 02/22] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c Finn Thain
2019-01-15  4:18 ` Finn Thain [this message]
2019-01-15  4:18 ` [PATCH v9 13/22] m68k/mac: Fix PRAM accessors Finn Thain
2019-01-15  4:18 ` [PATCH v9 03/22] char/nvram: Re-order functions to remove forward declarations and #ifdefs Finn Thain
2019-01-15  4:18 ` [PATCH v9 20/22] powerpc: Enable HAVE_ARCH_NVRAM_OPS and disable GENERIC_NVRAM Finn Thain
2019-01-15  4:18 ` [PATCH v9 11/22] m68k/mac: Adopt naming and calling conventions for PRAM routines Finn Thain
2019-01-15  4:18 ` [PATCH v9 19/22] powerpc, fbdev: Use NV_CMODE and NV_VMODE only when CONFIG_PPC32 && CONFIG_PPC_PMAC && CONFIG_NVRAM Finn Thain
2019-01-15  4:18 ` [PATCH v9 17/22] powerpc: Define missing ppc_md.nvram_size for CHRP and PowerMac Finn Thain
2019-01-15  4:18 ` [PATCH v9 18/22] powerpc: Implement nvram ioctls Finn Thain
2019-01-15  4:18 ` [PATCH v9 10/22] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain
2019-01-15  4:18 ` [PATCH v9 09/22] char/nvram: Implement NVRAM read/write methods Finn Thain
2019-01-15  4:18 ` [PATCH v9 01/22] scsi/atari_scsi: Don't select CONFIG_NVRAM Finn Thain
2019-01-15  4:18 ` [PATCH v9 12/22] m68k/mac: Use macros for RTC accesses not magic numbers Finn Thain
2019-01-15  4:18 ` [PATCH v9 04/22] nvram: Replace nvram_* function exports with static functions Finn Thain
2019-01-15  4:18 ` [PATCH v9 22/22] powerpc: Adopt nvram module for PPC64 Finn Thain
2019-01-15  4:18 ` [PATCH v9 07/22] char/nvram: Adopt arch_nvram_ops Finn Thain
2019-01-22  9:22 ` [PATCH v9 00/22] Re-use nvram module Greg Kroah-Hartman
2019-01-22 22:06   ` Finn Thain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0792e10d71abdf3152b74bddbb9da68c1f17e48c.1547525936.git.fthain@telegraphics.com.au \
    --to=fthain@telegraphics.com.au \
    --cc=arnd@arndb.de \
    --cc=b.zolnierkie@samsung.com \
    --cc=benh@kernel.crashing.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).