diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:32 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:32 -0500 |
commit | f8341c1c19730f1869f2f12e30fe56ff4afb4189 (patch) | |
tree | 3707c24fdb170b6a45116caa96a9a1865c31538c /drivers/ide/arm/icside.c | |
parent | 5df37c34a3acf29d1eb6fc675d078654da0ab395 (diff) |
icside: use hwif->dev
* 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>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm/icside.c')
-rw-r--r-- | drivers/ide/arm/icside.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 8a5c7205b77c..774b87e1b704 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -71,8 +71,6 @@ struct icside_state { | |||
71 | void __iomem *irq_port; | 71 | void __iomem *irq_port; |
72 | void __iomem *ioc_base; | 72 | void __iomem *ioc_base; |
73 | unsigned int type; | 73 | unsigned int type; |
74 | /* parent device... until the IDE core gets one of its own */ | ||
75 | struct device *dev; | ||
76 | ide_hwif_t *hwif[2]; | 74 | ide_hwif_t *hwif[2]; |
77 | }; | 75 | }; |
78 | 76 | ||
@@ -209,7 +207,6 @@ static void icside_maskproc(ide_drive_t *drive, int mask) | |||
209 | static void icside_build_sglist(ide_drive_t *drive, struct request *rq) | 207 | static void icside_build_sglist(ide_drive_t *drive, struct request *rq) |
210 | { | 208 | { |
211 | ide_hwif_t *hwif = drive->hwif; | 209 | ide_hwif_t *hwif = drive->hwif; |
212 | struct icside_state *state = hwif->hwif_data; | ||
213 | struct scatterlist *sg = hwif->sg_table; | 210 | struct scatterlist *sg = hwif->sg_table; |
214 | 211 | ||
215 | ide_map_sg(drive, rq); | 212 | ide_map_sg(drive, rq); |
@@ -219,7 +216,7 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq) | |||
219 | else | 216 | else |
220 | hwif->sg_dma_direction = DMA_TO_DEVICE; | 217 | hwif->sg_dma_direction = DMA_TO_DEVICE; |
221 | 218 | ||
222 | hwif->sg_nents = dma_map_sg(state->dev, sg, hwif->sg_nents, | 219 | hwif->sg_nents = dma_map_sg(hwif->dev, sg, hwif->sg_nents, |
223 | hwif->sg_dma_direction); | 220 | hwif->sg_dma_direction); |
224 | } | 221 | } |
225 | 222 | ||
@@ -294,33 +291,33 @@ static void icside_dma_host_set(ide_drive_t *drive, int on) | |||
294 | static int icside_dma_end(ide_drive_t *drive) | 291 | static int icside_dma_end(ide_drive_t *drive) |
295 | { | 292 | { |
296 | ide_hwif_t *hwif = HWIF(drive); | 293 | ide_hwif_t *hwif = HWIF(drive); |
297 | struct icside_state *state = hwif->hwif_data; | 294 | struct expansion_card *ec = ECARD_DEV(hwif->dev); |
298 | 295 | ||
299 | drive->waiting_for_dma = 0; | 296 | drive->waiting_for_dma = 0; |
300 | 297 | ||
301 | disable_dma(ECARD_DEV(state->dev)->dma); | 298 | disable_dma(ec->dma); |
302 | 299 | ||
303 | /* Teardown mappings after DMA has completed. */ | 300 | /* Teardown mappings after DMA has completed. */ |
304 | dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, | 301 | dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents, |
305 | hwif->sg_dma_direction); | 302 | hwif->sg_dma_direction); |
306 | 303 | ||
307 | return get_dma_residue(ECARD_DEV(state->dev)->dma) != 0; | 304 | return get_dma_residue(ec->dma) != 0; |
308 | } | 305 | } |
309 | 306 | ||
310 | static void icside_dma_start(ide_drive_t *drive) | 307 | static void icside_dma_start(ide_drive_t *drive) |
311 | { | 308 | { |
312 | ide_hwif_t *hwif = HWIF(drive); | 309 | ide_hwif_t *hwif = HWIF(drive); |
313 | struct icside_state *state = hwif->hwif_data; | 310 | struct expansion_card *ec = ECARD_DEV(hwif->dev); |
314 | 311 | ||
315 | /* We can not enable DMA on both channels simultaneously. */ | 312 | /* We can not enable DMA on both channels simultaneously. */ |
316 | BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma)); | 313 | BUG_ON(dma_channel_active(ec->dma)); |
317 | enable_dma(ECARD_DEV(state->dev)->dma); | 314 | enable_dma(ec->dma); |
318 | } | 315 | } |
319 | 316 | ||
320 | static int icside_dma_setup(ide_drive_t *drive) | 317 | static int icside_dma_setup(ide_drive_t *drive) |
321 | { | 318 | { |
322 | ide_hwif_t *hwif = HWIF(drive); | 319 | ide_hwif_t *hwif = HWIF(drive); |
323 | struct icside_state *state = hwif->hwif_data; | 320 | struct expansion_card *ec = ECARD_DEV(hwif->dev); |
324 | struct request *rq = hwif->hwgroup->rq; | 321 | struct request *rq = hwif->hwgroup->rq; |
325 | unsigned int dma_mode; | 322 | unsigned int dma_mode; |
326 | 323 | ||
@@ -332,7 +329,7 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
332 | /* | 329 | /* |
333 | * We can not enable DMA on both channels. | 330 | * We can not enable DMA on both channels. |
334 | */ | 331 | */ |
335 | BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma)); | 332 | BUG_ON(dma_channel_active(ec->dma)); |
336 | 333 | ||
337 | icside_build_sglist(drive, rq); | 334 | icside_build_sglist(drive, rq); |
338 | 335 | ||
@@ -349,14 +346,14 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
349 | /* | 346 | /* |
350 | * Select the correct timing for this drive. | 347 | * Select the correct timing for this drive. |
351 | */ | 348 | */ |
352 | set_dma_speed(ECARD_DEV(state->dev)->dma, drive->drive_data); | 349 | set_dma_speed(ec->dma, drive->drive_data); |
353 | 350 | ||
354 | /* | 351 | /* |
355 | * Tell the DMA engine about the SG table and | 352 | * Tell the DMA engine about the SG table and |
356 | * data direction. | 353 | * data direction. |
357 | */ | 354 | */ |
358 | set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table, hwif->sg_nents); | 355 | set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents); |
359 | set_dma_mode(ECARD_DEV(state->dev)->dma, dma_mode); | 356 | set_dma_mode(ec->dma, dma_mode); |
360 | 357 | ||
361 | drive->waiting_for_dma = 1; | 358 | drive->waiting_for_dma = 1; |
362 | 359 | ||
@@ -444,6 +441,7 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e | |||
444 | hwif->noprobe = 0; | 441 | hwif->noprobe = 0; |
445 | hwif->chipset = ide_acorn; | 442 | hwif->chipset = ide_acorn; |
446 | hwif->gendev.parent = &ec->dev; | 443 | hwif->gendev.parent = &ec->dev; |
444 | hwif->dev = &ec->dev; | ||
447 | } | 445 | } |
448 | 446 | ||
449 | return hwif; | 447 | return hwif; |
@@ -591,7 +589,6 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
591 | } | 589 | } |
592 | 590 | ||
593 | state->type = ICS_TYPE_NOTYPE; | 591 | state->type = ICS_TYPE_NOTYPE; |
594 | state->dev = &ec->dev; | ||
595 | 592 | ||
596 | idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 593 | idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
597 | if (idmem) { | 594 | if (idmem) { |