aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memory.h
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2009-04-02 19:56:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 22:04:50 -0400
commit06c421ee0d5af95c8c6749ca0ba620cd5010707f (patch)
treee4b2cd412d7dd3081f8aaee88d77b1ab72b33b15 /include/linux/memory.h
parentbf6aede712334d7338d5c47a5ee5ba3883c82a61 (diff)
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>
Diffstat (limited to 'include/linux/memory.h')
-rw-r--r--include/linux/memory.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 3fdc10806d31..42767d1a62e7 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -99,4 +99,15 @@ enum mem_add_context { BOOT, HOTPLUG };
99#define hotplug_memory_notifier(fn, pri) do { } while (0) 99#define hotplug_memory_notifier(fn, pri) do { } while (0)
100#endif 100#endif
101 101
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 */
106struct 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
102#endif /* _LINUX_MEMORY_H_ */ 113#endif /* _LINUX_MEMORY_H_ */