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>
This commit is contained in:
@@ -992,10 +992,14 @@ static void ide_port_setup_devices(ide_hwif_t *hwif)
|
|||||||
mutex_unlock(&ide_cfg_mtx);
|
mutex_unlock(&ide_cfg_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ide_hwif_t *ide_ports[MAX_HWIFS];
|
||||||
|
|
||||||
void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
|
void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
|
||||||
{
|
{
|
||||||
ide_hwgroup_t *hwgroup = hwif->hwgroup;
|
ide_hwgroup_t *hwgroup = hwif->hwgroup;
|
||||||
|
|
||||||
|
ide_ports[hwif->index] = NULL;
|
||||||
|
|
||||||
spin_lock_irq(&ide_lock);
|
spin_lock_irq(&ide_lock);
|
||||||
/*
|
/*
|
||||||
* Remove us from the hwgroup, and free
|
* Remove us from the hwgroup, and free
|
||||||
@@ -1054,8 +1058,9 @@ static int init_irq (ide_hwif_t *hwif)
|
|||||||
* Group up with any other hwifs that share our irq(s).
|
* Group up with any other hwifs that share our irq(s).
|
||||||
*/
|
*/
|
||||||
for (index = 0; index < MAX_HWIFS; index++) {
|
for (index = 0; index < MAX_HWIFS; index++) {
|
||||||
ide_hwif_t *h = &ide_hwifs[index];
|
ide_hwif_t *h = ide_ports[index];
|
||||||
if (h->hwgroup) { /* scan only initialized hwif's */
|
|
||||||
|
if (h && h->hwgroup) { /* scan only initialized ports */
|
||||||
if (hwif->irq == h->irq) {
|
if (hwif->irq == h->irq) {
|
||||||
hwif->sharing_irq = h->sharing_irq = 1;
|
hwif->sharing_irq = h->sharing_irq = 1;
|
||||||
if (hwif->chipset != ide_pci ||
|
if (hwif->chipset != ide_pci ||
|
||||||
@@ -1109,6 +1114,8 @@ static int init_irq (ide_hwif_t *hwif)
|
|||||||
hwgroup->timer.data = (unsigned long) hwgroup;
|
hwgroup->timer.data = (unsigned long) hwgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ide_ports[hwif->index] = hwif;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate the irq, if not already obtained for another hwif
|
* Allocate the irq, if not already obtained for another hwif
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user