pcmcia: move Vpp setup to struct pcmcia_device
authorDominik Brodowski <linux@dominikbrodowski.net>
Thu, 29 Jul 2010 13:50:55 +0000 (15:50 +0200)
committerDominik Brodowski <linux@dominikbrodowski.net>
Wed, 29 Sep 2010 15:20:21 +0000 (17:20 +0200)
Some drivers prefer to explicitly set Vpp. Instead of passing the
voltage inside config_req_t, store it in struct pcmcia_device.

CC: linux-ide@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-mtd@lists.infradead.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
17 files changed:
drivers/ata/pata_pcmcia.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btuart_cs.c
drivers/ide/ide-cs.c
drivers/isdn/hisax/sedlbauer_cs.c
drivers/mtd/maps/pcmciamtd.c
drivers/net/wireless/airo_cs.c
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/hostap/hostap_cs.c
drivers/net/wireless/orinoco/orinoco_cs.c
drivers/net/wireless/orinoco/spectrum_cs.c
drivers/pcmcia/pcmcia_resource.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/serial/serial_cs.c
drivers/usb/host/sl811_cs.c
include/pcmcia/cs.h
include/pcmcia/ds.h

index e944aa0c5517caaed7fc3cb8f10639245e8a3e3f..12cdc9ff39ad9c45ea53f11ab15602d1a7f5aa69 100644 (file)
@@ -194,9 +194,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
        }
 
        if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
 
        if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
index 7ab8f29d5e0dcb8df750bab81fc0bcce4494b12e..2c8d981c110dc3a5fa8c3f23987da23446f2dfb7 100644 (file)
@@ -686,7 +686,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
        p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
 
        if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
            (cf->io.win[0].base != 0)) {
                p_dev->resource[0]->start = cf->io.win[0].base;
index 1c4f5e863b032d21d8a765a4d3b97c1ca1bb73e4..7ea6fa42fdef1e6709ca08988da44e0ba0459472 100644 (file)
@@ -615,7 +615,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
        p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
 
        if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
            (cf->io.win[0].base != 0)) {
                p_dev->resource[0]->start = cf->io.win[0].base;
index 2a4cb9c18f01706ce7a3c6b17126882321185612..82690e4094354f5b273425e5d1d7a00f69c20c7f 100644 (file)
@@ -221,9 +221,9 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
        }
 
        if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
 
        if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
@@ -311,7 +311,7 @@ static int ide_config(struct pcmcia_device *link)
     info->host = host;
     dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n",
            'a' + host->ports[0]->index * 2,
-           link->conf.Vpp / 10, link->conf.Vpp % 10);
+           link->vpp / 10, link->vpp % 10);
 
     kfree(stk);
     return 0;
index a024192b672a3113c0e6663fc1778c5abe4ac6f2..ad07d61dc09b5dfd097cee20b836d7d00870be3f 100644 (file)
@@ -191,9 +191,9 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
        }
 
        if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
        else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
 
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
 
@@ -257,8 +257,8 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
     /* Finally, report what we've done */
     dev_info(&link->dev, "index 0x%02x:",
           link->conf.ConfigIndex);
-    if (link->conf.Vpp)
-       printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
+    if (link->vpp)
+       printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
     if (link->conf.Attributes & CONF_ENABLE_IRQ)
        printk(", irq %d", link->irq);
     if (link->resource[0])
index 31ce404baa3cd231e63900ba9baf3568bf000fd6..ab94c8aebddcfd265595d856e254ab820edb79b0 100644 (file)
@@ -570,9 +570,9 @@ static int pcmciamtd_config(struct pcmcia_device *link)
        dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp;
        link->conf.Attributes = 0;
        if(setvpp == 2) {
-               link->conf.Vpp = dev->vpp;
+               link->vpp = dev->vpp;
        } else {
-               link->conf.Vpp = 0;
+               link->vpp = 0;
        }
 
        link->conf.IntType = INT_MEMORY;
index 9a121a5b787cb2468005e914e81a15eee55e312f..488e7b45d54b2145461ee9cbaa503741226180cc 100644 (file)
@@ -166,9 +166,9 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
        if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
        else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
 
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
 
@@ -244,8 +244,8 @@ static int airo_config(struct pcmcia_device *link)
        /* Finally, report what we've done */
        dev_info(&link->dev, "index 0x%02x: ",
               link->conf.ConfigIndex);
-       if (link->conf.Vpp)
-               printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
+       if (link->vpp)
+               printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
        printk(", irq %d", link->irq);
        if (link->resource[0])
                printk(" & %pR", link->resource[0]);
index 3b632161c10696ee7ae896db24c11d4886395486..479f5084bac13b783acd3e79b720a8c2c2b2387d 100644 (file)
@@ -183,9 +183,9 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
        if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
        else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
 
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
 
index ba54d1b04d22a7e50ae244bb2b905c84d44c1986..3f35dd4438ca6ddc1acd57303bdc3c5e992c5625 100644 (file)
@@ -508,9 +508,9 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
        }
 
        if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+               p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
 
        /* Do we need to allocate an interrupt? */
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
@@ -605,9 +605,9 @@ static int prism2_config(struct pcmcia_device *link)
        /* Finally, report what we've done */
        printk(KERN_INFO "%s: index 0x%02x: ",
               dev_info, link->conf.ConfigIndex);
