public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	Kevin Hilman <khilman@deeprootsystems.com>
Subject: [PATCH v3 1/3] memory_accessor: new interface for reading/writing persistent memory
Date: Mon, 16 Mar 2009 14:36:17 -0700	[thread overview]
Message-ID: <1237239379-24186-2-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1237239379-24186-1-git-send-email-khilman@deeprootsystems.com>

This patch adds 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>
---
 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_ */
-- 
1.6.1.3


  reply	other threads:[~2009-03-16 21:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 21:36 [PATCH v3 0/3] new memory_accessor interface and usage Kevin Hilman
2009-03-16 21:36 ` Kevin Hilman [this message]
2009-03-16 21:36   ` [PATCH v3 2/3] Implement the new memory_accessor interface for I2C EEPROM Kevin Hilman
2009-03-16 21:36     ` [PATCH v3 3/3] Implement the new memory_accessor interfaces for SPI EEPROMs: Kevin Hilman
2009-03-16 23:10 ` [PATCH v3 0/3] new memory_accessor interface and usage David Brownell
2009-03-26 17:22   ` Kevin Hilman
2009-03-26 17:51     ` Andrew Morton
2009-03-26 17:54       ` Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1237239379-24186-2-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox