]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
pcmcia: pcmcia_config_loop() ConfigIndex unification
authorDominik Brodowski <linux@dominikbrodowski.net>
Sat, 2 Aug 2008 12:59:13 +0000 (14:59 +0200)
committerDominik Brodowski <linux@dominikbrodowski.net>
Fri, 22 Aug 2008 23:21:29 +0000 (01:21 +0200)
Almost all drivers set p_dev->conf.ConfigIndex to cfg->index in
the pcmcia_config_loop() callback function. Therefore, factor it out.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
29 files changed:
drivers/ata/pata_pcmcia.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btuart_cs.c
drivers/bluetooth/dtl1_cs.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/pcmcia/cm4040_cs.c
drivers/isdn/hardware/avm/avm_cs.c
drivers/isdn/hisax/avma1_cs.c
drivers/isdn/hisax/elsa_cs.c
drivers/isdn/hisax/sedlbauer_cs.c
drivers/isdn/hisax/teles_cs.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/wireless/airo_cs.c
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/hostap/hostap_cs.c
drivers/net/wireless/orinoco_cs.c
drivers/net/wireless/spectrum_cs.c
drivers/parport/parport_cs.c
drivers/pcmcia/pcmcia_resource.c
drivers/scsi/pcmcia/aha152x_stub.c
drivers/scsi/pcmcia/fdomain_stub.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/scsi/pcmcia/qlogic_stub.c
drivers/scsi/pcmcia/sym53c500_cs.c
drivers/serial/serial_cs.c
drivers/telephony/ixj_pcmcia.c
drivers/usb/host/sl811_cs.c

index 8cccd1b81ee24b533a0f18d490c70b86cf865a85..4b8bd2021a9cc6f9889737d969748f60756384f4 100644 (file)
@@ -181,7 +181,6 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
 
        if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io;
-               pdev->conf.ConfigIndex = cfg->index;
                pdev->io.BasePort1 = io->win[0].base;
                pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
                if (!(io->flags & CISTPL_IO_16BIT))
index 6ec366f1cf748f858c134d432755666db269c52a..3436be152485bf52cee2d3974cd364f234f7d73f 100644 (file)
@@ -688,7 +688,6 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
                p_dev->conf.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->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.IOAddrLines = (try == 0) ? 16 :
                        cf->io.flags & CISTPL_IO_LINES_MASK;
@@ -706,7 +705,6 @@ static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
        int j;
 
        if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
