Re: [PATCH] powerpc/4xx/ocm: fix compiler error

2018-12-25 Thread Gabriel Paubert
On Sat, Dec 22, 2018 at 05:04:51PM -0600, Segher Boessenkool wrote: > On Sat, Dec 22, 2018 at 08:37:28PM +0100, christophe leroy wrote: > > Le 22/12/2018 à 18:16, Segher Boessenkool a écrit : > > >On Sat, Dec 22, 2018 at 02:08:02PM +0100, christophe leroy wrote: > > >> > > >>Usually, Guarded

[PATCH v8 03/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops

2018-12-25 Thread Finn Thain
By implementing an arch_nvram_ops struct, any platform can re-use the drivers/char/nvram.c module without needing any arch-specific code in that module. Atari does so here. Atari has one user of nvram_check_checksum() whereas the other "CMOS" platforms don't use that function at all. Replace this

[PATCH v8 21/25] nvram: Drop nvram_* symbol exports and prototypes

2018-12-25 Thread Finn Thain
Drivers now use the arch_nvram_ops calls so remove the function exports and prototypes. nvram_check_checksum() is unused so remove it. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven --- arch/m68k/atari/nvram.c | 6 +++--- drivers/char/nvram.c| 27 +--

[PATCH v8 06/25] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2018-12-25 Thread Finn Thain
Make use of arch_nvram_ops in the thinkpad_acpi driver so that the nvram_* function exports can be removed. Signed-off-by: Finn Thain Acked-by: Henrique de Moraes Holschuh Reviewed-by: Darren Hart --- I've tested this on a ThinkPad T43. --- drivers/platform/x86/thinkpad_acpi.c | 20

[PATCH v8 04/25] char/nvram: Re-order functions to remove forward declarations and #ifdefs

2018-12-25 Thread Finn Thain
Also give functions more sensible names: nvram_misc_* for misc device ops, nvram_proc_* for proc file ops and nvram_module_* for init and exit functions. This helps to distinguish them from struct nvram_ops methods. Signed-off-by: Finn Thain --- drivers/char/nvram.c | 167

[PATCH v8 13/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions

2018-12-25 Thread Finn Thain
A multi-platform kernel binary has to decide at run-time how to dispatch the arch_nvram_ops calls. Add a platform-independent arch_nvram_ops struct for this, to replace the atari-specific one. Enable CONFIG_HAVE_ARCH_NVRAM_OPS for Macs. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies

[PATCH v8 20/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2018-12-25 Thread Finn Thain
Make use of arch_nvram_ops in device drivers so that the nvram_* function exports can be removed. Since they are no longer global symbols, rename the PPC32 nvram_* functions appropriately. Signed-off-by: Finn Thain --- arch/powerpc/kernel/setup_32.c | 8

[PATCH v8 14/25] char/nvram: Add "devname:nvram" module alias

2018-12-25 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/char/nvram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 889123ddace4..b77c27d68762 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -554,3 +554,4 @@ module_exit(nvram_module_exit);

[PATCH v8 17/25] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports

2018-12-25 Thread Finn Thain
Implement arch_nvram_ops for PPC32 and make use of it in the generic_nvram misc device module so that the nvram_* function exports can be removed. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- arch/powerpc/include/asm/nvram.h | 3 --- arch/powerpc/kernel/setup_32.c | 10 +++---

[PATCH v8 25/25] powerpc: Remove pmac_xpram_{read,write} functions

2018-12-25 Thread Finn Thain
The arch_nvram_ops methods provide a uniform API to replace the nvram_{read,write}_byte exports and pmac_xpram_{read,write} functions. The latter API gets removed in this patch. To make that possible, add a get_partition() method to the nvram_ops struct and call it from pmac_time_init().

[PATCH v8 24/25] powerpc: Adopt nvram module for PPC64

2018-12-25 Thread Finn Thain
Adopt nvram module to reduce code duplication. This means CONFIG_NVRAM becomes available to CONFIG_PPC64 builds (until now it was only PPC32). The IOC_NVRAM_GET_OFFSET ioctl as implemented on PPC64 validates the offset returned by pmac_get_partition(). Add this test to the nvram module. Note

[PATCH v8 10/25] m68k/mac: Adopt naming and calling conventions for PRAM routines

2018-12-25 Thread Finn Thain
Adopt the existing *_read_byte and *_write_byte naming convention. Rename via_pram_readbyte and via_pram_writebyte to avoid confusion. Adjust calling conventions of mac_pram_* functions to match the arch_nvram_ops struct methods. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven Tested-by:

[PATCH v8 11/25] m68k/mac: Use macros for RTC accesses not magic numbers

2018-12-25 Thread Finn Thain
This is intended to improve code style and not affect code behaviour. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson --- arch/m68k/mac/misc.c | 59 ++-- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git

[PATCH v8 12/25] m68k/mac: Fix PRAM accessors

2018-12-25 Thread Finn Thain
PMU-based m68k Macs pre-date PowerMac-style NVRAM. Use the appropriate PMU commands. Also implement the missing XPRAM accessors for VIA-based Macs. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson --- Changed since v7: - Updated PMU response decoding due to

[PATCH v8 08/25] char/nvram: Implement NVRAM read/write methods

2018-12-25 Thread Finn Thain
Refactor the RTC "CMOS" NVRAM functions so that they can be used as arch_nvram_ops methods. Checksumming logic is moved from the misc device operations to the nvram read/write operations. This makes the misc device implementation more generic. This also preserves the locking semantics such that

[PATCH v8 22/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS

2018-12-25 Thread Finn Thain
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 Tested-by: Laurent Vivier Tested-by: Stan Johnson --- The change in the name of the module is

[PATCH v8 07/25] char/nvram: Allow the set_checksum and initialize ioctls to be omitted

2018-12-25 Thread Finn Thain
The drivers/char/nvram module has previously only supported RTC "CMOS" NVRAM, for which it provides appropriate checksum ioctls. Make these ioctls optional so the module can be re-used with other kinds of NVRAM. The ops struct methods that implement the ioctls now return error codes so that a

[PATCH v8 23/25] char/generic_nvram: Remove as unused

2018-12-25 Thread Finn Thain
Thereby eliminating some twisted CONFIG_NVRAM logic. Signed-off-by: Finn Thain --- drivers/char/Makefile| 6 +- drivers/char/generic_nvram.c | 160 --- 2 files changed, 1 insertion(+), 165 deletions(-) delete mode 100644 drivers/char/generic_nvram.c

[PATCH v8 15/25] powerpc: Clean up nvram includes

2018-12-25 Thread Finn Thain
The nvram_read_byte() and nvram_write_byte() definitions in asm/nvram.h duplicate those in linux/nvram.h. Get rid of the former to prepare for adoption of struct arch_nvram_ops (which is defined in linux/nvram.h for general use). Signed-off-by: Finn Thain Tested-by: Stan Johnson ---

[PATCH v8 05/25] char/nvram: Adopt arch_nvram_ops

2018-12-25 Thread Finn Thain
Different platforms and architectures offer different NVRAM sizes and access methods. E.g. PPC32 has byte-at-a-time accessor functions whereas PPC64 has byte-range accessor functions. Adopt the nvram_ops struct so the nvram module can call such functions as are defined by the various platforms and

[PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-25 Thread Finn Thain
On powerpc, setting CONFIG_NVRAM=n builds a kernel with no NVRAM support. Setting CONFIG_NVRAM=m enables the /dev/nvram misc device module without enabling NVRAM support in drivers. Setting CONFIG_NVRAM=y enables the misc device (built-in) and also enables NVRAM support in drivers. m68k shares

[PATCH v8 02/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c

2018-12-25 Thread Finn Thain
Move the m68k-specific code out of the driver to make the driver generic. I've used 'SPDX-License-Identifier: GPL-2.0+' for the new file because the old file is covered by MODULE_LICENSE("GPL"). Signed-off-by: Finn Thain Tested-by: Christian T. Steigies Acked-by: Geert Uytterhoeven ---

[PATCH v8 18/25] powerpc: Implement nvram sync ioctl

2018-12-25 Thread Finn Thain
Add the powerpc-specific sync() method to struct nvram_ops and implement the corresponding ioctl in the nvram module. This allows the nvram module to replace the generic_nvram module. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- On PPC32, the IOC_NVRAM_SYNC ioctl call always returns 0,

[PATCH v8 00/25] Re-use nvram module

2018-12-25 Thread Finn Thain
The generic NVRAM module, drivers/char/generic_nvram.c, implements a /dev/nvram misc device. This module is used only by 32-bit PowerPC platforms. Unfortunately, it isn't generic enough to be more widely used. The RTC "CMOS" NVRAM module, drivers/char/nvram.c, also implements a /dev/nvram misc

[PATCH v8 16/25] powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMac

2018-12-25 Thread Finn Thain
Add the nvram_size() function to those PowerPC platforms that don't already have one: CHRP and PowerMac. This means that the ppc_md.nvram_size() function can be used to implement arch_nvram_ops.get_size() Since we are addressing inconsistencies here, also rename chrp_nvram_read and

[PATCH v8 09/25] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS

2018-12-25 Thread Finn Thain
Atari RTC NVRAM has a checksum so implement the remaining arch_nvram_ops methods for the set_checksum and initialize ioctls. Enable CONFIG_HAVE_ARCH_NVRAM_OPS. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven --- Changed since v7: - Changed the default for CONFIG_NVRAM, because "select

[PATCH v8 19/25] powerpc, fbdev: Use NV_CMODE and NV_VMODE only when CONFIG_PPC32 && CONFIG_PPC_PMAC && CONFIG_NVRAM

2018-12-25 Thread Finn Thain
This patch addresses inconsistencies in Mac framebuffer drivers and their use of Kconfig symbols relating to NVRAM, so PPC64 can use CONFIG_NVRAM. Macintosh framebuffer drivers use default settings for color mode and video mode that are found in NVRAM. On PCI Macs, MacOS stores display settings