mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Hubert Feurstein <h.feurstein@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] eeprom/at25: add erase support
Date: Mon, 21 Nov 2011 14:31:31 +0100	[thread overview]
Message-ID: <1321882291-26290-1-git-send-email-h.feurstein@gmail.com> (raw)

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 drivers/eeprom/at25.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index 8a979d5..39c5846 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -237,10 +237,25 @@ static off_t at25_ee_lseek(struct cdev *cdev, off_t off)
 	return off;
 }
 
+static int at25_ee_erase(struct cdev *cdev, size_t count, unsigned long offset)
+{
+	int result;
+	void *buf = xzalloc(count);
+
+	result = at25_ee_write(cdev, buf, count, offset, 0);
+	free(buf);
+
+	if (result < 0)
+		return result;
+
+	return 0;
+}
+
 static struct file_operations at25_fops = {
 	.read	= at25_ee_read,
 	.write	= at25_ee_write,
 	.lseek	= at25_ee_lseek,
+	.erase	= at25_ee_erase,
 };
 
 static int at25_probe(struct device_d *dev)
-- 
1.7.4.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2011-11-21 13:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 13:31 Hubert Feurstein [this message]
2011-11-22  9:19 ` Sascha Hauer
2011-11-22  9:58   ` Hubert Feurstein
2011-11-22 10:45     ` Sascha Hauer
2011-11-24 13:02       ` Hubert Feurstein

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=1321882291-26290-1-git-send-email-h.feurstein@gmail.com \
    --to=h.feurstein@gmail.com \
    --cc=barebox@lists.infradead.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