diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-02 10:12:00 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-22 19:22:52 -0400 |
commit | ad913c11928f51abb6174f165db8d8d205b22e21 (patch) | |
tree | a8542c846afb4950a12f46b16c1eacfa2280971a | |
parent | 8e2fc39ddea7fe8c6798837da282db88a09af793 (diff) |
pcmcia: pcmcia_config_loop() improvement by passing vcc
By passing the current Vcc setting to the pcmcia_config_loop callback
function, we can remove pcmcia_get_configuration_info() calls from many
drivers.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
32 files changed, 93 insertions, 142 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 20982065a494..6e4d31d8d14e 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -150,7 +150,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
150 | 150 | ||
151 | 151 | ||
152 | struct pcmcia_config_check { | 152 | struct pcmcia_config_check { |
153 | config_info_t conf; | ||
154 | unsigned long ctl_base; | 153 | unsigned long ctl_base; |
155 | int skip_vcc; | 154 | int skip_vcc; |
156 | int is_kme; | 155 | int is_kme; |
@@ -159,6 +158,7 @@ struct pcmcia_config_check { | |||
159 | static int pcmcia_check_one_config(struct pcmcia_device *pdev, | 158 | static int pcmcia_check_one_config(struct pcmcia_device *pdev, |
160 | cistpl_cftable_entry_t *cfg, | 159 | cistpl_cftable_entry_t *cfg, |
161 | cistpl_cftable_entry_t *dflt, | 160 | cistpl_cftable_entry_t *dflt, |
161 | unsigned int vcc, | ||
162 | void *priv_data) | 162 | void *priv_data) |
163 | { | 163 | { |
164 | struct pcmcia_config_check *stk = priv_data; | 164 | struct pcmcia_config_check *stk = priv_data; |
@@ -166,12 +166,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, | |||
166 | /* Check for matching Vcc, unless we're desperate */ | 166 | /* Check for matching Vcc, unless we're desperate */ |
167 | if (!stk->skip_vcc) { | 167 | if (!stk->skip_vcc) { |
168 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 168 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
169 | if (stk->conf.Vcc != | 169 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) |
170 | cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) | ||
171 | return -ENODEV; | 170 | return -ENODEV; |
172 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 171 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
173 | if (stk->conf.Vcc != | 172 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) |
174 | dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) | ||
175 | return -ENODEV; | 173 | return -ENODEV; |
176 | } | 174 | } |
177 | } | 175 | } |
@@ -257,10 +255,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
257 | if (!stk) | 255 | if (!stk) |
258 | goto out1; | 256 | goto out1; |
259 | stk->is_kme = is_kme; | 257 | stk->is_kme = is_kme; |
260 | |||
261 | /* Not sure if this is right... look up the current Vcc */ | ||
262 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); | ||
263 | stk->skip_vcc = io_base = ctl_base = 0; | 258 | stk->skip_vcc = io_base = ctl_base = 0; |
259 | |||
264 | if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { | 260 | if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { |
265 | stk->skip_vcc = 1; | 261 | stk->skip_vcc = 1; |
266 | if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) | 262 | if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 794a5ef9ea22..3fd8022a6351 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -681,6 +681,7 @@ static void bt3c_detach(struct pcmcia_device *link) | |||
681 | static int bt3c_check_config(struct pcmcia_device *p_dev, | 681 | static int bt3c_check_config(struct pcmcia_device *p_dev, |
682 | cistpl_cftable_entry_t *cf, | 682 | cistpl_cftable_entry_t *cf, |
683 | cistpl_cftable_entry_t *dflt, | 683 | cistpl_cftable_entry_t *dflt, |
684 | unsigned int vcc, | ||
684 | void *priv_data) | 685 | void *priv_data) |
685 | { | 686 | { |
686 | unsigned long try = (unsigned long) priv_data; | 687 | unsigned long try = (unsigned long) priv_data; |
@@ -701,6 +702,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, | |||
701 | static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, | 702 | static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, |
702 | cistpl_cftable_entry_t *cf, | 703 | cistpl_cftable_entry_t *cf, |
703 | cistpl_cftable_entry_t *dflt, | 704 | cistpl_cftable_entry_t *dflt, |
705 | unsigned int vcc, | ||
704 | void *priv_data) | 706 | void *priv_data) |
705 | { | 707 | { |
706 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 708 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 32017f96067c..17183125434f 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -610,16 +610,17 @@ static void btuart_detach(struct pcmcia_device *link) | |||
610 | static int btuart_check_config(struct pcmcia_device *p_dev, | 610 | static int btuart_check_config(struct pcmcia_device *p_dev, |
611 | cistpl_cftable_entry_t *cf, | 611 | cistpl_cftable_entry_t *cf, |
612 | cistpl_cftable_entry_t *dflt, | 612 | cistpl_cftable_entry_t *dflt, |
613 | unsigned int vcc, | ||
613 | void *priv_data) | 614 | void *priv_data) |
614 | { | 615 | { |
615 | unsigned long try = (unsigned long) priv_data; | 616 | int *try = priv_data; |
616 | 617 | ||
617 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 618 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
618 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 619 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
619 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && | 620 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && |
620 | (cf->io.win[0].base != 0)) { | 621 | (cf->io.win[0].base != 0)) { |
621 | p_dev->io.BasePort1 = cf->io.win[0].base; | 622 | p_dev->io.BasePort1 = cf->io.win[0].base; |
622 | p_dev->io.IOAddrLines = (try == 0) ? 16 : | 623 | p_dev->io.IOAddrLines = (*try == 0) ? 16 : |
623 | cf->io.flags & CISTPL_IO_LINES_MASK; | 624 | cf->io.flags & CISTPL_IO_LINES_MASK; |
624 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 625 | if (!pcmcia_request_io(p_dev, &p_dev->io)) |
625 | return 0; | 626 | return 0; |
@@ -630,6 +631,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev, | |||
630 | static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, | 631 | static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, |
631 | cistpl_cftable_entry_t *cf, | 632 | cistpl_cftable_entry_t *cf, |
632 | cistpl_cftable_entry_t *dflt, | 633 | cistpl_cftable_entry_t *dflt, |
634 | unsigned int vcc, | ||
633 | void *priv_data) | 635 | void *priv_data) |
634 | { | 636 | { |
635 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 637 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
@@ -650,13 +652,12 @@ static int btuart_config(struct pcmcia_device *link) | |||
650 | { | 652 | { |
651 | btuart_info_t *info = link->priv; | 653 | btuart_info_t *info = link->priv; |
652 | int i; | 654 | int i; |
653 | unsigned long try; | 655 | int try; |
654 | 656 | ||
655 | /* First pass: look for a config entry that looks normal. | 657 | /* First pass: look for a config entry that looks normal. |
656 | Two tries: without IO aliases, then with aliases */ | 658 | Two tries: without IO aliases, then with aliases */ |
657 | for (try = 0; try < 2; try++) | 659 | for (try = 0; try < 2; try++) |
658 | if (!pcmcia_loop_config(link, btuart_check_config, | 660 | if (!pcmcia_loop_config(link, btuart_check_config, &try)) |
659 | (void *) try)) | ||
660 | goto found_port; | 661 | goto found_port; |
661 | 662 | ||
662 | /* Second pass: try to find an entry that isn't picky about | 663 | /* Second pass: try to find an entry that isn't picky about |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 1830ebd6ca7b..ec12560e0342 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -593,6 +593,7 @@ static void dtl1_detach(struct pcmcia_device *link) | |||
593 | static int dtl1_confcheck(struct pcmcia_device *p_dev, | 593 | static int dtl1_confcheck(struct pcmcia_device *p_dev, |
594 | cistpl_cftable_entry_t *cf, | 594 | cistpl_cftable_entry_t *cf, |
595 | cistpl_cftable_entry_t *dflt, | 595 | cistpl_cftable_entry_t *dflt, |
596 | unsigned int vcc, | ||
596 | void *priv_data) | 597 | void *priv_data) |
597 | { | 598 | { |
598 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | 599 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 7785fbb4c0f6..1c5bf99895ed 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1762,6 +1762,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link) | |||
1762 | static int cm4000_config_check(struct pcmcia_device *p_dev, | 1762 | static int cm4000_config_check(struct pcmcia_device *p_dev, |
1763 | cistpl_cftable_entry_t *cfg, | 1763 | cistpl_cftable_entry_t *cfg, |
1764 | cistpl_cftable_entry_t *dflt, | 1764 | cistpl_cftable_entry_t *dflt, |
1765 | unsigned int vcc, | ||
1765 | void *priv_data) | 1766 | void *priv_data) |
1766 | { | 1767 | { |
1767 | if (!cfg->io.nwin) | 1768 | if (!cfg->io.nwin) |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 468ddef916b3..e047bac56f0e 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -529,6 +529,7 @@ static void cm4040_reader_release(struct pcmcia_device *link) | |||
529 | static int cm4040_config_check(struct pcmcia_device *p_dev, | 529 | static int cm4040_config_check(struct pcmcia_device *p_dev, |
530 | cistpl_cftable_entry_t *cfg, | 530 | cistpl_cftable_entry_t *cfg, |
531 | cistpl_cftable_entry_t *dflt, | 531 | cistpl_cftable_entry_t *dflt, |
532 | unsigned int vcc, | ||
532 | void *priv_data) | 533 | void *priv_data) |
533 | { | 534 | { |
534 | int rc; | 535 | int rc; |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index cc8eeaf80275..6472cd8231f7 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -221,7 +221,6 @@ out_release: | |||
221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
222 | 222 | ||
223 | struct pcmcia_config_check { | 223 | struct pcmcia_config_check { |
224 | config_info_t conf; | ||
225 | unsigned long ctl_base; | 224 | unsigned long ctl_base; |
226 | int skip_vcc; | 225 | int skip_vcc; |
227 | int is_kme; | 226 | int is_kme; |
@@ -230,6 +229,7 @@ struct pcmcia_config_check { | |||
230 | static int pcmcia_check_one_config(struct pcmcia_device *pdev, | 229 | static int pcmcia_check_one_config(struct pcmcia_device *pdev, |
231 | cistpl_cftable_entry_t *cfg, | 230 | cistpl_cftable_entry_t *cfg, |
232 | cistpl_cftable_entry_t *dflt, | 231 | cistpl_cftable_entry_t *dflt, |
232 | unsigned int vcc, | ||
233 | void *priv_data) | 233 | void *priv_data) |
234 | { | 234 | { |
235 | struct pcmcia_config_check *stk = priv_data; | 235 | struct pcmcia_config_check *stk = priv_data; |
@@ -237,12 +237,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, | |||
237 | /* Check for matching Vcc, unless we're desperate */ | 237 | /* Check for matching Vcc, unless we're desperate */ |
238 | if (!stk->skip_vcc) { | 238 | if (!stk->skip_vcc) { |
239 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 239 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
240 | if (stk->conf.Vcc != | 240 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) |
241 | cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) | ||
242 | return -ENODEV; | 241 | return -ENODEV; |
243 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 242 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
244 | if (stk->conf.Vcc != | 243 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) |
245 | dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) | ||
246 | return -ENODEV; | 244 | return -ENODEV; |
247 | } | 245 | } |
248 | } | 246 | } |
@@ -298,10 +296,8 @@ static int ide_config(struct pcmcia_device *link) | |||
298 | if (!stk) | 296 | if (!stk) |
299 | goto err_mem; | 297 | goto err_mem; |
300 | stk->is_kme = is_kme; | 298 | stk->is_kme = is_kme; |
301 | |||
302 | /* Not sure if this is right... look up the current Vcc */ | ||
303 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); | ||
304 | stk->skip_vcc = io_base = ctl_base = 0; | 299 | stk->skip_vcc = io_base = ctl_base = 0; |
300 | |||
305 | if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { | 301 | if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { |
306 | stk->skip_vcc = 1; | 302 | stk->skip_vcc = 1; |
307 | if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) | 303 | if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) |
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index a8d6949338cd..388046539705 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -157,6 +157,7 @@ static void avmcs_detach(struct pcmcia_device *link) | |||
157 | static int avmcs_configcheck(struct pcmcia_device *p_dev, | 157 | static int avmcs_configcheck(struct pcmcia_device *p_dev, |
158 | cistpl_cftable_entry_t *cf, | 158 | cistpl_cftable_entry_t *cf, |
159 | cistpl_cftable_entry_t *dflt, | 159 | cistpl_cftable_entry_t *dflt, |
160 | unsigned int vcc, | ||
160 | void *priv_data) | 161 | void *priv_data) |
161 | { | 162 | { |
162 | if (cf->io.nwin <= 0) | 163 | if (cf->io.nwin <= 0) |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 7ce1aabb0aeb..8fd3ca0fb93a 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -177,6 +177,7 @@ static void avma1cs_detach(struct pcmcia_device *link) | |||
177 | static int avma1cs_configcheck(struct pcmcia_device *p_dev, | 177 | static int avma1cs_configcheck(struct pcmcia_device *p_dev, |
178 | cistpl_cftable_entry_t *cf, | 178 | cistpl_cftable_entry_t *cf, |
179 | cistpl_cftable_entry_t *dflt, | 179 | cistpl_cftable_entry_t *dflt, |
180 | unsigned int vcc, | ||
180 | void *priv_data) | 181 | void *priv_data) |
181 | { | 182 | { |
182 | if (cf->io.nwin <= 0) | 183 | if (cf->io.nwin <= 0) |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 29c55b0b86b4..2bf0016dea5e 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -207,6 +207,7 @@ static void elsa_cs_detach(struct pcmcia_device *link) | |||
207 | static int elsa_cs_configcheck(struct pcmcia_device *p_dev, | 207 | static int elsa_cs_configcheck(struct pcmcia_device *p_dev, |
208 | cistpl_cftable_entry_t *cf, | 208 | cistpl_cftable_entry_t *cf, |
209 | cistpl_cftable_entry_t *dflt, | 209 | cistpl_cftable_entry_t *dflt, |
210 | unsigned int vcc, | ||
210 | void *priv_data) | 211 | void *priv_data) |
211 | { | 212 | { |
212 | int j; | 213 | int j; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 2746acbd8b70..9a3c9f5e4fe8 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -217,17 +217,13 @@ static void sedlbauer_detach(struct pcmcia_device *link) | |||
217 | #define CS_CHECK(fn, ret) \ | 217 | #define CS_CHECK(fn, ret) \ |
218 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 218 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
219 | 219 | ||
220 | struct sedlbauer_config_data { | ||
221 | config_info_t conf; | ||
222 | win_req_t req; | ||
223 | }; | ||
224 | |||
225 | static int sedlbauer_config_check(struct pcmcia_device *p_dev, | 220 | static int sedlbauer_config_check(struct pcmcia_device *p_dev, |
226 | cistpl_cftable_entry_t *cfg, | 221 | cistpl_cftable_entry_t *cfg, |
227 | cistpl_cftable_entry_t *dflt, | 222 | cistpl_cftable_entry_t *dflt, |
223 | unsigned int vcc, | ||
228 | void *priv_data) | 224 | void *priv_data) |
229 | { | 225 | { |
230 | struct sedlbauer_config_data *cfg_mem = priv_data; | 226 | win_req_t *req = priv_data; |
231 | 227 | ||
232 | if (cfg->index == 0) | 228 | if (cfg->index == 0) |
233 | return -ENODEV; | 229 | return -ENODEV; |
@@ -241,12 +237,10 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
241 | /* Use power settings for Vcc and Vpp if present */ | 237 | /* Use power settings for Vcc and Vpp if present */ |
242 | /* Note that the CIS values need to be rescaled */ | 238 | /* Note that the CIS values need to be rescaled */ |
243 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 239 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
244 | if (cfg_mem->conf.Vcc != | 240 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) |
245 | cfg->vcc.param[CISTPL_POWER_VNOM]/10000) | ||
246 | return -ENODEV; | 241 | return -ENODEV; |
247 | } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 242 | } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
248 | if (cfg_mem->conf.Vcc != | 243 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) |
249 | dflt->vcc.param[CISTPL_POWER_VNOM]/10000) | ||
250 | return -ENODEV; | 244 | return -ENODEV; |
251 | } | 245 | } |
252 | 246 | ||
@@ -294,12 +288,12 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
294 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | 288 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
295 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | 289 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
296 | memreq_t map; | 290 | memreq_t map; |
297 | cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | 291 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; |
298 | cfg_mem->req.Attributes |= WIN_ENABLE; | 292 | req->Attributes |= WIN_ENABLE; |
299 | cfg_mem->req.Base = mem->win[0].host_addr; | 293 | req->Base = mem->win[0].host_addr; |
300 | cfg_mem->req.Size = mem->win[0].len; | 294 | req->Size = mem->win[0].len; |
301 | cfg_mem->req.AccessSpeed = 0; | 295 | req->AccessSpeed = 0; |
302 | if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) | 296 | if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) |
303 | return -ENODEV; | 297 | return -ENODEV; |
304 | map.Page = 0; | 298 | map.Page = 0; |
305 | map.CardOffset = mem->win[0].card_addr; | 299 | map.CardOffset = mem->win[0].card_addr; |
@@ -314,20 +308,16 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
314 | static int sedlbauer_config(struct pcmcia_device *link) | 308 | static int sedlbauer_config(struct pcmcia_device *link) |
315 | { | 309 | { |
316 | local_info_t *dev = link->priv; | 310 | local_info_t *dev = link->priv; |
317 | struct sedlbauer_config_data *cfg_mem; | 311 | win_req_t *req; |
318 | int last_fn, last_ret; | 312 | int last_fn, last_ret; |
319 | IsdnCard_t icard; | 313 | IsdnCard_t icard; |
320 | 314 | ||
321 | DEBUG(0, "sedlbauer_config(0x%p)\n", link); | 315 | DEBUG(0, "sedlbauer_config(0x%p)\n", link); |
322 | 316 | ||
323 | cfg_mem = kzalloc(sizeof(struct sedlbauer_config_data), GFP_KERNEL); | 317 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); |
324 | if (!cfg_mem) | 318 | if (!req) |
325 | return -ENOMEM; | 319 | return -ENOMEM; |
326 | 320 | ||
327 | /* Look up the current Vcc */ | ||
328 | CS_CHECK(GetConfigurationInfo, | ||
329 | pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
330 | |||
331 | /* | 321 | /* |
332 | In this loop, we scan the CIS for configuration table entries, | 322 | In this loop, we scan the CIS for configuration table entries, |
333 | each of which describes a valid card configuration, including | 323 | each of which describes a valid card configuration, including |
@@ -340,7 +330,7 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
340 | these things without consulting the CIS, and most client drivers | 330 | these things without consulting the CIS, and most client drivers |
341 | will only use the CIS to fill in implementation-defined details. | 331 | will only use the CIS to fill in implementation-defined details. |
342 | */ | 332 | */ |
343 | last_ret = pcmcia_loop_config(link, sedlbauer_config_check, cfg_mem); | 333 | last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req); |
344 | if (last_ret) | 334 | if (last_ret) |
345 | goto failed; | 335 | goto failed; |
346 | 336 | ||
@@ -381,8 +371,8 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
381 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | 371 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, |
382 | link->io.BasePort2+link->io.NumPorts2-1); | 372 | link->io.BasePort2+link->io.NumPorts2-1); |
383 | if (link->win) | 373 | if (link->win) |
384 | printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, | 374 | printk(", mem 0x%06lx-0x%06lx", req->Base, |
385 | cfg_mem->req.Base+cfg_mem->req.Size-1); | 375 | req->Base+req->Size-1); |
386 | printk("\n"); | 376 | printk("\n"); |
387 | 377 | ||
388 | icard.para[0] = link->irq.AssignedIRQ; | 378 | icard.para[0] = link->irq.AssignedIRQ; |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index f4f2e2231a9b..21cabd0aadbe 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -197,6 +197,7 @@ static void teles_detach(struct pcmcia_device *link) | |||
197 | static int teles_cs_configcheck(struct pcmcia_device *p_dev, | 197 | static int teles_cs_configcheck(struct pcmcia_device *p_dev, |
198 | cistpl_cftable_entry_t *cf, | 198 | cistpl_cftable_entry_t *cf, |
199 | cistpl_cftable_entry_t *dflt, | 199 | cistpl_cftable_entry_t *dflt, |
200 | unsigned int vcc, | ||
200 | void *priv_data) | 201 | void *priv_data) |
201 | { | 202 | { |
202 | int j; | 203 | int j; |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index c99dc5d54d19..061d889794c5 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -287,6 +287,7 @@ static int try_io_port(struct pcmcia_device *link) | |||
287 | static int axnet_configcheck(struct pcmcia_device *p_dev, | 287 | static int axnet_configcheck(struct pcmcia_device *p_dev, |
288 | cistpl_cftable_entry_t *cfg, | 288 | cistpl_cftable_entry_t *cfg, |
289 | cistpl_cftable_entry_t *dflt, | 289 | cistpl_cftable_entry_t *dflt, |
290 | unsigned int vcc, | ||
290 | void *priv_data) | 291 | void *priv_data) |
291 | { | 292 | { |
292 | int i; | 293 | int i; |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 10fc537804b0..aa17434faa0e 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -515,6 +515,7 @@ static int try_io_port(struct pcmcia_device *link) | |||
515 | static int pcnet_confcheck(struct pcmcia_device *p_dev, | 515 | static int pcnet_confcheck(struct pcmcia_device *p_dev, |
516 | cistpl_cftable_entry_t *cfg, | 516 | cistpl_cftable_entry_t *cfg, |
517 | cistpl_cftable_entry_t *dflt, | 517 | cistpl_cftable_entry_t *dflt, |
518 | unsigned int vcc, | ||
518 | void *priv_data) | 519 | void *priv_data) |
519 | { | 520 | { |
520 | int *has_shmem = priv_data; | 521 | int *has_shmem = priv_data; |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 05bca83c5e27..b3f2085ddca9 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -462,6 +462,7 @@ static int mhz_3288_power(struct pcmcia_device *link) | |||
462 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, | 462 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, |
463 | cistpl_cftable_entry_t *cf, | 463 | cistpl_cftable_entry_t *cf, |
464 | cistpl_cftable_entry_t *dflt, | 464 | cistpl_cftable_entry_t *dflt, |
465 | unsigned int vcc, | ||
465 | void *priv_data) | 466 | void *priv_data) |
466 | { | 467 | { |
467 | int k; | 468 | int k; |
@@ -653,6 +654,7 @@ static int mot_setup(struct pcmcia_device *link) | |||
653 | static int smc_configcheck(struct pcmcia_device *p_dev, | 654 | static int smc_configcheck(struct pcmcia_device *p_dev, |
654 | cistpl_cftable_entry_t *cf, | 655 | cistpl_cftable_entry_t *cf, |
655 | cistpl_cftable_entry_t *dflt, | 656 | cistpl_cftable_entry_t *dflt, |
657 | unsigned int vcc, | ||
656 | void *priv_data) | 658 | void *priv_data) |
657 | { | 659 | { |
658 | p_dev->io.BasePort1 = cf->io.win[0].base; | 660 | p_dev->io.BasePort1 = cf->io.win[0].base; |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index a16efa49b855..d97e6e917c3c 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -719,6 +719,7 @@ static int | |||
719 | xirc2ps_config_modem(struct pcmcia_device *p_dev, | 719 | xirc2ps_config_modem(struct pcmcia_device *p_dev, |
720 | cistpl_cftable_entry_t *cf, | 720 | cistpl_cftable_entry_t *cf, |
721 | cistpl_cftable_entry_t *dflt, | 721 | cistpl_cftable_entry_t *dflt, |
722 | unsigned int vcc, | ||
722 | void *priv_data) | 723 | void *priv_data) |
723 | { | 724 | { |
724 | unsigned int ioaddr; | 725 | unsigned int ioaddr; |
@@ -738,6 +739,7 @@ static int | |||
738 | xirc2ps_config_check(struct pcmcia_device *p_dev, | 739 | xirc2ps_config_check(struct pcmcia_device *p_dev, |
739 | cistpl_cftable_entry_t *cf, | 740 | cistpl_cftable_entry_t *cf, |
740 | cistpl_cftable_entry_t *dflt, | 741 | cistpl_cftable_entry_t *dflt, |
742 | unsigned int vcc, | ||
741 | void *priv_data) | 743 | void *priv_data) |
742 | { | 744 | { |
743 | int *pass = priv_data; | 745 | int *pass = priv_data; |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 657adf85ab77..fac1526e49aa 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -209,6 +209,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
209 | static int airo_cs_config_check(struct pcmcia_device *p_dev, | 209 | static int airo_cs_config_check(struct pcmcia_device *p_dev, |
210 | cistpl_cftable_entry_t *cfg, | 210 | cistpl_cftable_entry_t *cfg, |
211 | cistpl_cftable_entry_t *dflt, | 211 | cistpl_cftable_entry_t *dflt, |
212 | unsigned int vcc, | ||
212 | void *priv_data) | 213 | void *priv_data) |
213 | { | 214 | { |
214 | win_req_t *req = priv_data; | 215 | win_req_t *req = priv_data; |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index c71aae992ecc..4830d51900a3 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -227,6 +227,7 @@ static int card_present(void *arg) | |||
227 | static int atmel_config_check(struct pcmcia_device *p_dev, | 227 | static int atmel_config_check(struct pcmcia_device *p_dev, |
228 | cistpl_cftable_entry_t *cfg, | 228 | cistpl_cftable_entry_t *cfg, |
229 | cistpl_cftable_entry_t *dflt, | 229 | cistpl_cftable_entry_t *dflt, |
230 | unsigned int vcc, | ||
230 | void *priv_data) | 231 | void *priv_data) |
231 | { | 232 | { |
232 | if (cfg->index == 0) | 233 | if (cfg->index == 0) |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index f9595ca71a06..c768d42d5177 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -536,17 +536,12 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
536 | /* run after a CARD_INSERTION event is received to configure the PCMCIA | 536 | /* run after a CARD_INSERTION event is received to configure the PCMCIA |
537 | * socket and make the device available to the system */ | 537 | * socket and make the device available to the system */ |
538 | 538 | ||
539 | struct prism2_config_data { | ||
540 | config_info_t conf; | ||
541 | }; | ||
542 | |||
543 | static int prism2_config_check(struct pcmcia_device *p_dev, | 539 | static int prism2_config_check(struct pcmcia_device *p_dev, |
544 | cistpl_cftable_entry_t *cfg, | 540 | cistpl_cftable_entry_t *cfg, |
545 | cistpl_cftable_entry_t *dflt, | 541 | cistpl_cftable_entry_t *dflt, |
542 | unsigned int vcc, | ||
546 | void *priv_data) | 543 | void *priv_data) |
547 | { | 544 | { |
548 | struct prism2_config_data *cfg_mem = priv_data; | ||
549 | |||
550 | if (cfg->index == 0) | 545 | if (cfg->index == 0) |
551 | return -ENODEV; | 546 | return -ENODEV; |
552 | 547 | ||
@@ -562,14 +557,14 @@ static int prism2_config_check(struct pcmcia_device *p_dev, | |||
562 | /* Use power settings for Vcc and Vpp if present */ | 557 | /* Use power settings for Vcc and Vpp if present */ |
563 | /* Note that the CIS values need to be rescaled */ | 558 | /* Note that the CIS values need to be rescaled */ |
564 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 559 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
565 | if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / | 560 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / |
566 | 10000 && !ignore_cis_vcc) { | 561 | 10000 && !ignore_cis_vcc) { |
567 | PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" | 562 | PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" |
568 | " this entry\n"); | 563 | " this entry\n"); |
569 | return -ENODEV; | 564 | return -ENODEV; |
570 | } | 565 | } |
571 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 566 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
572 | if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / | 567 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / |
573 | 10000 && !ignore_cis_vcc) { | 568 | 10000 && !ignore_cis_vcc) { |
574 | PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " | 569 | PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " |
575 | "- skipping this entry\n"); | 570 | "- skipping this entry\n"); |
@@ -627,7 +622,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
627 | { | 622 | { |
628 | struct net_device *dev; | 623 | struct net_device *dev; |
629 | struct hostap_interface *iface; | 624 | struct hostap_interface *iface; |
630 | struct prism2_config_data *cfg_mem; | ||
631 | local_info_t *local; | 625 | local_info_t *local; |
632 | int ret = 1; | 626 | int ret = 1; |
633 | int last_fn, last_ret; | 627 | int last_fn, last_ret; |
@@ -635,21 +629,14 @@ static int prism2_config(struct pcmcia_device *link) | |||
635 | 629 | ||
636 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); | 630 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); |
637 | 631 | ||
638 | cfg_mem = kzalloc(sizeof(struct prism2_config_data), GFP_KERNEL); | ||
639 | if (!cfg_mem) | ||
640 | return -ENOMEM; | ||
641 | |||
642 | hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); | 632 | hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); |
643 | if (hw_priv == NULL) { | 633 | if (hw_priv == NULL) { |
644 | ret = -ENOMEM; | 634 | ret = -ENOMEM; |
645 | goto failed; | 635 | goto failed; |
646 | } | 636 | } |
647 | 637 | ||
648 | CS_CHECK(GetConfigurationInfo, | ||
649 | pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
650 | |||
651 | /* Look for an appropriate configuration table entry in the CIS */ | 638 | /* Look for an appropriate configuration table entry in the CIS */ |
652 | last_ret = pcmcia_loop_config(link, prism2_config_check, cfg_mem); | 639 | last_ret = pcmcia_loop_config(link, prism2_config_check, NULL); |
653 | if (last_ret) { | 640 | if (last_ret) { |
654 | if (!ignore_cis_vcc) | 641 | if (!ignore_cis_vcc) |
655 | printk(KERN_ERR "GetNextTuple(): No matching " | 642 | printk(KERN_ERR "GetNextTuple(): No matching " |
@@ -724,7 +711,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
724 | if (ret == 0 && local->ddev) | 711 | if (ret == 0 && local->ddev) |
725 | strcpy(hw_priv->node.dev_name, local->ddev->name); | 712 | strcpy(hw_priv->node.dev_name, local->ddev->name); |
726 | } | 713 | } |
727 | kfree(cfg_mem); | ||
728 | return ret; | 714 | return ret; |
729 | 715 | ||
730 | cs_failed: | 716 | cs_failed: |
@@ -732,7 +718,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
732 | 718 | ||
733 | failed: | 719 | failed: |
734 | kfree(hw_priv); | 720 | kfree(hw_priv); |
735 | kfree(cfg_mem); | ||
736 | prism2_release((u_long)link); | 721 | prism2_release((u_long)link); |
737 | return ret; | 722 | return ret; |
738 | } | 723 | } |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 8a367f96db37..c7b57d9d499d 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -164,31 +164,26 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
164 | last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ | 164 | last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ |
165 | } while (0) | 165 | } while (0) |
166 | 166 | ||
167 | struct orinoco_cs_config_data { | ||
168 | config_info_t conf; | ||
169 | }; | ||
170 | |||
171 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | 167 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, |
172 | cistpl_cftable_entry_t *cfg, | 168 | cistpl_cftable_entry_t *cfg, |
173 | cistpl_cftable_entry_t *dflt, | 169 | cistpl_cftable_entry_t *dflt, |
170 | unsigned int vcc, | ||
174 | void *priv_data) | 171 | void *priv_data) |
175 | { | 172 | { |
176 | struct orinoco_cs_config_data *cfg_mem = priv_data; | ||
177 | |||
178 | if (cfg->index == 0) | 173 | if (cfg->index == 0) |
179 | goto next_entry; | 174 | goto next_entry; |
180 | 175 | ||
181 | /* Use power settings for Vcc and Vpp if present */ | 176 | /* Use power settings for Vcc and Vpp if present */ |
182 | /* Note that the CIS values need to be rescaled */ | 177 | /* Note that the CIS values need to be rescaled */ |
183 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 178 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
184 | if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | 179 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { |
185 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | 180 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); |
186 | if (!ignore_cis_vcc) | 181 | if (!ignore_cis_vcc) |
187 | goto next_entry; | 182 | goto next_entry; |
188 | } | 183 | } |
189 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 184 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
190 | if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { | 185 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { |
191 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); | 186 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); |
192 | if (!ignore_cis_vcc) | 187 | if (!ignore_cis_vcc) |
193 | goto next_entry; | 188 | goto next_entry; |
194 | } | 189 | } |
@@ -236,7 +231,6 @@ next_entry: | |||
236 | static int | 231 | static int |
237 | orinoco_cs_config(struct pcmcia_device *link) | 232 | orinoco_cs_config(struct pcmcia_device *link) |
238 | { | 233 | { |
239 | struct orinoco_cs_config_data *cfg_mem; | ||
240 | struct net_device *dev = link->priv; | 234 | struct net_device *dev = link->priv; |
241 | struct orinoco_private *priv = netdev_priv(dev); | 235 | struct orinoco_private *priv = netdev_priv(dev); |
242 | struct orinoco_pccard *card = priv->card; | 236 | struct orinoco_pccard *card = priv->card; |
@@ -244,14 +238,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
244 | int last_fn, last_ret; | 238 | int last_fn, last_ret; |
245 | void __iomem *mem; | 239 | void __iomem *mem; |
246 | 240 | ||
247 | cfg_mem = kzalloc(sizeof(struct orinoco_cs_config_data), GFP_KERNEL); | ||
248 | if (!cfg_mem) | ||
249 | return -ENOMEM; | ||
250 | |||
251 | /* Look up the current Vcc */ | ||
252 | CS_CHECK(GetConfigurationInfo, | ||
253 | pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
254 | |||
255 | /* | 241 | /* |
256 | * In this loop, we scan the CIS for configuration table | 242 | * In this loop, we scan the CIS for configuration table |
257 | * entries, each of which describes a valid card | 243 | * entries, each of which describes a valid card |
@@ -266,7 +252,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
266 | * and most client drivers will only use the CIS to fill in | 252 | * and most client drivers will only use the CIS to fill in |
267 | * implementation-defined details. | 253 | * implementation-defined details. |
268 | */ | 254 | */ |
269 | last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, cfg_mem); | 255 | last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); |
270 | if (last_ret) { | 256 | if (last_ret) { |
271 | if (!ignore_cis_vcc) | 257 | if (!ignore_cis_vcc) |
272 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 258 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
@@ -324,7 +310,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
324 | "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id, | 310 | "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id, |
325 | link->irq.AssignedIRQ, link->io.BasePort1, | 311 | link->irq.AssignedIRQ, link->io.BasePort1, |
326 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 312 | link->io.BasePort1 + link->io.NumPorts1 - 1); |
327 | kfree(cfg_mem); | ||
328 | return 0; | 313 | return 0; |
329 | 314 | ||
330 | cs_failed: | 315 | cs_failed: |
@@ -332,7 +317,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
332 | 317 | ||
333 | failed: | 318 | failed: |
334 | orinoco_cs_release(link); | 319 | orinoco_cs_release(link); |
335 | kfree(cfg_mem); | ||
336 | return -ENODEV; | 320 | return -ENODEV; |
337 | } /* orinoco_cs_config */ | 321 | } /* orinoco_cs_config */ |
338 | 322 | ||
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index e28878dfaba3..d7e9d9c3042c 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -633,31 +633,26 @@ static void spectrum_cs_detach(struct pcmcia_device *link) | |||
633 | * device available to the system. | 633 | * device available to the system. |
634 | */ | 634 | */ |
635 | 635 | ||
636 | struct spectrum_cs_config_data { | ||
637 | config_info_t conf; | ||
638 | }; | ||
639 | |||
640 | static int spectrum_cs_config_check(struct pcmcia_device *p_dev, | 636 | static int spectrum_cs_config_check(struct pcmcia_device *p_dev, |
641 | cistpl_cftable_entry_t *cfg, | 637 | cistpl_cftable_entry_t *cfg, |
642 | cistpl_cftable_entry_t *dflt, | 638 | cistpl_cftable_entry_t *dflt, |
639 | unsigned int vcc, | ||
643 | void *priv_data) | 640 | void *priv_data) |
644 | { | 641 | { |
645 | struct spectrum_cs_config_data *cfg_mem = priv_data; | ||
646 | |||
647 | if (cfg->index == 0) | 642 | if (cfg->index == 0) |
648 | goto next_entry; | 643 | goto next_entry; |
649 | 644 | ||
650 | /* Use power settings for Vcc and Vpp if present */ | 645 | /* Use power settings for Vcc and Vpp if present */ |
651 | /* Note that the CIS values need to be rescaled */ | 646 | /* Note that the CIS values need to be rescaled */ |
652 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 647 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
653 | if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | 648 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { |
654 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | 649 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); |
655 | if (!ignore_cis_vcc) | 650 | if (!ignore_cis_vcc) |
656 | goto next_entry; | 651 | goto next_entry; |
657 | } | 652 | } |
658 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 653 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
659 | if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { | 654 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { |
660 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); | 655 | DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); |
661 | if (!ignore_cis_vcc) | 656 | if (!ignore_cis_vcc) |
662 | goto next_entry; | 657 | goto next_entry; |
663 | } | 658 | } |
@@ -705,7 +700,6 @@ next_entry: | |||
705 | static int | 700 | static int |
706 | spectrum_cs_config(struct pcmcia_device *link) | 701 | spectrum_cs_config(struct pcmcia_device *link) |
707 | { | 702 | { |
708 | struct spectrum_cs_config_data *cfg_mem; | ||
709 | struct net_device *dev = link->priv; | 703 | struct net_device *dev = link->priv; |
710 | struct orinoco_private *priv = netdev_priv(dev); | 704 | struct orinoco_private *priv = netdev_priv(dev); |
711 | struct orinoco_pccard *card = priv->card; | 705 | struct orinoco_pccard *card = priv->card; |
@@ -713,14 +707,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
713 | int last_fn, last_ret; | 707 | int last_fn, last_ret; |
714 | void __iomem *mem; | 708 | void __iomem *mem; |
715 | 709 | ||
716 | cfg_mem = kzalloc(sizeof(struct spectrum_cs_config_data), GFP_KERNEL); | ||
717 | if (!cfg_mem) | ||
718 | return -ENOMEM; | ||
719 | |||
720 | /* Look up the current Vcc */ | ||
721 | CS_CHECK(GetConfigurationInfo, | ||
722 | pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
723 | |||
724 | /* | 710 | /* |
725 | * In this loop, we scan the CIS for configuration table | 711 | * In this loop, we scan the CIS for configuration table |
726 | * entries, each of which describes a valid card | 712 | * entries, each of which describes a valid card |
@@ -735,7 +721,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
735 | * and most client drivers will only use the CIS to fill in | 721 | * and most client drivers will only use the CIS to fill in |
736 | * implementation-defined details. | 722 | * implementation-defined details. |
737 | */ | 723 | */ |
738 | last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, cfg_mem); | 724 | last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); |
739 | if (last_ret) { | 725 | if (last_ret) { |
740 | if (!ignore_cis_vcc) | 726 | if (!ignore_cis_vcc) |
741 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 727 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
@@ -799,7 +785,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
799 | link->irq.AssignedIRQ, link->io.BasePort1, | 785 | link->irq.AssignedIRQ, link->io.BasePort1, |
800 | link->io.BasePort1 + link->io.NumPorts1 - 1); | 786 | link->io.BasePort1 + link->io.NumPorts1 - 1); |
801 | 787 | ||
802 | kfree(cfg_mem); | ||
803 | return 0; | 788 | return 0; |
804 | 789 | ||
805 | cs_failed: | 790 | cs_failed: |
@@ -807,7 +792,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
807 | 792 | ||
808 | failed: | 793 | failed: |
809 | spectrum_cs_release(link); | 794 | spectrum_cs_release(link); |
810 | kfree(cfg_mem); | ||
811 | return -ENODEV; | 795 | return -ENODEV; |
812 | } /* spectrum_cs_config */ | 796 | } /* spectrum_cs_config */ |
813 | 797 | ||
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 05f34e73694b..b1899e9c1f65 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -152,6 +152,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
152 | static int parport_config_check(struct pcmcia_device *p_dev, | 152 | static int parport_config_check(struct pcmcia_device *p_dev, |
153 | cistpl_cftable_entry_t *cfg, | 153 | cistpl_cftable_entry_t *cfg, |
154 | cistpl_cftable_entry_t *dflt, | 154 | cistpl_cftable_entry_t *dflt, |
155 | unsigned int vcc, | ||
155 | void *priv_data) | 156 | void *priv_data) |
156 | { | 157 | { |
157 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 158 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
@@ -169,6 +170,7 @@ static int parport_config_check(struct pcmcia_device *p_dev, | |||
169 | return -ENODEV; | 170 | return -ENODEV; |
170 | return 0; | 171 | return 0; |
171 | } | 172 | } |
173 | return -ENODEV; | ||
172 | } | 174 | } |
173 | 175 | ||
174 | static int parport_config(struct pcmcia_device *link) | 176 | static int parport_config(struct pcmcia_device *link) |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 5ddfd46dea65..0cf3ef30625e 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -935,6 +935,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
935 | int (*conf_check) (struct pcmcia_device *p_dev, | 935 | int (*conf_check) (struct pcmcia_device *p_dev, |
936 | cistpl_cftable_entry_t *cfg, | 936 | cistpl_cftable_entry_t *cfg, |
937 | cistpl_cftable_entry_t *dflt, | 937 | cistpl_cftable_entry_t *dflt, |
938 | unsigned int vcc, | ||
938 | void *priv_data), | 939 | void *priv_data), |
939 | void *priv_data) | 940 | void *priv_data) |
940 | { | 941 | { |
@@ -942,11 +943,15 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
942 | 943 | ||
943 | tuple_t *tuple; | 944 | tuple_t *tuple; |
944 | int ret = -ENODEV; | 945 | int ret = -ENODEV; |
946 | unsigned int vcc; | ||
945 | 947 | ||
946 | cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); | 948 | cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); |
947 | if (cfg_mem == NULL) | 949 | if (cfg_mem == NULL) |
948 | return -ENOMEM; | 950 | return -ENOMEM; |
949 | 951 | ||
952 | /* get the current Vcc setting */ | ||
953 | vcc = p_dev->socket->socket.Vcc; | ||
954 | |||
950 | tuple = &cfg_mem->tuple; | 955 | tuple = &cfg_mem->tuple; |
951 | tuple->TupleData = cfg_mem->buf; | 956 | tuple->TupleData = cfg_mem->buf; |
952 | tuple->TupleDataMax = 255; | 957 | tuple->TupleDataMax = 255; |
@@ -969,7 +974,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
969 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 974 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
970 | cfg_mem->dflt = *cfg; | 975 | cfg_mem->dflt = *cfg; |
971 | 976 | ||
972 | ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data); | 977 | ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data); |
973 | if (!ret) | 978 | if (!ret) |
974 | break; | 979 | break; |
975 | 980 | ||
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 2ed3077b826a..165ff884f48e 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -143,6 +143,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
143 | static int aha152x_config_check(struct pcmcia_device *p_dev, | 143 | static int aha152x_config_check(struct pcmcia_device *p_dev, |
144 | cistpl_cftable_entry_t *cfg, | 144 | cistpl_cftable_entry_t *cfg, |
145 | cistpl_cftable_entry_t *dflt, | 145 | cistpl_cftable_entry_t *dflt, |
146 | unsigned int vcc, | ||
146 | void *priv_data) | 147 | void *priv_data) |
147 | { | 148 | { |
148 | /* For New Media T&J, look for a SCSI window */ | 149 | /* For New Media T&J, look for a SCSI window */ |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 2b6e92d7be07..06254f46a0dd 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -126,6 +126,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
126 | static int fdomain_config_check(struct pcmcia_device *p_dev, | 126 | static int fdomain_config_check(struct pcmcia_device *p_dev, |
127 | cistpl_cftable_entry_t *cfg, | 127 | cistpl_cftable_entry_t *cfg, |
128 | cistpl_cftable_entry_t *dflt, | 128 | cistpl_cftable_entry_t *dflt, |
129 | unsigned int vcc, | ||
129 | void *priv_data) | 130 | void *priv_data) |
130 | { | 131 | { |
131 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 132 | p_dev->io.BasePort1 = cfg->io.win[0].base; |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index aa4523462578..7c19bf264873 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1611,12 +1611,12 @@ static void nsp_cs_detach(struct pcmcia_device *link) | |||
1611 | struct nsp_cs_configdata { | 1611 | struct nsp_cs_configdata { |
1612 | nsp_hw_data *data; | 1612 | nsp_hw_data *data; |
1613 | win_req_t req; | 1613 | win_req_t req; |
1614 | config_info_t conf; | ||
1615 | }; | 1614 | }; |
1616 | 1615 | ||
1617 | static int nsp_cs_config_check(struct pcmcia_device *p_dev, | 1616 | static int nsp_cs_config_check(struct pcmcia_device *p_dev, |
1618 | cistpl_cftable_entry_t *cfg, | 1617 | cistpl_cftable_entry_t *cfg, |
1619 | cistpl_cftable_entry_t *dflt, | 1618 | cistpl_cftable_entry_t *dflt, |
1619 | unsigned int vcc, | ||
1620 | void *priv_data) | 1620 | void *priv_data) |
1621 | { | 1621 | { |
1622 | struct nsp_cs_configdata *cfg_mem = priv_data; | 1622 | struct nsp_cs_configdata *cfg_mem = priv_data; |
@@ -1633,10 +1633,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
1633 | /* Use power settings for Vcc and Vpp if present */ | 1633 | /* Use power settings for Vcc and Vpp if present */ |
1634 | /* Note that the CIS values need to be rescaled */ | 1634 | /* Note that the CIS values need to be rescaled */ |
1635 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 1635 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
1636 | if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) | 1636 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) |
1637 | return -ENODEV; | 1637 | return -ENODEV; |
1638 | else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 1638 | else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
1639 | if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) | 1639 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) |
1640 | return -ENODEV; | 1640 | return -ENODEV; |
1641 | } | 1641 | } |
1642 | 1642 | ||
@@ -1719,8 +1719,6 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1719 | return -ENOMEM; | 1719 | return -ENOMEM; |
1720 | cfg_mem->data = data; | 1720 | cfg_mem->data = data; |
1721 | 1721 | ||
1722 | /* Look up the current Vcc */ | ||
1723 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
1724 | ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); | 1722 | ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); |
1725 | goto cs_failed; | 1723 | goto cs_failed; |
1726 | 1724 | ||
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index da6b3603198b..20c3e5e6d88a 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -198,6 +198,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
198 | static int qlogic_config_check(struct pcmcia_device *p_dev, | 198 | static int qlogic_config_check(struct pcmcia_device *p_dev, |
199 | cistpl_cftable_entry_t *cfg, | 199 | cistpl_cftable_entry_t *cfg, |
200 | cistpl_cftable_entry_t *dflt, | 200 | cistpl_cftable_entry_t *dflt, |
201 | unsigned int vcc, | ||
201 | void *priv_data) | 202 | void *priv_data) |
202 | { | 203 | { |
203 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 204 | p_dev->io.BasePort1 = cfg->io.win[0].base; |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index eba193134dfa..b330c11a1752 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -703,6 +703,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
703 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, | 703 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, |
704 | cistpl_cftable_entry_t *cfg, | 704 | cistpl_cftable_entry_t *cfg, |
705 | cistpl_cftable_entry_t *dflt, | 705 | cistpl_cftable_entry_t *dflt, |
706 | unsigned int vcc, | ||
706 | void *priv_data) | 707 | void *priv_data) |
707 | { | 708 | { |
708 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 709 | p_dev->io.BasePort1 = cfg->io.win[0].base; |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index f8658686439d..7e00e672bfe7 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -444,6 +444,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) | |||
444 | static int simple_config_check(struct pcmcia_device *p_dev, | 444 | static int simple_config_check(struct pcmcia_device *p_dev, |
445 | cistpl_cftable_entry_t *cf, | 445 | cistpl_cftable_entry_t *cf, |
446 | cistpl_cftable_entry_t *dflt, | 446 | cistpl_cftable_entry_t *dflt, |
447 | unsigned int vcc, | ||
447 | void *priv_data) | 448 | void *priv_data) |
448 | { | 449 | { |
449 | static const int size_table[2] = { 8, 16 }; | 450 | static const int size_table[2] = { 8, 16 }; |
@@ -467,6 +468,7 @@ static int simple_config_check(struct pcmcia_device *p_dev, | |||
467 | static int simple_config_check_notpicky(struct pcmcia_device *p_dev, | 468 | static int simple_config_check_notpicky(struct pcmcia_device *p_dev, |
468 | cistpl_cftable_entry_t *cf, | 469 | cistpl_cftable_entry_t *cf, |
469 | cistpl_cftable_entry_t *dflt, | 470 | cistpl_cftable_entry_t *dflt, |
471 | unsigned int vcc, | ||
470 | void *priv_data) | 472 | void *priv_data) |
471 | { | 473 | { |
472 | static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 474 | static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
@@ -549,6 +551,7 @@ found_port: | |||
549 | static int multi_config_check(struct pcmcia_device *p_dev, | 551 | static int multi_config_check(struct pcmcia_device *p_dev, |
550 | cistpl_cftable_entry_t *cf, | 552 | cistpl_cftable_entry_t *cf, |
551 | cistpl_cftable_entry_t *dflt, | 553 | cistpl_cftable_entry_t *dflt, |
554 | unsigned int vcc, | ||
552 | void *priv_data) | 555 | void *priv_data) |
553 | { | 556 | { |
554 | int *base2 = priv_data; | 557 | int *base2 = priv_data; |
@@ -569,6 +572,7 @@ static int multi_config_check(struct pcmcia_device *p_dev, | |||
569 | static int multi_config_check_notpicky(struct pcmcia_device *p_dev, | 572 | static int multi_config_check_notpicky(struct pcmcia_device *p_dev, |
570 | cistpl_cftable_entry_t *cf, | 573 | cistpl_cftable_entry_t *cf, |
571 | cistpl_cftable_entry_t *dflt, | 574 | cistpl_cftable_entry_t *dflt, |
575 | unsigned int vcc, | ||
572 | void *priv_data) | 576 | void *priv_data) |
573 | { | 577 | { |
574 | int *base2 = priv_data; | 578 | int *base2 = priv_data; |
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index b41df211b786..347c3ed1d9f1 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -127,6 +127,7 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) | |||
127 | static int ixj_config_check(struct pcmcia_device *p_dev, | 127 | static int ixj_config_check(struct pcmcia_device *p_dev, |
128 | cistpl_cftable_entry_t *cfg, | 128 | cistpl_cftable_entry_t *cfg, |
129 | cistpl_cftable_entry_t *dflt, | 129 | cistpl_cftable_entry_t *dflt, |
130 | unsigned int vcc, | ||
130 | void *priv_data) | 131 | void *priv_data) |
131 | { | 132 | { |
132 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 133 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 78cc32e7b014..ca733b7caea4 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -155,29 +155,22 @@ static void sl811_cs_release(struct pcmcia_device * link) | |||
155 | platform_device_unregister(&platform_dev); | 155 | platform_device_unregister(&platform_dev); |
156 | } | 156 | } |
157 | 157 | ||
158 | struct sl811_css_cfg { | ||
159 | config_info_t conf; | ||
160 | }; | ||
161 | |||
162 | static int sl811_cs_config_check(struct pcmcia_device *p_dev, | 158 | static int sl811_cs_config_check(struct pcmcia_device *p_dev, |
163 | cistpl_cftable_entry_t *cfg, | 159 | cistpl_cftable_entry_t *cfg, |
164 | cistpl_cftable_entry_t *dflt, | 160 | cistpl_cftable_entry_t *dflt, |
161 | unsigned int vcc, | ||
165 | void *priv_data) | 162 | void *priv_data) |
166 | { | 163 | { |
167 | struct sl811_css_cfg *cfg_mem = priv_data; | ||
168 | |||
169 | if (cfg->index == 0) | 164 | if (cfg->index == 0) |
170 | return -ENODEV; | 165 | return -ENODEV; |
171 | 166 | ||
172 | /* Use power settings for Vcc and Vpp if present */ | 167 | /* Use power settings for Vcc and Vpp if present */ |
173 | /* Note that the CIS values need to be rescaled */ | 168 | /* Note that the CIS values need to be rescaled */ |
174 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 169 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
175 | if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != | 170 | if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) |
176 | cfg_mem->conf.Vcc) | ||
177 | return -ENODEV; | 171 | return -ENODEV; |
178 | } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 172 | } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
179 | if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 | 173 | if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) |
180 | != cfg_mem->conf.Vcc) | ||
181 | return -ENODEV; | 174 | return -ENODEV; |
182 | } | 175 | } |
183 | 176 | ||
@@ -214,29 +207,20 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
214 | struct device *parent = &handle_to_dev(link); | 207 | struct device *parent = &handle_to_dev(link); |
215 | local_info_t *dev = link->priv; | 208 | local_info_t *dev = link->priv; |
216 | int last_fn, last_ret; | 209 | int last_fn, last_ret; |
217 | struct sl811_css_cfg *cfg_mem; | ||
218 | 210 | ||
219 | DBG(0, "sl811_cs_config(0x%p)\n", link); | 211 | DBG(0, "sl811_cs_config(0x%p)\n", link); |
220 | 212 | ||
221 | cfg_mem = kzalloc(sizeof(struct sl811_css_cfg), GFP_KERNEL); | 213 | if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) |
222 | if (!cfg_mem) | 214 | goto failed; |
223 | return -ENOMEM; | ||
224 | |||
225 | /* Look up the current Vcc */ | ||
226 | CS_CHECK(GetConfigurationInfo, | ||
227 | pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
228 | |||
229 | if (pcmcia_loop_config(link, sl811_cs_config_check, cfg_mem)) | ||
230 | return -ENODEV; | ||
231 | 215 | ||
232 | /* require an IRQ and two registers */ | 216 | /* require an IRQ and two registers */ |
233 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) | 217 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) |
234 | goto cs_failed; | 218 | goto failed; |
235 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 219 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
236 | CS_CHECK(RequestIRQ, | 220 | CS_CHECK(RequestIRQ, |
237 | pcmcia_request_irq(link, &link->irq)); | 221 | pcmcia_request_irq(link, &link->irq)); |
238 | else | 222 | else |
239 | goto cs_failed; | 223 | goto failed; |
240 | 224 | ||
241 | CS_CHECK(RequestConfiguration, | 225 | CS_CHECK(RequestConfiguration, |
242 | pcmcia_request_configuration(link, &link->conf)); | 226 | pcmcia_request_configuration(link, &link->conf)); |
@@ -257,13 +241,12 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
257 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) | 241 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) |
258 | < 0) { | 242 | < 0) { |
259 | cs_failed: | 243 | cs_failed: |
260 | printk("sl811_cs_config failed\n"); | ||
261 | cs_error(link, last_fn, last_ret); | 244 | cs_error(link, last_fn, last_ret); |
245 | failed: | ||
246 | printk(KERN_WARNING "sl811_cs_config failed\n"); | ||
262 | sl811_cs_release(link); | 247 | sl811_cs_release(link); |
263 | kfree(cfg_mem); | ||
264 | return -ENODEV; | 248 | return -ENODEV; |
265 | } | 249 | } |
266 | kfree(cfg_mem); | ||
267 | return 0; | 250 | return 0; |
268 | } | 251 | } |
269 | 252 | ||
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index 0aa702705d00..0092910a597d 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h | |||
@@ -617,6 +617,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
617 | int (*conf_check) (struct pcmcia_device *p_dev, | 617 | int (*conf_check) (struct pcmcia_device *p_dev, |
618 | cistpl_cftable_entry_t *cf, | 618 | cistpl_cftable_entry_t *cf, |
619 | cistpl_cftable_entry_t *dflt, | 619 | cistpl_cftable_entry_t *dflt, |
620 | unsigned int vcc, | ||
620 | void *priv_data), | 621 | void *priv_data), |
621 | void *priv_data); | 622 | void *priv_data); |
622 | 623 | ||