ide: manage I/O resources in ide_legacy_init_one()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Apr 2008 20:25:18 +0000 (22:25 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Apr 2008 20:25:18 +0000 (22:25 +0200)
* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Set ->name field of 'struct ide_port_info' instances in legacy VLB
  host drivers and use driver name for resources management.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-probe.c
drivers/ide/legacy/ali14xx.c
drivers/ide/legacy/dtc2278.c
drivers/ide/legacy/ht6560b.c
drivers/ide/legacy/qd65xx.c
drivers/ide/legacy/umc8672.c

index e299c80c6a578aab36d596faf6e3883c135aec47..670d7f9ccf0e3692e7179e4a7eab36a08056d760 100644 (file)
@@ -1648,12 +1648,26 @@ static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no,
                irq  = 15;
        }
 
+       if (!request_region(base, 8, d->name)) {
+               printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
+                               d->name, base, base + 7);
+               return;
+       }
+
+       if (!request_region(ctl, 1, d->name)) {
+               printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
+                               d->name, ctl);
+               release_region(base, 8);
+               return;
+       }
+
        ide_std_init_ports(hw, base, ctl);
        hw->irq = irq;
 
        hwif = ide_find_port_slot(d);
        if (hwif) {
                ide_init_port_hw(hwif, hw);
+               hwif->mmio = 1;
                if (config)
                        hwif->config_data = config;
                idx[port_no] = hwif->index;
index 7bfb28edf5112bfbb738d79ff40375bb220020cf..6efbf947c6dbb3ab833a2a0b9ba9aa66251c3a55 100644 (file)
@@ -49,6 +49,8 @@
 
 #include <asm/io.h>
 
+#define DRV_NAME "ali14xx"
+
 /* port addresses for auto-detection */
 #define ALI_NUM_PORTS 4
 static const int ports[ALI_NUM_PORTS] __initdata =
@@ -197,6 +199,7 @@ static const struct ide_port_ops ali14xx_port_ops = {
 };
 
 static const struct ide_port_info ali14xx_port_info = {
+       .name                   = DRV_NAME,
        .chipset                = ide_ali14xx,
        .port_ops               = &ali14xx_port_ops,
        .host_flags             = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
index 7b5585c1c4c068132fa633b6bf46c3f23cbdeeed..f7c4ad1c57c0934652bd01c4b7a94ccf90b07648 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <asm/io.h>
 
+#define DRV_NAME "dtc2278"
+
 /*
  * Changing this #undef to #define may solve start up problems in some systems.
  */
@@ -91,6 +93,7 @@ static const struct ide_port_ops dtc2278_port_ops = {
 };
 
 static const struct ide_port_info dtc2278_port_info __initdata = {
+       .name                   = DRV_NAME,
        .chipset                = ide_dtc2278,
        .port_ops               = &dtc2278_port_ops,
        .host_flags             = IDE_HFLAG_SERIALIZE |
index 558964fc994e9cb0814064c073687d15cd1af42f..971960ee7c036eb7236d218e6c4fa52acd18c874 100644 (file)
@@ -335,6 +335,7 @@ static const struct ide_port_ops ht6560b_port_ops = {
 };
 
 static const struct ide_port_info ht6560b_port_info __initdata = {
+       .name                   = DRV_NAME,
        .chipset                = ide_ht6560b,
        .port_ops               = &ht6560b_port_ops,
        .host_flags             = IDE_HFLAG_SERIALIZE | /* is this needed? */
index 336ef20407f456a82017ec9a0c8e3451f712b304..15a99aae0cf9dc38c16af54bb2b98b092186fe43 100644 (file)
@@ -37,6 +37,8 @@
 #include <asm/system.h>
 #include <asm/io.h>
 
+#define DRV_NAME "qd65xx"
+
 #include "qd65xx.h"
 
 /*
@@ -317,6 +319,7 @@ static const struct ide_port_ops qd6580_port_ops = {
 };
 
 static const struct ide_port_info qd65xx_port_info __initdata = {
+       .name                   = DRV_NAME,
        .chipset                = ide_qd65xx,
        .host_flags             = IDE_HFLAG_IO_32BIT |
                                  IDE_HFLAG_NO_DMA |
index 95c643a2228a180a3e9706de621b00520045fa0a..17d515329fe018e10e7b291bf04090a16252679f 100644 (file)
@@ -51,6 +51,8 @@
 
 #include <asm/io.h>
 
+#define DRV_NAME "umc8672"
+
 /*
  * Default speeds.  These can be changed with "auto-tune" and/or hdparm.
  */
@@ -125,6 +127,7 @@ static const struct ide_port_ops umc8672_port_ops = {
 };
 
 static const struct ide_port_info umc8672_port_info __initdata = {
+       .name                   = DRV_NAME,
        .chipset                = ide_umc8672,
        .port_ops               = &umc8672_port_ops,
        .host_flags             = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,