diff options
Diffstat (limited to 'drivers/ide/pci/ns87415.c')
-rw-r--r-- | drivers/ide/pci/ns87415.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 53bd645736d9..13789060f407 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -137,7 +137,7 @@ static void __devinit superio_init_iops(struct hwif_s *hwif) | |||
137 | static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; | 137 | static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * This routine either enables/disables (according to drive->present) | 140 | * This routine either enables/disables (according to IDE_DFLAG_PRESENT) |
141 | * the IRQ associated with the port (HWIF(drive)), | 141 | * the IRQ associated with the port (HWIF(drive)), |
142 | * and selects either PIO or DMA handshaking for the next I/O operation. | 142 | * and selects either PIO or DMA handshaking for the next I/O operation. |
143 | */ | 143 | */ |
@@ -153,11 +153,15 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
153 | 153 | ||
154 | /* Adjust IRQ enable bit */ | 154 | /* Adjust IRQ enable bit */ |
155 | bit = 1 << (8 + hwif->channel); | 155 | bit = 1 << (8 + hwif->channel); |
156 | new = drive->present ? (new & ~bit) : (new | bit); | 156 | |
157 | if (drive->dev_flags & IDE_DFLAG_PRESENT) | ||
158 | new &= ~bit; | ||
159 | else | ||
160 | new |= bit; | ||
157 | 161 | ||
158 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ | 162 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ |
159 | bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1)); | 163 | bit = 1 << (20 + (drive->dn & 1) + (hwif->channel << 1)); |
160 | other = 1 << (20 + (1 - drive->select.b.unit) + (hwif->channel << 1)); | 164 | other = 1 << (20 + (1 - (drive->dn & 1)) + (hwif->channel << 1)); |
161 | new = use_dma ? ((new & ~other) | bit) : (new & ~bit); | 165 | new = use_dma ? ((new & ~other) | bit) : (new & ~bit); |
162 | 166 | ||
163 | if (new != *old) { | 167 | if (new != *old) { |
@@ -187,7 +191,8 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
187 | 191 | ||
188 | static void ns87415_selectproc (ide_drive_t *drive) | 192 | static void ns87415_selectproc (ide_drive_t *drive) |
189 | { | 193 | { |
190 | ns87415_prepare_drive (drive, drive->using_dma); | 194 | ns87415_prepare_drive(drive, |
195 | !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); | ||
191 | } | 196 | } |
192 | 197 | ||
193 | static int ns87415_dma_end(ide_drive_t *drive) | 198 | static int ns87415_dma_end(ide_drive_t *drive) |
@@ -334,7 +339,7 @@ static const struct pci_device_id ns87415_pci_tbl[] = { | |||
334 | }; | 339 | }; |
335 | MODULE_DEVICE_TABLE(pci, ns87415_pci_tbl); | 340 | MODULE_DEVICE_TABLE(pci, ns87415_pci_tbl); |
336 | 341 | ||
337 | static struct pci_driver driver = { | 342 | static struct pci_driver ns87415_pci_driver = { |
338 | .name = "NS87415_IDE", | 343 | .name = "NS87415_IDE", |
339 | .id_table = ns87415_pci_tbl, | 344 | .id_table = ns87415_pci_tbl, |
340 | .probe = ns87415_init_one, | 345 | .probe = ns87415_init_one, |
@@ -345,12 +350,12 @@ static struct pci_driver driver = { | |||
345 | 350 | ||
346 | static int __init ns87415_ide_init(void) | 351 | static int __init ns87415_ide_init(void) |
347 | { | 352 | { |
348 | return ide_pci_register_driver(&driver); | 353 | return ide_pci_register_driver(&ns87415_pci_driver); |
349 | } | 354 | } |
350 | 355 | ||
351 | static void __exit ns87415_ide_exit(void) | 356 | static void __exit ns87415_ide_exit(void) |
352 | { | 357 | { |
353 | pci_unregister_driver(&driver); | 358 | pci_unregister_driver(&ns87415_pci_driver); |
354 | } | 359 | } |
355 | 360 | ||
356 | module_init(ns87415_ide_init); | 361 | module_init(ns87415_ide_init); |