char/nvram: Allow the set_checksum and initialize ioctls to be omitted

The drivers/char/nvram.c module has previously supported only 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 multi-platform kernel binary can do the right thing when
running on hardware without a suitable NVRAM.

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 d5bbb5021c
commit 2d58636e0a
2 changed files with 43 additions and 31 deletions

View File

@@ -31,6 +31,8 @@ struct nvram_ops {
void (*write_byte)(unsigned char, int);
ssize_t (*read)(char *, size_t, loff_t *);
ssize_t (*write)(char *, size_t, loff_t *);
long (*initialize)(void);
long (*set_checksum)(void);
};
extern const struct nvram_ops arch_nvram_ops;