diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:39 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:39 -0500 |
commit | 9e016a719209d95338e314b46c3012cc7feaaeec (patch) | |
tree | cc19b160cfb6210385fbf29890351f9ca2ba73df /drivers/ide/arm | |
parent | f82c2b171905b6d5af92395d8159546351ab602f (diff) |
ide: add ide_deprecated_find_port() helper
* Factor out code for finding ide_hwifs[] slot from ide_register_hw()
to ide_deprecated_find_port().
* Convert bast-ide, ide-cs and delkin_cb host drivers to use ide_device_add()
instead of ide_register_hw() (while at it drop doing "ide_unregister()" loop
which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot
cannot be find).
This patch leaves us with only two ide_register_hw() users:
- drivers/macintosh/mediabay.c
- drivers/ide/ide.c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm')
-rw-r--r-- | drivers/ide/arm/bast-ide.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index 037300fa284c..2864f5aca3f1 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c | |||
@@ -28,8 +28,10 @@ static int __init | |||
28 | bastide_register(unsigned int base, unsigned int aux, int irq, | 28 | bastide_register(unsigned int base, unsigned int aux, int irq, |
29 | ide_hwif_t **hwif) | 29 | ide_hwif_t **hwif) |
30 | { | 30 | { |
31 | ide_hwif_t *hwif; | ||
31 | hw_regs_t hw; | 32 | hw_regs_t hw; |
32 | int i; | 33 | int i; |
34 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
33 | 35 | ||
34 | memset(&hw, 0, sizeof(hw)); | 36 | memset(&hw, 0, sizeof(hw)); |
35 | 37 | ||
@@ -44,8 +46,24 @@ bastide_register(unsigned int base, unsigned int aux, int irq, | |||
44 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); | 46 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); |
45 | hw.irq = irq; | 47 | hw.irq = irq; |
46 | 48 | ||
47 | ide_register_hw(&hw, NULL, hwif); | 49 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
50 | if (hwif == NULL) | ||
51 | goto out; | ||
48 | 52 | ||
53 | i = hwif->index; | ||
54 | |||
55 | if (hwif->present) | ||
56 | ide_unregister(i, 0, 1); | ||
57 | else if (!hwif->hold) | ||
58 | ide_init_port_data(hwif, i); | ||
59 | |||
60 | ide_init_port_hw(hwif, &hw); | ||
61 | hwif->quirkproc = NULL; | ||
62 | |||
63 | idx[0] = i; | ||
64 | |||
65 | ide_device_add(idx, NULL); | ||
66 | out: | ||
49 | return 0; | 67 | return 0; |
50 | } | 68 | } |
51 | 69 | ||