Re: [RFC v3 24/24] m68k: Dispatch nvram_ops calls to Atari or Mac functions

From: Geert Uytterhoeven
Date: Mon Jun 29 2015 - 03:26:00 EST


Hi Finn,

> A multi-platform kernel binary needs to decide at run-time how to dispatch
> the arch_nvram_ops calls. Add platform-independent arch_nvram_ops, for use
> when multiple platform-specific NVRAM ops implementations are needed.
>
> Enable CONFIG_HAVE_ARCH_NVRAM_OPS for Macs.

Thanks for your patch!

On Sun, Jun 28, 2015 at 3:42 AM, Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx> wrote:
> --- linux.orig/arch/m68k/kernel/setup_mm.c 2015-06-28 11:41:27.000000000 +1000
> +++ linux/arch/m68k/kernel/setup_mm.c 2015-06-28 11:41:56.000000000 +1000

> @@ -568,3 +569,109 @@ static int __init adb_probe_sync_enable
>
> __setup("adb_sync", adb_probe_sync_enable);
> #endif /* CONFIG_ADB */
> +
> +#if IS_ENABLED(CONFIG_NVRAM)
> +extern unsigned char mac_pram_read_byte(int);
> +extern void mac_pram_write_byte(unsigned char, int);
> +extern ssize_t mac_pram_get_size(void);
> +
> +extern ssize_t atari_nvram_read(char *, size_t, loff_t *);
> +extern ssize_t atari_nvram_write(char *, size_t, loff_t *);
> +extern long atari_nvram_set_checksum(void);
> +extern long atari_nvram_initialize(void);
> +extern ssize_t atari_nvram_get_size(void);

Forward declarations belong in a header file, to be included by both
producers and consumers.

> --- linux.orig/arch/m68k/Kconfig 2015-06-28 11:41:39.000000000 +1000
> +++ linux/arch/m68k/Kconfig 2015-06-28 11:41:56.000000000 +1000
> @@ -72,7 +72,7 @@ config PGTABLE_LEVELS
> default 3
>
> config HAVE_ARCH_NVRAM_OPS
> - def_bool ATARI
> + def_bool ATARI || MAC

For maintainability, it's better to just have "bool" here, and let both the
ATARI and MAC config symbols select HAVE_ARCH_NVRAM_OPS.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/