Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / pcmcia / i82092.c
index eb25523..d5f03a3 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/init.h>
@@ -42,7 +41,7 @@ static struct pci_device_id i82092aa_pci_ids[] = {
 };
 MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
 
-static int i82092aa_socket_suspend (struct pci_dev *dev, u32 state)
+static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
 {
        return pcmcia_socket_dev_suspend(&dev->dev, state);
 }
@@ -65,9 +64,7 @@ static struct pci_driver i82092aa_pci_drv = {
 /* the pccard structure and its functions */
 static struct pccard_operations i82092aa_operations = {
        .init                   = i82092aa_init,
-       .suspend                = i82092aa_suspend,
        .get_status             = i82092aa_get_status,
-       .get_socket             = i82092aa_get_socket,
        .set_socket             = i82092aa_set_socket,
        .set_io_map             = i82092aa_set_io_map,
        .set_mem_map            = i82092aa_set_mem_map,
@@ -81,7 +78,7 @@ struct socket_info {
                                    1 = empty socket, 
                                    2 = card but not initialized,
                                    3 = operational card */
-       int     io_base;        /* base io address of the socket */
+       kio_addr_t io_base;     /* base io address of the socket */
        
        struct pcmcia_socket socket;
        struct pci_dev *dev;    /* The PCI device for the socket */
@@ -122,7 +119,7 @@ static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_de
        }
        printk(KERN_INFO "i82092aa: configured as a %d socket device.\n", socket_count);
 
-       if (request_region(pci_resource_start(dev, 0), 2, "i82092aa")) {
+       if (!request_region(pci_resource_start(dev, 0), 2, "i82092aa")) {
                ret = -EBUSY;
                goto err_out_disable;
        }
@@ -162,6 +159,7 @@ static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_de
        for (i = 0; i<socket_count; i++) {
                sockets[i].socket.dev.dev = &dev->dev;
                sockets[i].socket.ops = &i82092aa_operations;
+               sockets[i].socket.resource_ops = &pccard_nonstatic_ops;
                ret = pcmcia_register_socket(&sockets[i].socket);
                if (ret) {
                        goto err_out_free_sockets;
@@ -199,7 +197,7 @@ static void __devexit i82092aa_pci_remove(struct pci_dev *dev)
        leave("i82092aa_pci_remove");
 }
 
-static spinlock_t port_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(port_lock);
 
 /* basic value read/write functions */
 
@@ -439,15 +437,6 @@ static int i82092aa_init(struct pcmcia_socket *sock)
        return 0;
 }
                                                                                                                                                                                                                                               
-static int i82092aa_suspend(struct pcmcia_socket *sock)
-{
-       int retval;
-       enter("i82092aa_suspend");
-        retval =  i82092aa_set_socket(sock, &dead_socket);
-        leave("i82092aa_suspend");
-        return retval;
-}
-       
 static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 {
        unsigned int sock = container_of(socket, struct socket_info, socket)->number;
@@ -491,78 +480,6 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 }
 
 
-static int i82092aa_get_socket(struct pcmcia_socket *socket, socket_state_t *state) 
-{
-       unsigned int sock = container_of(socket, struct socket_info, socket)->number;
-       unsigned char reg,vcc,vpp;
-       
-       enter("i82092aa_get_socket");
-       state->flags    = 0;
-       state->Vcc      = 0;
-       state->Vpp      = 0;
-       state->io_irq   = 0;
-       state->csc_mask = 0;
-
-       /* First the power status of the socket */
-       reg = indirect_read(sock,I365_POWER); /* PCTRL - Power Control Register */
-
-       if (reg & I365_PWR_AUTO)
-               state->flags |= SS_PWR_AUTO;  /* Automatic Power Switch */
-               
-       if (reg & I365_PWR_OUT)
-               state->flags |= SS_OUTPUT_ENA; /* Output signals are enabled */
-               
-       vcc = reg & I365_VCC_MASK;    vpp = reg & I365_VPP1_MASK;
-       
-       if (reg & I365_VCC_5V) { /* Can still be 3.3V, in this case the Vcc value will be overwritten later */
-               state->Vcc = 50;
-               
-               if (vpp == I365_VPP1_5V)
-                       state->Vpp = 50;
-               if (vpp == I365_VPP1_12V)
-                       state->Vpp = 120;
-                       
-       }
-       
-       if ((reg & I365_VCC_3V)==I365_VCC_3V)
-               state->Vcc = 33;
-       
-       
-       /* Now the IO card, RESET flags and IO interrupt */
-       
-       reg = indirect_read(sock, I365_INTCTL); /* IGENC, Interrupt and General Control */
-       
-       if ((reg & I365_PC_RESET)==0)
-               state->flags |= SS_RESET;
-       if (reg & I365_PC_IOCARD) 
-               state->flags |= SS_IOCARD; /* This is an IO card */
-       
-       /* Set the IRQ number */
-       if (sockets[sock].dev!=NULL)
-               state->io_irq = sockets[sock].dev->irq;
-       
-       /* Card status change */
-       reg = indirect_read(sock, I365_CSCINT); /* CSCICR, Card Status Change Interrupt Configuration */
-       
-       if (reg & I365_CSC_DETECT) 
-               state->csc_mask |= SS_DETECT; /* Card detect is enabled */
-       
-       if (state->flags & SS_IOCARD) {/* IO Cards behave different */
-               if (reg & I365_CSC_STSCHG)
-                       state->csc_mask |= SS_STSCHG;
-       } else {
-               if (reg & I365_CSC_BVD1) 
-                       state->csc_mask |= SS_BATDEAD;
-               if (reg & I365_CSC_BVD2) 
-                       state->csc_mask |= SS_BATWARN;
-               if (reg & I365_CSC_READY) 
-                       state->csc_mask |= SS_READY;
-       }
-               
-       leave("i82092aa_get_socket");
-       return 0;
-}
-
 static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state) 
 {
        unsigned int sock = container_of(socket, struct socket_info, socket)->number;