[PATCH] eeprom/at25: add erase support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Hubert Feurstein <h.feurstein@xxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux