]> err.no Git - linux-2.6/blobdiff - drivers/pcmcia/i82365.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6
[linux-2.6] / drivers / pcmcia / i82365.c
index 90a335a5d9fafe90aabdb0d833508c00440c3ab5..4ddd76239b34aff80f4783f9e2557baa51038326 100644 (file)
 #include <linux/delay.h>
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/bitops.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <asm/system.h>
 
-#include <pcmcia/version.h>
 #include <pcmcia/cs_types.h>
 #include <pcmcia/ss.h>
 #include <pcmcia/cs.h>
@@ -669,11 +668,13 @@ static int __init is_alive(u_short sock)
     if ((stat & I365_CS_DETECT) && (stat & I365_CS_POWERON) &&
        (i365_get(sock, I365_INTCTL) & I365_PC_IOCARD) &&
        (i365_get(sock, I365_ADDRWIN) & I365_ENA_IO(0)) &&
-       (check_region(start, stop-start+1) != 0) &&
-       ((start & 0xfeef) != 0x02e8))
-       return 1;
-    else
-       return 0;
+       ((start & 0xfeef) != 0x02e8)) {
+       if (!request_region(start, stop-start+1, "i82365"))
+           return 1;
+       release_region(start, stop-start+1);
+    }
+
+    return 0;
 }
 
 /*====================================================================*/
@@ -696,8 +697,6 @@ static void __init add_pcic(int ns, int type)
     struct i82365_socket *t = &socket[sockets-ns];
 
     base = sockets-ns;
-    if (t->ioaddr > 0) request_region(t->ioaddr, 2, "i82365");
-    
     if (base == 0) printk("\n");
     printk(KERN_INFO "  %s", pcic[type].name);
     printk(" ISA-to-PCMCIA at port %#lx ofs 0x%02x",
@@ -803,7 +802,7 @@ static void __init isa_probe(void)
     }
 #endif
 
-    if (check_region(i365_base, 2) != 0) {
+    if (!request_region(i365_base, 2, "i82365")) {
        if (sockets == 0)
            printk("port conflict at %#lx\n", i365_base);
        return;
@@ -1333,27 +1332,11 @@ static struct pccard_operations pcic_operations = {
 
 /*====================================================================*/
 
-static int i82365_suspend(struct device *dev, pm_message_t state, u32 level)
-{
-       int ret = 0;
-       if (level == SUSPEND_SAVE_STATE)
-               ret = pcmcia_socket_dev_suspend(dev, state);
-       return ret;
-}
-
-static int i82365_resume(struct device *dev, u32 level)
-{
-       int ret = 0;
-       if (level == RESUME_RESTORE_STATE)
-               ret = pcmcia_socket_dev_resume(dev);
-       return ret;
-}
-
 static struct device_driver i82365_driver = {
        .name = "i82365",
        .bus = &platform_bus_type,
-       .suspend = i82365_suspend,
-       .resume = i82365_resume,
+       .suspend = pcmcia_socket_dev_suspend,
+       .resume = pcmcia_socket_dev_resume,
 };
 
 static struct platform_device i82365_device = {
@@ -1383,6 +1366,7 @@ static int __init init_i82365(void)
     if (sockets == 0) {
        printk("not found.\n");
        platform_device_unregister(&i82365_device);
+       release_region(i365_base, 2);
        driver_unregister(&i82365_driver);
        return -ENODEV;
     }
@@ -1441,6 +1425,7 @@ static void __exit exit_i82365(void)
        i365_set(i, I365_CSCINT, 0);
        release_region(socket[i].ioaddr, 2);
     }
+    release_region(i365_base, 2);
 #ifdef CONFIG_PNP
     if (i82365_pnpdev)
                pnp_disable_dev(i82365_pnpdev);