Skip to content

Commit 06c421e

Browse files
metaliveblogtorvalds
authored andcommitted
memory_accessor: new interface for reading/writing persistent memory
Add an interface by which other kernel code can read/write persistent memory such as I2C or SPI EEPROMs, or devices which provide NVRAM. Use cases include storage of board-specific configuration data like Ethernet addresses and sensor calibrations. Original idea, review and improvement suggestions by David Brownell. Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bf6aede commit 06c421e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎include/linux/memory.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,15 @@ enum mem_add_context { BOOT, HOTPLUG };
9999
#define hotplug_memory_notifier(fn, pri) do { } while (0)
100100
#endif
101101

102+
/*
103+
* 'struct memory_accessor' is a generic interface to provide
104+
* in-kernel access to persistent memory such as i2c or SPI EEPROMs
105+
*/
106+
struct memory_accessor {
107+
ssize_t (*read)(struct memory_accessor *, char *buf, off_t offset,
108+
size_t count);
109+
ssize_t (*write)(struct memory_accessor *, const char *buf,
110+
off_t offset, size_t count);
111+
};
112+
102113
#endif /* _LINUX_MEMORY_H_ */

0 commit comments

Comments
 (0)