memory_accessor: new interface for reading/writing persistent memory

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, April 2, 2009 - 9:59 pm

Gitweb:     http://git.kernel.org/linus/06c421ee0d5af95c8c6749ca0ba620cd5010707f
Commit:     06c421ee0d5af95c8c6749ca0ba620cd5010707f
Parent:     bf6aede712334d7338d5c47a5ee5ba3883c82a61
Author:     Kevin Hilman <khilman@deeprootsystems.com>
AuthorDate: Thu Apr 2 16:56:56 2009 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu Apr 2 19:04:50 2009 -0700

    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>
---
 include/linux/memory.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/memory.h b/include/linux/memory.h
index 3fdc108..42767d1 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -99,4 +99,15 @@ enum mem_add_context { BOOT, HOTPLUG };
 #define hotplug_memory_notifier(fn, pri) do { } while (0)
 #endif
 
+/*
+ * 'struct memory_accessor' is a generic interface to provide
+ * in-kernel access to persistent memory such as i2c or SPI EEPROMs
+ */
+struct memory_accessor {
+	ssize_t (*read)(struct memory_accessor *, char *buf, off_t offset,
+			size_t count);
+	ssize_t (*write)(struct memory_accessor *, const char *buf,
+			 off_t offset, size_t count);
+};
+
 #endif /* _LINUX_MEMORY_H_ */
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
memory_accessor: new interface for reading/writing persist ..., Linux Kernel Mailing ..., (Thu Apr 2, 9:59 pm)