powerpc: Enable HAVE_ARCH_NVRAM_OPS and disable GENERIC_NVRAM

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.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Finn Thain
2019-01-15 15:18:56 +11:00
committed by Greg Kroah-Hartman
parent 066ac5c3c4
commit f9c3a570f5
8 changed files with 32 additions and 32 deletions

View File

@@ -5,6 +5,10 @@
#include <linux/errno.h>
#include <uapi/linux/nvram.h>
#ifdef CONFIG_PPC
#include <asm/machdep.h>
#endif
/**
* struct nvram_ops - NVRAM functionality made available to drivers
* @read: validate checksum (if any) then load a range of bytes from NVRAM
@@ -42,6 +46,8 @@ extern const struct nvram_ops arch_nvram_ops;
static inline ssize_t nvram_get_size(void)
{
#ifdef CONFIG_PPC
if (ppc_md.nvram_size)
return ppc_md.nvram_size();
#else
if (arch_nvram_ops.get_size)
return arch_nvram_ops.get_size();
@@ -52,6 +58,8 @@ static inline ssize_t nvram_get_size(void)
static inline unsigned char nvram_read_byte(int addr)
{
#ifdef CONFIG_PPC
if (ppc_md.nvram_read_val)
return ppc_md.nvram_read_val(addr);
#else
if (arch_nvram_ops.read_byte)
return arch_nvram_ops.read_byte(addr);
@@ -62,6 +70,8 @@ static inline unsigned char nvram_read_byte(int addr)
static inline void nvram_write_byte(unsigned char val, int addr)
{
#ifdef CONFIG_PPC
if (ppc_md.nvram_write_val)
ppc_md.nvram_write_val(addr, val);
#else
if (arch_nvram_ops.write_byte)
arch_nvram_ops.write_byte(val, addr);
@@ -98,15 +108,25 @@ static inline ssize_t nvram_write_bytes(char *buf, size_t count, loff_t *ppos)
static inline ssize_t nvram_read(char *buf, size_t count, loff_t *ppos)
{
#ifdef CONFIG_PPC
if (ppc_md.nvram_read)
return ppc_md.nvram_read(buf, count, ppos);
#else
if (arch_nvram_ops.read)
return arch_nvram_ops.read(buf, count, ppos);
#endif
return nvram_read_bytes(buf, count, ppos);
}
static inline ssize_t nvram_write(char *buf, size_t count, loff_t *ppos)
{
#ifdef CONFIG_PPC
if (ppc_md.nvram_write)
return ppc_md.nvram_write(buf, count, ppos);
#else
if (arch_nvram_ops.write)
return arch_nvram_ops.write(buf, count, ppos);
#endif
return nvram_write_bytes(buf, count, ppos);
}