[PATCH 5/9] ata: Use dma_alloc for buffer

Sascha Hauer s.hauer at pengutronix.de
Thu Dec 6 08:34:26 EST 2012


ATA devices using DMA may need a sufficiently aligned buffer, so use
dma_alloc instead of regular malloc.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/ata/disk_ata_drive.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index a1df4bd..923be9a 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -24,6 +24,7 @@
 #include <block.h>
 #include <ata_drive.h>
 #include <disks.h>
+#include <dma.h>
 
 #define ata_id_u32(id,n)        \
         (((uint32_t) (id)[(n) + 1] << 16) | ((uint32_t) (id)[(n)]))
@@ -266,7 +267,7 @@ int ata_port_register(struct ata_port *port)
 	struct ata_port_operations *ops = port->ops;
 	struct device_d *dev = port->dev;
 
-	port->id = xzalloc(SECTOR_SIZE);
+	port->id = dma_alloc(SECTOR_SIZE);
 
 	port->blk.dev = dev;
 	port->blk.ops = &ata_ops;
-- 
1.7.10.4




More information about the barebox mailing list