[RFC PATCH 3/4] pio-mapping: Use the PIO mapping API in libata-sff.c

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

 



This patch shows an example of PIO API usage for non-highmem pages. It
is assumed that kunmap_atomic() performs cache flushing though this may
not always be the case (needs checking with architecture people).

Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
---
 drivers/ata/libata-sff.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 741065c..5b72a92 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -36,6 +36,7 @@
 #include <linux/pci.h>
 #include <linux/libata.h>
 #include <linux/highmem.h>
+#include <linux/pio-mapping.h>
 
 #include "libata.h"
 
@@ -888,9 +889,12 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
 		kunmap_atomic(buf, KM_IRQ0);
 		local_irq_restore(flags);
 	} else {
-		buf = page_address(page);
-		ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size,
-				       do_write);
+		enum pio_data_direction dir = do_write ?
+			PIO_TO_DEVICE : PIO_FROM_DEVICE;
+
+		buf = pio_map_page(page, offset, qc->sect_size, dir);
+		ap->ops->sff_data_xfer(qc->dev, buf, qc->sect_size, do_write);
+		pio_unmap_page(buf, qc->sect_size, dir);
 	}
 
 	qc->curbytes += qc->sect_size;

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux