aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/setup-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r--drivers/ide/setup-pci.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index abcfb1739d4d..65fc08b6b6d0 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -6,19 +6,15 @@
6 * May be copied or modified under the terms of the GNU General Public License 6 * May be copied or modified under the terms of the GNU General Public License
7 */ 7 */
8 8
9#include <linux/module.h>
10#include <linux/types.h> 9#include <linux/types.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <linux/pci.h> 11#include <linux/pci.h>
13#include <linux/init.h> 12#include <linux/init.h>
14#include <linux/timer.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h> 13#include <linux/interrupt.h>
17#include <linux/ide.h> 14#include <linux/ide.h>
18#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
19 16
20#include <asm/io.h> 17#include <asm/io.h>
21#include <asm/irq.h>
22 18
23/** 19/**
24 * ide_setup_pci_baseregs - place a PCI IDE controller native 20 * ide_setup_pci_baseregs - place a PCI IDE controller native
@@ -319,25 +315,22 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
319 315
320 ctl = pci_resource_start(dev, 2*port+1); 316 ctl = pci_resource_start(dev, 2*port+1);
321 base = pci_resource_start(dev, 2*port); 317 base = pci_resource_start(dev, 2*port);
322 if ((ctl && !base) || (base && !ctl)) { 318 } else {
323 printk(KERN_ERR "%s: inconsistent baseregs (BIOS) "
324 "for port %d, skipping\n", d->name, port);
325 return NULL;
326 }
327 }
328 if (!ctl) {
329 /* Use default values */ 319 /* Use default values */
330 ctl = port ? 0x374 : 0x3f4; 320 ctl = port ? 0x374 : 0x3f4;
331 base = port ? 0x170 : 0x1f0; 321 base = port ? 0x170 : 0x1f0;
332 } 322 }
333 323
334 hwif = ide_find_port_slot(d); 324 if (!base || !ctl) {
335 if (hwif == NULL) { 325 printk(KERN_ERR "%s: bad PCI BARs for port %d, skipping\n",
336 printk(KERN_ERR "%s: too many IDE interfaces, no room in " 326 d->name, port);
337 "table\n", d->name);
338 return NULL; 327 return NULL;
339 } 328 }
340 329
330 hwif = ide_find_port_slot(d);
331 if (hwif == NULL)
332 return NULL;
333
341 memset(&hw, 0, sizeof(hw)); 334 memset(&hw, 0, sizeof(hw));
342 hw.irq = irq; 335 hw.irq = irq;
343 hw.dev = &dev->dev; 336 hw.dev = &dev->dev;
@@ -346,8 +339,6 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
346 339
347 ide_init_port_hw(hwif, &hw); 340 ide_init_port_hw(hwif, &hw);
348 341
349 hwif->dev = &dev->dev;
350
351 return hwif; 342 return hwif;
352} 343}
353 344