]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide-generic: manage I/O resources in driver
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Apr 2008 20:25:17 +0000 (22:25 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Apr 2008 20:25:17 +0000 (22:25 +0200)
* 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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-generic.c

index 19f63e393d18766f0511f9f04ea178f0f57ab3c9..12de09aaef09a8ad9f008c419dc3e14500b09de6 100644 (file)
@@ -94,7 +94,24 @@ static int __init ide_generic_init(void)
                unsigned long io_addr = ide_default_io_base(i);
                hw_regs_t hw;
 
+               idx[i] = 0xff;
+
                if (io_addr) {
+                       if (!request_region(io_addr, 8, DRV_NAME)) {
+                               printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX "
+                                               "not free.\n",
+                                               DRV_NAME, io_addr, io_addr + 7);
+                               continue;
+                       }
+
+                       if (!request_region(io_addr + 0x206, 1, DRV_NAME)) {
+                               printk(KERN_ERR "%s: I/O resource 0x%lX "
+                                               "not free.\n",
+                                               DRV_NAME, io_addr + 0x206);
+                               release_region(io_addr, 8);
+                               continue;
+                       }
+
                        /*
                         * Skip probing if the corresponding
                         * slot is already occupied.
@@ -109,10 +126,10 @@ static int __init ide_generic_init(void)
                        ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
                        hw.irq = ide_default_irq(io_addr);
                        ide_init_port_hw(hwif, &hw);
+                       hwif->mmio = 1;
 
                        idx[i] = i;
-               } else
-                       idx[i] = 0xff;
+               }
        }
 
        ide_device_add_all(idx, NULL);