aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:31 -0400
commitbad7c825cb27377faf1c926953aa15c980c62620 (patch)
treeb23b40a51c7f6399eae5cedb3fe27d4d209055a8 /drivers
parent1baccff8a5823b51d7bf2740ef3ef17e06bfa7e2 (diff)
ide: cleanup ide_match_hwif()
* Remove no longer needed matching against I/O base and 'io_base' argument. * Move printk() to the caller and remove 'name' argument. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/setup-pci.c47
1 files changed, 15 insertions, 32 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 2dc3835478ec..7347faf8bc41 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -22,42 +22,20 @@
22 22
23 23
24/** 24/**
25 * ide_match_hwif - match a PCI IDE against an ide_hwif 25 * ide_match_hwif - find free ide_hwifs[] slot
26 * @io_base: I/O base of device 26 * @bootable: bootable flag
27 * @bootable: set if its bootable
28 * @name: name of device
29 * 27 *
30 * Match a PCI IDE port against an entry in ide_hwifs[], 28 * Return the new hwif. If we are out of free slots return NULL.
31 * based on io_base port if possible. Return the matching hwif,
32 * or a new hwif. If we find an error (clashing, out of devices, etc)
33 * return NULL
34 *
35 * FIXME: we need to handle mmio matches here too
36 */ 29 */
37 30
38static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char *name) 31static ide_hwif_t *ide_match_hwif(u8 bootable)
39{ 32{
40 int h;
41 ide_hwif_t *hwif; 33 ide_hwif_t *hwif;
34 int h;
42 35
43 /* 36 /*
44 * Look for a hwif with matching io_base default value. 37 * Claim an unassigned slot.
45 * If chipset is "ide_unknown", then claim that hwif slot. 38 *
46 * Otherwise, some other chipset has already claimed it.. :(
47 */
48 for (h = 0; h < MAX_HWIFS; ++h) {
49 hwif = &ide_hwifs[h];
50 if (hwif->io_ports[IDE_DATA_OFFSET] == io_base) {
51 if (hwif->chipset == ide_unknown)
52 return hwif; /* match */
53 printk(KERN_ERR "%s: port 0x%04lx already claimed by %s\n",
54 name, io_base, hwif->name);
55 return NULL; /* already claimed */
56 }
57 }
58 /*
59 * Okay, there is no hwif matching our io_base,
60 * so we'll just claim an unassigned slot.
61 * Give preference to claiming other slots before claiming ide0/ide1, 39 * Give preference to claiming other slots before claiming ide0/ide1,
62 * just in case there's another interface yet-to-be-scanned 40 * just in case there's another interface yet-to-be-scanned
63 * which uses ports 1f0/170 (the ide0/ide1 defaults). 41 * which uses ports 1f0/170 (the ide0/ide1 defaults).
@@ -83,7 +61,7 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char
83 if (hwif->chipset == ide_unknown) 61 if (hwif->chipset == ide_unknown)
84 return hwif; /* pick an unused entry */ 62 return hwif; /* pick an unused entry */
85 } 63 }
86 printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", name); 64
87 return NULL; 65 return NULL;
88} 66}
89 67
@@ -367,8 +345,13 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
367 ctl = port ? 0x374 : 0x3f4; 345 ctl = port ? 0x374 : 0x3f4;
368 base = port ? 0x170 : 0x1f0; 346 base = port ? 0x170 : 0x1f0;
369 } 347 }
370 if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL) 348
371 return NULL; /* no room in ide_hwifs[] */ 349 hwif = ide_match_hwif(bootable);
350 if (hwif == NULL) {
351 printk(KERN_ERR "%s: too many IDE interfaces, no room in "
352 "table\n", d->name);
353 return NULL;
354 }
372 355
373 memset(&hw, 0, sizeof(hw)); 356 memset(&hw, 0, sizeof(hw));
374 hw.irq = irq; 357 hw.irq = irq;