-       if (link->conf.Vpp)
-               printk(", Vpp %d.%d", link->conf.Vpp / 10,
-                      link->conf.Vpp % 10);
+       if (link->vpp)
+               printk(", Vpp %d.%d", link->vpp / 10,
+                      link->vpp % 10);
        if (link->conf.Attributes & CONF_ENABLE_IRQ)
                printk(", irq %d", link->irq);
        if (link->resource[0])
index ef46a2d885392f49f1803fbb47bb2f6a6b2f7fdc..f7e3fa6305b48176144a2c5a6abb9839ab86fc9a 100644 (file)
@@ -181,10 +181,10 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
        }
 
        if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
 
        /* Do we need to allocate an interrupt? */
index 873877e17e1bf6bce4debd49b75f359a8d39b1ec..1bbad101b559f3039e1b25a77743527ce0e79cfe 100644 (file)
@@ -243,10 +243,10 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
        }
 
        if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
        else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
 
        /* Do we need to allocate an interrupt? */
index 14b1a951e1b65dc971c22bc129858f8279a45354..817d00adfc89731c41e0b4a2180794ce831ab626 100644 (file)
@@ -303,6 +303,7 @@ int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp)
                ret = -EIO;
                goto unlock;
        }
+       p_dev->vpp = new_vpp;
 
 unlock:
        mutex_unlock(&s->ops_mutex);
@@ -458,7 +459,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
        }
 
        /* Do power control.  We don't allow changes in Vcc. */
-       s->socket.Vpp = req->Vpp;
+       s->socket.Vpp = p_dev->vpp;
        if (s->ops->set_socket(s, &s->socket)) {
                mutex_unlock(&s->ops_mutex);
                dev_printk(KERN_WARNING, &p_dev->dev,
index e872e0684273b95c62252e1c5ab6fc2e784e4a76..50574e86941832bc1a9387d06907a9dca47c0397 100644 (file)
@@ -1624,10 +1624,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
                }
 
                if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
-                       p_dev->conf.Vpp =
+                       p_dev->vpp =
                                cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
                } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
-                       p_dev->conf.Vpp =
+                       p_dev->vpp =
                                dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
                }
 
@@ -1749,8 +1749,8 @@ static int nsp_cs_config(struct pcmcia_device *link)
        /* Finally, report what we've done */
        printk(KERN_INFO "nsp_cs: index 0x%02x: ",
               link->conf.ConfigIndex);
-       if (link->conf.Vpp) {
-               printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
+       if (link->vpp) {
+               printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
        }
        if (link->conf.Attributes & CONF_ENABLE_IRQ) {
                printk(", irq %d", link->irq);
index 7d475b2a79e8bb7fee0cd8f1f048fc61d1b7db3c..9597442a0ac1e5059fe3982f62afe1c1299b5633 100644 (file)
@@ -440,7 +440,7 @@ static int simple_config_check(struct pcmcia_device *p_dev,
        int *try = priv_data;
 
        if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
 
        p_dev->io_lines = ((*try & 0x1) == 0) ?
index 0e13a00eb2ed51ea38126fa954a5e3a4723d87c0..8e8475298baae9a2bf6eab6dcb57b95c4f8cf70a 100644 (file)
@@ -152,10 +152,10 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
                }
 
        if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
        else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
-               p_dev->conf.Vpp =
+               p_dev->vpp =
                        dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
 
        /* we need an interrupt */
@@ -201,8 +201,8 @@ static int sl811_cs_config(struct pcmcia_device *link)
 
        dev_info(&link->dev, "index 0x%02x: ",
                link->conf.ConfigIndex);
-       if (link->conf.Vpp)
-               printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
+       if (link->vpp)
+               printk(", Vpp %d.%d", link->vpp/10, link->vpp%10);
        printk(", irq %d", link->irq);
        printk(", io %pR", link->resource[0]);
        printk("\n");
index e13d0cd3f8f7a73a078e61ced90a89423be62b53..ccb8e6e0dd6b6cd0621f5f5717d197caf22e0d38 100644 (file)
@@ -22,7 +22,6 @@
 /* For RequestConfiguration */
 typedef struct config_req_t {
     u_int      Attributes;
-    u_int      Vpp; /* both Vpp1 and Vpp2 */
     u_int      IntType;
     u_int      ConfigBase;
     u_char     Status, Pin, Copy, ExtStatus;
index 8e307b93f47b31b1dcb14911ab3e9c7701fa60f9..6137fbc34abd2090cf27c9b8c0283a69b25eb4a5 100644 (file)
@@ -94,6 +94,7 @@ struct pcmcia_device {
        /* device setup */
        unsigned int            irq;
        struct resource         *resource[PCMCIA_NUM_RESOURCES];
+       unsigned int            vpp;
 
        unsigned int            io_lines; /* number of I/O lines */