Skip to content

Commit

Permalink
cy82c693: fix PCI device selection
Browse files Browse the repository at this point in the history
Wrong PCI device may be selected by cy82c693_set_pio_mode() if modular
IDE host drivers are used and there are additional IDE PCI devices
installed in the system.  Fix it.

Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
bzolnier authored and davem330 committed Oct 13, 2011
1 parent acc8dbe commit 0ab3d8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/ide/cy82c693.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1998-2000 Andreas S. Krebs ([email protected]), Maintainer
* Copyright (C) 1998-2002 Andre Hedrick <[email protected]>, Integrator
* Copyright (C) 2007-2010 Bartlomiej Zolnierkiewicz
* Copyright (C) 2007-2011 Bartlomiej Zolnierkiewicz
*
* CYPRESS CY82C693 chipset IDE controller
*
Expand Down Expand Up @@ -90,7 +90,7 @@ static void cy82c693_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
u8 time_16, time_8;

/* select primary or secondary channel */
if (hwif->index > 0) { /* drive is on the secondary channel */
if (drive->dn > 1) { /* drive is on the secondary channel */
dev = pci_get_slot(dev->bus, dev->devfn+1);
if (!dev) {
printk(KERN_ERR "%s: tune_drive: "
Expand Down Expand Up @@ -141,7 +141,7 @@ static void cy82c693_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
pci_write_config_byte(dev, CY82_IDE_SLAVE_IOW, time_16);
pci_write_config_byte(dev, CY82_IDE_SLAVE_8BIT, time_8);
}
if (hwif->index > 0)
if (drive->dn > 1)
pci_dev_put(dev);
}

Expand Down

0 comments on commit 0ab3d8b

Please sign in to comment.