[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0-4vGuCR4aCq0=D1Du1K=f5MtnB9fyCBnOsF+4Na5dMg@mail.gmail.com>
Date: Sat, 29 Dec 2018 23:19:57 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Finn Thain <fthain@...egraphics.com.au>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-m68k <linux-m68k@...ts.linux-m68k.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH v8 18/25] powerpc: Implement nvram sync ioctl
> --- a/drivers/char/nvram.c
> +++ b/drivers/char/nvram.c
> @@ -48,6 +48,10 @@
> #include <linux/mutex.h>
> #include <linux/pagemap.h>
>
> +#ifdef CONFIG_PPC
> +#include <asm/nvram.h>
> +#include <asm/machdep.h>
> +#endif
>
> static DEFINE_MUTEX(nvram_mutex);
> static DEFINE_SPINLOCK(nvram_state_lock);
> @@ -331,6 +335,37 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd,
> long ret = -ENOTTY;
>
> switch (cmd) {
> +#ifdef CONFIG_PPC
> + case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
> + pr_warn("nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
> + /* fall through */
> + case IOC_NVRAM_GET_OFFSET:
> + ret = -EINVAL;
> +#ifdef CONFIG_PPC_PMAC
I think it would make be nicer here to keep the ppc bits in arch/ppc,
and instead add a .ioctl() callback to nvram_ops.
> @@ -369,12 +405,14 @@ static int nvram_misc_open(struct inode *inode, struct file *file)
> return -EBUSY;
> }
>
> +#ifndef CONFIG_PPC
> /* Prevent multiple writers if the set_checksum ioctl is implemented. */
> if ((arch_nvram_ops.set_checksum != NULL) &&
> (file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE)) {
> spin_unlock(&nvram_state_lock);
> return -EBUSY;
> }
> +#endif
>
> diff --git a/include/linux/nvram.h b/include/linux/nvram.h
> index b7bfaec60a43..24a57675dba1 100644
> --- a/include/linux/nvram.h
> +++ b/include/linux/nvram.h
> @@ -18,8 +18,12 @@ struct nvram_ops {
> unsigned char (*read_byte)(int);
> void (*write_byte)(unsigned char, int);
> ssize_t (*get_size)(void);
> +#ifdef CONFIG_PPC
> + long (*sync)(void);
> +#else
> long (*set_checksum)(void);
> long (*initialize)(void);
> +#endif
> };
Maybe just leave all entries visible here, and avoid the above #ifdef checks.
Arnd
Powered by blists - more mailing lists