-               p_dev->conf.ConfigIndex = cf->index;
                for (j = 0; j < 5; j++) {
                        p_dev->io.BasePort1 = base[j];
                        p_dev->io.IOAddrLines = base[j] ? 16 : 3;
index 39cca285152d78d8333cc6a4ead583fe641c54f2..5e31ea2f2d6f37d88d60ae84176020f1eabc7ea2 100644 (file)
@@ -617,7 +617,6 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
                p_dev->conf.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->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.IOAddrLines = (try == 0) ? 16 :
                        cf->io.flags & CISTPL_IO_LINES_MASK;
@@ -635,7 +634,6 @@ static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
        int j;
 
        if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
-               p_dev->conf.ConfigIndex = cf->index;
                for (j = 0; j < 5; j++) {
                        p_dev->io.BasePort1 = base[j];
                        p_dev->io.IOAddrLines = base[j] ? 16 : 3;
index e30a6332c6c65974aec6e20c68d62daefe66c265..1846e2aa9d4a0423e355faa30f5cb6b676d28a9b 100644 (file)
@@ -595,7 +595,6 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev,
                          void *priv_data)
 {
        if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.NumPorts1 = cf->io.win[0].len;        /*yo */
                p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
index 47adec480bd19e3f9cdd69f509376707caf59ec5..7eafd2f4dbb9cc120d03f49d228522260c6f1fda 100644 (file)
@@ -1763,8 +1763,6 @@ static int cm4000_config_check(struct pcmcia_device *p_dev,
                               cistpl_cftable_entry_t *cfg,
                               void *priv_data)
 {
-       p_dev->conf.ConfigIndex = cfg->index;
-
        if (!cfg->io.nwin)
                return -ENODEV;
 
index e0f5d8c9b266a189eda3bbf0af41a949bc5e1ec3..71ca8c474c8923e485f4b90ba6b62fcd91bea38d 100644 (file)
@@ -531,8 +531,6 @@ static int cm4040_config_check(struct pcmcia_device *p_dev,
                               void *priv_data)
 {
        int rc;
-       p_dev->conf.ConfigIndex = cfg->index;
-
        if (!cfg->io.nwin)
                return -ENODEV;
 
index 7a1ead117d11653093fc77b2503b11ed9e35ee0f..3569c68dc9425c64dbc6fa685f99abbe0de7513a 100644 (file)
@@ -161,7 +161,6 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
        if (cf->io.nwin <= 0)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = cf->index;
        p_dev->io.BasePort1 = cf->io.win[0].base;
        p_dev->io.NumPorts1 = cf->io.win[0].len;
        p_dev->io.NumPorts2 = 0;
index 8142d9fc8147d1ba7127a124983d52d3463ff911..76164d6a3c890177f763b3fec398d75f73afcf7a 100644 (file)
@@ -181,7 +181,6 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev,
        if (cf->io.nwin <= 0)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = cf->index;
        p_dev->io.BasePort1 = cf->io.win[0].base;
        p_dev->io.NumPorts1 = cf->io.win[0].len;
        p_dev->io.NumPorts2 = 0;
index 449800898dcf6bdc69e981910404c5aa864de4a1..c9899e51a262d319acbe19a2d7901c1f9e6fc12d 100644 (file)
@@ -212,13 +212,11 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
 
        if ((cf->io.nwin > 0) && cf->io.win[0].base) {
                printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                if (!pcmcia_request_io(p_dev, &p_dev->io))
                        return 0;
        } else {
                printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n");
-               p_dev->conf.ConfigIndex = cf->index;
                for (j = 0x2f0; j > 0x100; j -= 0x10) {
                        p_dev->io.BasePort1 = j;
                        if (!pcmcia_request_io(p_dev, &p_dev->io))
index 0f80b5667ea166340eff976ccb03c6a71a6bad27..2c611f91cfbae85a1e5efc53df4b417f4a63e5b8 100644 (file)
@@ -233,7 +233,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
                cfg_mem->dflt = *cfg;
        if (cfg->index == 0)
                return -ENODEV;
-       p_dev->conf.ConfigIndex = cfg->index;
 
        /* Does this card need audio output? */
        if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
index 2b063a2916f41f72b9b4d148e16c84730f0b7693..ecb75ae8a399af0c1d4479f6719b3fa6d2f06504 100644 (file)
@@ -202,13 +202,11 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev,
 
        if ((cf->io.nwin > 0) && cf->io.win[0].base) {
                printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                if (!pcmcia_request_io(p_dev, &p_dev->io))
                        return 0;
        } else {
                printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
-               p_dev->conf.ConfigIndex = cf->index;
                for (j = 0x2f0; j > 0x100; j -= 0x10) {
                        p_dev->io.BasePort1 = j;
                        if (!pcmcia_request_io(p_dev, &p_dev->io))
index 7a9eeca6adc2299fb3d5b7c0fc3eeb22fe2ccb31..a6060872249565ba9ba806ee3dda6e48b9ff66e6 100644 (file)
@@ -523,8 +523,6 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
        if (cfg->index == 0 || cfg->io.nwin == 0)
                return -EINVAL;
 
-       p_dev->conf.ConfigIndex = cfg->index;
-
        /* For multifunction cards, by convention, we configure the
           network function with window 0, and serial with window 1 */
        if (io->nwin > 1) {
index c012e3400736f8c3738c2ea4ab7749d342c28acf..1e595038a49218dd11c49e8177dff6ab5f891fe5 100644 (file)
@@ -464,7 +464,6 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
                                void *priv_data)
 {
        int k;
-       p_dev->conf.ConfigIndex = cf->index;
        p_dev->io.BasePort2 = cf->io.win[0].base;
        for (k = 0; k < 0x400; k += 0x10) {
                if (k & 0x80)
@@ -654,7 +653,6 @@ static int smc_configcheck(struct pcmcia_device *p_dev,
                           cistpl_cftable_entry_t *cf,
                           void *priv_data)
 {
-       p_dev->conf.ConfigIndex = cf->index;
        p_dev->io.BasePort1 = cf->io.win[0].base;
        p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
        return pcmcia_request_io(p_dev, &p_dev->io);
index b57f022952b4700cc40a79122197041bb6847b7f..b0de704f229c343cd207f0eaf76ba61515f0a79c 100644 (file)
@@ -724,7 +724,6 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev,
 
        if (cf->io.nwin > 0  &&  (cf->io.win[0].base & 0xf) == 8) {
                for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
-                       p_dev->conf.ConfigIndex = cf->index ;
                        p_dev->io.BasePort2 = cf->io.win[0].base;
                        p_dev->io.BasePort1 = ioaddr;
                        if (!pcmcia_request_io(p_dev, &p_dev->io))
@@ -742,7 +741,6 @@ xirc2ps_config_check(struct pcmcia_device *p_dev,
        int *pass = priv_data;
 
        if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
-               p_dev->conf.ConfigIndex = cf->index ;
                p_dev->io.BasePort2 = cf->io.win[0].base;
                p_dev->io.BasePort1 = p_dev->io.BasePort2
                        + (*pass ? (cf->index & 0x20 ? -24:8)
index 4fbe811bebfc2537f5a2b63b7b343a4f2812afda..d7216730f18ed1837e07910e7dbe5786bb72b642 100644 (file)
@@ -223,8 +223,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
        if (cfg->index == 0)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = cfg->index;
-
        /* Does this card need audio output? */
        if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
index 263c36f7ee222378f328ff86277a5c0180c2627b..12efd44d64a1e0cc80d74086a80423aba6ca7643 100644 (file)
@@ -234,8 +234,6 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
                *dflt = *cfg;
        if (cfg->index == 0)
                return -ENODEV;
-       p_dev->conf.ConfigIndex = cfg->index;
-
        /* Does this card need audio output? */
        if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
index 3d914dde5de052dfb0ee6b8c9b33c07c9599afb1..2abaa90b799d7b14df74fd50c757578aa3d0f8d5 100644 (file)
@@ -552,7 +552,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
        if (cfg->index == 0)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = cfg->index;
        PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
               "(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index);
 
index 473370c9e0d6424953b0a7239a8967292674d817..67a172dfb2db4840b9fe28b25cd675d309b66f17 100644 (file)
@@ -179,7 +179,6 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
                cfg_mem->dflt = *cfg;
        if (cfg->index == 0)
                goto next_entry;
-       p_dev->conf.ConfigIndex = cfg->index;
 
        /* Use power settings for Vcc and Vpp if present */
        /* Note that the CIS values need to be rescaled */
index 8e1951cfc15219e184af0cd170c3489c84766cc5..7536aa91dad781d4a6e6e139653e1f09d6610f74 100644 (file)
@@ -648,7 +648,6 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
                cfg_mem->dflt = *cfg;
        if (cfg->index == 0)
                goto next_entry;
-       p_dev->conf.ConfigIndex = cfg->index;
 
        /* Use power settings for Vcc and Vpp if present */
        /* Note that the CIS values need to be rescaled */
index 636231739f4b137ff8695c782fb148ef97ad85b7..814c5252d7033d713e605753f7da503e2cee5cf6 100644 (file)
@@ -156,7 +156,6 @@ static int parport_config_check(struct pcmcia_device *p_dev,
        cistpl_cftable_entry_t *dflt = priv_data;
        if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
-               p_dev->conf.ConfigIndex = cfg->index;
                if (epp_mode)
                        p_dev->conf.ConfigIndex |= FORCE_EPP_MODE;
                p_dev->io.BasePort1 = io->win[0].base;
index 9f054bc847f2b12e5af336ed9d6384fded7c30b8..ba34ac8876fff3c2152fd29ff6e0ce6b5718a07a 100644 (file)
@@ -953,14 +953,18 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
 
        ret = pcmcia_get_first_tuple(p_dev, tuple);
        while (!ret) {
+               cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry;
+
                if (pcmcia_get_tuple_data(p_dev, tuple))
                        goto next_entry;
 
                if (pcmcia_parse_tuple(p_dev, tuple, &cfg_mem->parse))
                        goto next_entry;
 
-               ret = conf_check(p_dev, &cfg_mem->parse.cftable_entry,
-                                priv_data);
+               /* default values */
+               p_dev->conf.ConfigIndex = cfg->index;
+
+               ret = conf_check(p_dev, cfg, priv_data);
                if (!ret)
                        break;
 
index bbcc20f2d9d0e5f9609406c649abe843034510b6..5e4d8e42ba0b787ff7e2ff9b722b5135c9389d0a 100644 (file)
@@ -152,7 +152,6 @@ static int aha152x_config_check(struct pcmcia_device *p_dev,
                p_dev->io.BasePort1 = cfg->io.win[1].base;
        if ((cfg->io.nwin > 0) &&
            (p_dev->io.BasePort1 < 0xffff)) {
-               p_dev->conf.ConfigIndex = cfg->index;
                if (!pcmcia_request_io(p_dev, &p_dev->io))
                        return 0;
        }
index fefef7d81f1471d689d64579bcc0c6b1e4be8ca4..e3d6937c9200c5a785c2845d1d05fe0d7c434b7d 100644 (file)
@@ -127,7 +127,6 @@ static int fdomain_config_check(struct pcmcia_device *p_dev,
                                  cistpl_cftable_entry_t *cfg,
                                  void *priv_data)
 {
-       p_dev->conf.ConfigIndex = cfg->index;
        p_dev->io.BasePort1 = cfg->io.win[0].base;
        return pcmcia_request_io(p_dev, &p_dev->io);
 }
index a29a6f29c977d0b4f7a64a83044a8bafe1c93a4b..aee24b745dc993f0f14ed083b5ac92d12a8ccd50 100644 (file)
@@ -1626,8 +1626,6 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
        if (cfg->index == 0)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = cfg->index;
-
        /* Does this card need audio output? */
        if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
index aa9b9e0968b6d99158c925f2669f1af898b95893..a361275b20a37d364b5ad48f20129fa6cb83bdf1 100644 (file)
@@ -199,7 +199,6 @@ static int qlogic_config_check(struct pcmcia_device *p_dev,
                                  cistpl_cftable_entry_t *cfg,
                                  void *priv_data)
 {
-       p_dev->conf.ConfigIndex = cfg->index;
        p_dev->io.BasePort1 = cfg->io.win[0].base;
        p_dev->io.NumPorts1 = cfg->io.win[0].len;
 
index 15369d9e31215af8bedb98d40189d9ac07945905..23a5219051a9dfc700b940e4c8fde99dd738cad8 100644 (file)
@@ -704,7 +704,6 @@ static int SYM53C500_config_check(struct pcmcia_device *p_dev,
                                  cistpl_cftable_entry_t *cfg,
                                  void *priv_data)
 {
-       p_dev->conf.ConfigIndex = cfg->index;
        p_dev->io.BasePort1 = cfg->io.win[0].base;
        p_dev->io.NumPorts1 = cfg->io.win[0].len;
 
index ac60cd288418cf6a0ca68a1f74fe7652bb2398ee..6937381600103e0e8dfaf061484e64fe2e81d7a4 100644 (file)
@@ -454,7 +454,6 @@ static int simple_config_check(struct pcmcia_device *p_dev,
 
        if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)])
            && (cf->io.win[0].base != 0)) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ?
                        16 : cf->io.flags & CISTPL_IO_LINES_MASK;
@@ -472,7 +471,6 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
        int j;
 
        if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
-               p_dev->conf.ConfigIndex = cf->index;
                for (j = 0; j < 5; j++) {
                        p_dev->io.BasePort1 = base[j];
                        p_dev->io.IOAddrLines = base[j] ? 16 : 3;
@@ -555,7 +553,6 @@ static int multi_config_check(struct pcmcia_device *p_dev,
        /* The quad port cards have bad CIS's, so just look for a
           window larger than 8 ports and assume it will be right */
        if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
                if (!pcmcia_request_io(p_dev, &p_dev->io)) {
@@ -573,7 +570,6 @@ static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
        int *base2 = priv_data;
 
        if (cf->io.nwin == 2) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.BasePort2 = cf->io.win[1].base;
                p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
index 89c5e40ce3a009ca5586c0422dcc7dd0998bb7b8..ba2c7a2125a06461d82478dfaf8a6315e6f173f3 100644 (file)
@@ -132,7 +132,6 @@ static int ixj_config_check(struct pcmcia_device *p_dev,
 
        if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
-               p_dev->conf.ConfigIndex = cfg->index;
                p_dev->io.BasePort1 = io->win[0].base;
                p_dev->io.NumPorts1 = io->win[0].len;
                if (io->nwin == 2) {
index 9773601bf0bbfc49e04cef4b04efd7a159cdfc1a..5b55c72c710b7c9413b65e260f3accded4c170f0 100644 (file)
@@ -172,8 +172,6 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
        if (cfg->index == 0)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = cfg->index;
-
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
        if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {