aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:18 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:18 -0400
commit2c4be251be1cace01a2a18bf5abb847010516511 (patch)
tree65ab1a6cf45006101d843c042db849f35a6cf71a
parent1664949843e8c0782c8f2e40897285a8dfffdf27 (diff)
ide-4drives: manage I/O resources in driver
* Tell IDE layer to not manage resources by setting hwif->mmio flag. * Use {request,release}_region() for resources management. * Use driver name for resources management. * Remove no longer needed 'hwif->chipset == ide_4drives' handling from ide_device_add_all(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-probe.c3
-rw-r--r--drivers/ide/legacy/ide-4drives.c20
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index d37a2680ceed..da6025cfa09a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1530,8 +1530,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1530 1530
1531 hwif = &ide_hwifs[idx[i]]; 1531 hwif = &ide_hwifs[idx[i]];
1532 1532
1533 if ((hwif->chipset != ide_4drives || !hwif->mate || 1533 if (ide_hwif_request_regions(hwif)) {
1534 !hwif->mate->present) && ide_hwif_request_regions(hwif)) {
1535 printk(KERN_ERR "%s: ports already in use, " 1534 printk(KERN_ERR "%s: ports already in use, "
1536 "skipping probe\n", hwif->name); 1535 "skipping probe\n", hwif->name);
1537 continue; 1536 continue;
diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c
index c352f12348af..e69566284ab7 100644
--- a/drivers/ide/legacy/ide-4drives.c
+++ b/drivers/ide/legacy/ide-4drives.c
@@ -4,6 +4,8 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/ide.h> 5#include <linux/ide.h>
6 6
7#define DRV_NAME "ide-4drives"
8
7int probe_4drives; 9int probe_4drives;
8 10
9module_param_named(probe, probe_4drives, bool, 0); 11module_param_named(probe, probe_4drives, bool, 0);
@@ -12,21 +14,36 @@ MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
12static int __init ide_4drives_init(void) 14static int __init ide_4drives_init(void)
13{ 15{
14 ide_hwif_t *hwif, *mate; 16 ide_hwif_t *hwif, *mate;
17 unsigned long base = 0x1f0, ctl = 0x3f6;
15 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 18 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
16 hw_regs_t hw; 19 hw_regs_t hw;
17 20
18 if (probe_4drives == 0) 21 if (probe_4drives == 0)
19 return -ENODEV; 22 return -ENODEV;
20 23
24 if (!request_region(base, 8, DRV_NAME)) {
25 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
26 DRV_NAME, base, base + 7);
27 return -EBUSY;
28 }
29
30 if (!request_region(ctl, 1, DRV_NAME)) {
31 printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
32 DRV_NAME, ctl);
33 release_region(base, 8);
34 return -EBUSY;
35 }
36
21 memset(&hw, 0, sizeof(hw)); 37 memset(&hw, 0, sizeof(hw));
22 38
23 ide_std_init_ports(&hw, 0x1f0, 0x3f6); 39 ide_std_init_ports(&hw, base, ctl);
24 hw.irq = 14; 40 hw.irq = 14;
25 hw.chipset = ide_4drives; 41 hw.chipset = ide_4drives;
26 42
27 hwif = ide_find_port(); 43 hwif = ide_find_port();
28 if (hwif) { 44 if (hwif) {
29 ide_init_port_hw(hwif, &hw); 45 ide_init_port_hw(hwif, &hw);
46 hwif->mmio = 1;
30 idx[0] = hwif->index; 47 idx[0] = hwif->index;
31 } 48 }
32 49
@@ -35,6 +52,7 @@ static int __init ide_4drives_init(void)
35 ide_init_port_hw(mate, &hw); 52 ide_init_port_hw(mate, &hw);
36 mate->drives[0].select.all ^= 0x20; 53 mate->drives[0].select.all ^= 0x20;
37 mate->drives[1].select.all ^= 0x20; 54 mate->drives[1].select.all ^= 0x20;
55 mate->mmio = 1;
38 idx[1] = mate->index; 56 idx[1] = mate->index;
39 57
40 if (hwif) { 58 if (hwif) {