[PATCH 3/4] ata: make write support optional

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 8 10:48:35 EDT 2011


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/ata/Kconfig      |    4 ++++
 drivers/ata/disk_drive.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 05cba70..d7f4dcb 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -8,6 +8,10 @@ if ATA
 
 comment "drive types"
 
+config ATA_WRITE
+	select BLOCK_WRITE
+	bool "support writing to ATA drives"
+
 config ATA_DISK
 	bool "disk drives"
 	help
diff --git a/drivers/ata/disk_drive.c b/drivers/ata/disk_drive.c
index 4ad5a7a..f526b1e 100644
--- a/drivers/ata/disk_drive.c
+++ b/drivers/ata/disk_drive.c
@@ -137,6 +137,7 @@ static int atablk_read(struct block_device *blk, void *buf, int block,
 	return atablk->intf->read(atablk->dev, block, num_blocks, buf);
 }
 
+#ifdef CONFIG_ATA_WRITE
 static int atablk_write(struct block_device *blk, const void *buf, int block,
 		int num_blocks)
 {
@@ -144,10 +145,13 @@ static int atablk_write(struct block_device *blk, const void *buf, int block,
 
 	return atablk->intf->write(atablk->dev, block, num_blocks, buf);
 }
+#endif
 
 static struct block_device_ops ataops = {
 	.read = atablk_read,
+#ifdef CONFIG_ATA_WRITE
 	.write = atablk_write,
+#endif
 };
 
 /**
-- 
1.7.2.3




More information about the barebox mailing list