diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:58 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:58 -0400 |
commit | af1cbba37343c827e116638b097b94f5e6c38963 (patch) | |
tree | b50a70c9372275f7ef2a6a28b49f1495933386c4 | |
parent | 6059143ae34f30bb49ec8733468315284f78e2da (diff) |
ide: add ide_ports[]
* Add ide_ports[] table keeping pointers to all initialized ports.
* Set ide_ports[] entry for a given port in init_irq() and clear it
ide_remove_port_from_hwgroup().
* Convert init_irq() to use ide_ports[] instead of ide_hwifs[] for
grouping ports into hwgroup.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-probe.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 21cdd9ca14d1..482f41f3f15e 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -992,10 +992,14 @@ static void ide_port_setup_devices(ide_hwif_t *hwif) | |||
992 | mutex_unlock(&ide_cfg_mtx); | 992 | mutex_unlock(&ide_cfg_mtx); |
993 | } | 993 | } |
994 | 994 | ||
995 | static ide_hwif_t *ide_ports[MAX_HWIFS]; | ||
996 | |||
995 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | 997 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) |
996 | { | 998 | { |
997 | ide_hwgroup_t *hwgroup = hwif->hwgroup; | 999 | ide_hwgroup_t *hwgroup = hwif->hwgroup; |
998 | 1000 | ||
1001 | ide_ports[hwif->index] = NULL; | ||
1002 | |||
999 | spin_lock_irq(&ide_lock); | 1003 | spin_lock_irq(&ide_lock); |
1000 | /* | 1004 | /* |
1001 | * Remove us from the hwgroup, and free | 1005 | * Remove us from the hwgroup, and free |
@@ -1054,8 +1058,9 @@ static int init_irq (ide_hwif_t *hwif) | |||
1054 | * Group up with any other hwifs that share our irq(s). | 1058 | * Group up with any other hwifs that share our irq(s). |
1055 | */ | 1059 | */ |
1056 | for (index = 0; index < MAX_HWIFS; index++) { | 1060 | for (index = 0; index < MAX_HWIFS; index++) { |
1057 | ide_hwif_t *h = &ide_hwifs[index]; | 1061 | ide_hwif_t *h = ide_ports[index]; |
1058 | if (h->hwgroup) { /* scan only initialized hwif's */ | 1062 | |
1063 | if (h && h->hwgroup) { /* scan only initialized ports */ | ||
1059 | if (hwif->irq == h->irq) { | 1064 | if (hwif->irq == h->irq) { |
1060 | hwif->sharing_irq = h->sharing_irq = 1; | 1065 | hwif->sharing_irq = h->sharing_irq = 1; |
1061 | if (hwif->chipset != ide_pci || | 1066 | if (hwif->chipset != ide_pci || |
@@ -1109,6 +1114,8 @@ static int init_irq (ide_hwif_t *hwif) | |||
1109 | hwgroup->timer.data = (unsigned long) hwgroup; | 1114 | hwgroup->timer.data = (unsigned long) hwgroup; |
1110 | } | 1115 | } |
1111 | 1116 | ||
1117 | ide_ports[hwif->index] = hwif; | ||
1118 | |||
1112 | /* | 1119 | /* |
1113 | * Allocate the irq, if not already obtained for another hwif | 1120 | * Allocate the irq, if not already obtained for another hwif |
1114 | */ | 1121 | */ |