linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bryan Wu <bryan.wu@analog.com>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org, Russell King <rmk@arm.linux.org.uk>
Subject: [PATCH 8/9] ide: switch to DMA-mapping API
Date: Thu, 27 Dec 2007 20:12:52 +0100	[thread overview]
Message-ID: <20071227191252.1357.76726.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20071227191153.1357.63211.sendpatchset@localhost.localdomain>

* pci_map_sg() -> dma_map_sg() in ide_build_sglist().

* pci_unmap_sg() -> dma_unmap_sg() in ide_destroy_dmatable().

There should be no functionality changes caused by this patch except
for blackfin arch whose dma_[un]map_sg() implementation differs from
pci_[un]map_sg() one (on s390 arch there is no PCI, on avr32 and h8300
archs PCI is currently unsupported, on m32r arch PCI support depends
on BROKEN, on m68k arch PCI support depends on HADES which in turn
depends on BROKEN, on all other archs dma_[un]map_sg() functionality
matches with pci_[un]map_sg() one).

Cc: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
It seems like blackfin arch should be using <asm-generic/pci-dma-compat.h>
in <asm-blackfin/pci.h> or drivers still using PCI DMA-mapping API instead
of the generic one won't work but I'll leave this to blackfin gurus...

[ Bryan, could you please take a look?  Thanks. ]

 drivers/ide/ide-dma.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Index: b/drivers/ide/ide-dma.c
===================================================================
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -85,6 +85,7 @@
 #include <linux/ide.h>
 #include <linux/delay.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -175,26 +176,26 @@ static int ide_dma_good_drive(ide_drive_
  *	@drive: the drive to build the DMA table for
  *	@rq: the request holding the sg list
  *
- *	Perform the PCI mapping magic necessary to access the source or
- *	target buffers of a request via PCI DMA. The lower layers of the
+ *	Perform the DMA mapping magic necessary to access the source or
+ *	target buffers of a request via DMA.  The lower layers of the
  *	kernel provide the necessary cache management so that we can
- *	operate in a portable fashion
+ *	operate in a portable fashion.
  */
 
 int ide_build_sglist(ide_drive_t *drive, struct request *rq)
 {
 	ide_hwif_t *hwif = HWIF(drive);
-	struct pci_dev *pdev = to_pci_dev(hwif->dev);
 	struct scatterlist *sg = hwif->sg_table;
 
 	ide_map_sg(drive, rq);
 
 	if (rq_data_dir(rq) == READ)
-		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+		hwif->sg_dma_direction = DMA_FROM_DEVICE;
 	else
-		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
+		hwif->sg_dma_direction = DMA_TO_DEVICE;
 
-	return pci_map_sg(pdev, sg, hwif->sg_nents, hwif->sg_dma_direction);
+	return dma_map_sg(hwif->dev, sg, hwif->sg_nents,
+			  hwif->sg_dma_direction);
 }
 
 EXPORT_SYMBOL_GPL(ide_build_sglist);
@@ -308,9 +309,8 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);
 void ide_destroy_dmatable (ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = drive->hwif;
-	struct pci_dev *pdev = to_pci_dev(hwif->dev);
 
-	pci_unmap_sg(pdev, hwif->sg_table, hwif->sg_nents,
+	dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents,
 		     hwif->sg_dma_direction);
 }
 

  parent reply	other threads:[~2007-12-27 19:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-27 19:11 [PATCH 0/9] ide: switch to generic DMA-mapping API Bartlomiej Zolnierkiewicz
2007-12-27 19:12 ` [PATCH 1/9] piix: remove stale comments Bartlomiej Zolnierkiewicz
2007-12-28 12:02   ` Sergei Shtylyov
2007-12-30 17:09     ` Bartlomiej Zolnierkiewicz
2007-12-27 19:12 ` [PATCH 2/9] ide: fix ide_intr() for non-PCI devices and CONFIG_BLK_DEV_IDEPCI=y Bartlomiej Zolnierkiewicz
2007-12-28 12:15   ` Sergei Shtylyov
2007-12-27 19:12 ` [PATCH 3/9] ide: remove BUG_ON() from ide_build_sglist() Bartlomiej Zolnierkiewicz
2007-12-27 19:12 ` [PATCH 4/9] ide: use ide_destroy_dmatable() instead of pci_unmap_sg() Bartlomiej Zolnierkiewicz
2007-12-29 13:43   ` Sergei Shtylyov
2007-12-27 19:12 ` [PATCH 5/9] ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t Bartlomiej Zolnierkiewicz
2007-12-27 19:12 ` [PATCH 6/9] au1xxx-ide: use hwif->dev Bartlomiej Zolnierkiewicz
2007-12-27 19:12 ` [PATCH 7/9] icside: " Bartlomiej Zolnierkiewicz
2007-12-28 13:24   ` Sergei Shtylyov
2007-12-29 13:52   ` Sergei Shtylyov
2007-12-29 13:55     ` Sergei Shtylyov
2007-12-27 19:12 ` Bartlomiej Zolnierkiewicz [this message]
2008-01-02  8:34   ` [PATCH 8/9] ide: switch to DMA-mapping API Bryan Wu
2007-12-27 19:12 ` [PATCH 9/9] ide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers Bartlomiej Zolnierkiewicz

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=20071227191252.1357.76726.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=bryan.wu@analog.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).