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: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org, Russell King <rmk@arm.linux.org.uk>
Subject: [PATCH 7/9] icside: use hwif->dev
Date: Thu, 27 Dec 2007 20:12:45 +0100	[thread overview]
Message-ID: <20071227191245.1357.38374.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20071227191153.1357.63211.sendpatchset@localhost.localdomain>

* Setup hwif->dev in icside_setup().

* Use hwif->dev instead of state->dev in icside_build_sglist(),
  icside_dma_end(), icside_dma_start() and icside_dma_setup().

* Remove no longer needed 'dev' field from struct icside_state.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/arm/icside.c |   31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

Index: b/drivers/ide/arm/icside.c
===================================================================
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -71,8 +71,6 @@ struct icside_state {
 	void __iomem *irq_port;
 	void __iomem *ioc_base;
 	unsigned int type;
-	/* parent device... until the IDE core gets one of its own */
-	struct device *dev;
 	ide_hwif_t *hwif[2];
 };
 
@@ -209,7 +207,6 @@ static void icside_maskproc(ide_drive_t 
 static void icside_build_sglist(ide_drive_t *drive, struct request *rq)
 {
 	ide_hwif_t *hwif = drive->hwif;
-	struct icside_state *state = hwif->hwif_data;
 	struct scatterlist *sg = hwif->sg_table;
 
 	ide_map_sg(drive, rq);
@@ -219,7 +216,7 @@ static void icside_build_sglist(ide_driv
 	else
 		hwif->sg_dma_direction = DMA_TO_DEVICE;
 
-	hwif->sg_nents = dma_map_sg(state->dev, sg, hwif->sg_nents,
+	hwif->sg_nents = dma_map_sg(hwif->dev, sg, hwif->sg_nents,
 				    hwif->sg_dma_direction);
 }
 
@@ -294,33 +291,33 @@ static void icside_dma_host_set(ide_driv
 static int icside_dma_end(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
-	struct icside_state *state = hwif->hwif_data;
+	struct expansion_card *ec = ECARD_DEV(hwif->dev);
 
 	drive->waiting_for_dma = 0;
 
-	disable_dma(ECARD_DEV(state->dev)->dma);
+	disable_dma(ec->dma);
 
 	/* Teardown mappings after DMA has completed. */
-	dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents,
+	dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents,
 		     hwif->sg_dma_direction);
 
-	return get_dma_residue(ECARD_DEV(state->dev)->dma) != 0;
+	return get_dma_residue(ec->dma) != 0;
 }
 
 static void icside_dma_start(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
-	struct icside_state *state = hwif->hwif_data;
+	struct expansion_card *ec = ECARD_DEV(hwif->dev);
 
 	/* We can not enable DMA on both channels simultaneously. */
-	BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma));
-	enable_dma(ECARD_DEV(state->dev)->dma);
+	BUG_ON(dma_channel_active(ec->dma));
+	enable_dma(ec->dma);
 }
 
 static int icside_dma_setup(ide_drive_t *drive)
 {
 	ide_hwif_t *hwif = HWIF(drive);
-	struct icside_state *state = hwif->hwif_data;
+	struct expansion_card *ec = ECARD_DEV(hwif->dev);
 	struct request *rq = hwif->hwgroup->rq;
 	unsigned int dma_mode;
 
@@ -332,7 +329,7 @@ static int icside_dma_setup(ide_drive_t 
 	/*
 	 * We can not enable DMA on both channels.
 	 */
-	BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma));
+	BUG_ON(dma_channel_active(ec->dma));
 
 	icside_build_sglist(drive, rq);
 
@@ -349,14 +346,14 @@ static int icside_dma_setup(ide_drive_t 
 	/*
 	 * Select the correct timing for this drive.
 	 */
-	set_dma_speed(ECARD_DEV(state->dev)->dma, drive->drive_data);
+	set_dma_speed(ec->dma, drive->drive_data);
 
 	/*
 	 * Tell the DMA engine about the SG table and
 	 * data direction.
 	 */
-	set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table, hwif->sg_nents);
-	set_dma_mode(ECARD_DEV(state->dev)->dma, dma_mode);
+	set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents);
+	set_dma_mode(ec->dma, dma_mode);
 
 	drive->waiting_for_dma = 1;
 
@@ -444,6 +441,7 @@ icside_setup(void __iomem *base, struct 
 		hwif->noprobe = 0;
 		hwif->chipset = ide_acorn;
 		hwif->gendev.parent = &ec->dev;
+		hwif->dev = &ec->dev;
 	}
 
 	return hwif;
@@ -591,7 +589,6 @@ icside_probe(struct expansion_card *ec, 
 	}
 
 	state->type	= ICS_TYPE_NOTYPE;
-	state->dev	= &ec->dev;
 
 	idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
 	if (idmem) {

  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 ` Bartlomiej Zolnierkiewicz [this message]
2007-12-28 13:24   ` [PATCH 7/9] icside: " Sergei Shtylyov
2007-12-29 13:52   ` Sergei Shtylyov
2007-12-29 13:55     ` Sergei Shtylyov
2007-12-27 19:12 ` [PATCH 8/9] ide: switch to DMA-mapping API Bartlomiej Zolnierkiewicz
2008-01-02  8:34   ` 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=20071227191245.1357.38374.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.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).