aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 09:30:31 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 19:22:00 -0400
commit8e2fc39ddea7fe8c6798837da282db88a09af793 (patch)
tree7cba37b5b86f4ff25562012a14e29424e3872de0 /drivers/net
parent498ac1899b62626bf6879a251d75c22ec564c559 (diff)
pcmcia: pcmcia_config_loop() default CIS entry handling
Many drivers use the default CIS entry within their pcmcia_config_loop() callback function. Therefore, factor the default CIS entry handling out. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/wireless/airo_cs.c51
-rw-r--r--drivers/net/wireless/atmel_cs.c9
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c24
-rw-r--r--drivers/net/wireless/orinoco_cs.c18
-rw-r--r--drivers/net/wireless/spectrum_cs.c18
9 files changed, 58 insertions, 68 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 04ece0b77d1d..c99dc5d54d19 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -286,6 +286,7 @@ static int try_io_port(struct pcmcia_device *link)
286 286
287static int axnet_configcheck(struct pcmcia_device *p_dev, 287static 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 void *priv_data) 290 void *priv_data)
290{ 291{
291 int i; 292 int i;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index a60608722495..10fc537804b0 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -514,6 +514,7 @@ static int try_io_port(struct pcmcia_device *link)
514 514
515static int pcnet_confcheck(struct pcmcia_device *p_dev, 515static 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 void *priv_data) 518 void *priv_data)
518{ 519{
519 int *has_shmem = priv_data; 520 int *has_shmem = priv_data;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 1e595038a492..05bca83c5e27 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -461,6 +461,7 @@ static int mhz_3288_power(struct pcmcia_device *link)
461 461
462static int mhz_mfc_config_check(struct pcmcia_device *p_dev, 462static 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 void *priv_data) 465 void *priv_data)
465{ 466{
466 int k; 467 int k;
@@ -651,6 +652,7 @@ static int mot_setup(struct pcmcia_device *link)
651 652
652static int smc_configcheck(struct pcmcia_device *p_dev, 653static int smc_configcheck(struct pcmcia_device *p_dev,
653 cistpl_cftable_entry_t *cf, 654 cistpl_cftable_entry_t *cf,
655 cistpl_cftable_entry_t *dflt,
654 void *priv_data) 656 void *priv_data)
655{ 657{
656 p_dev->io.BasePort1 = cf->io.win[0].base; 658 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 b0de704f229c..a16efa49b855 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -718,6 +718,7 @@ has_ce2_string(struct pcmcia_device * p_dev)
718static int 718static int
719xirc2ps_config_modem(struct pcmcia_device *p_dev, 719xirc2ps_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 void *priv_data) 722 void *priv_data)
722{ 723{
723 unsigned int ioaddr; 724 unsigned int ioaddr;
@@ -736,6 +737,7 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev,
736static int 737static int
737xirc2ps_config_check(struct pcmcia_device *p_dev, 738xirc2ps_config_check(struct pcmcia_device *p_dev,
738 cistpl_cftable_entry_t *cf, 739 cistpl_cftable_entry_t *cf,
740 cistpl_cftable_entry_t *dflt,
739 void *priv_data) 741 void *priv_data)
740{ 742{
741 int *pass = priv_data; 743 int *pass = priv_data;
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index d7216730f18e..657adf85ab77 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -206,19 +206,12 @@ static void airo_detach(struct pcmcia_device *link)
206#define CS_CHECK(fn, ret) \ 206#define CS_CHECK(fn, ret) \
207do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 207do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
208 208
209struct airo_cs_config_data {
210 cistpl_cftable_entry_t dflt;
211 win_req_t req;
212};
213
214static int airo_cs_config_check(struct pcmcia_device *p_dev, 209static int airo_cs_config_check(struct pcmcia_device *p_dev,
215 cistpl_cftable_entry_t *cfg, 210 cistpl_cftable_entry_t *cfg,
211 cistpl_cftable_entry_t *dflt,
216 void *priv_data) 212 void *priv_data)
217{ 213{
218 struct airo_cs_config_data *cfg_mem = priv_data; 214 win_req_t *req = priv_data;
219
220 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
221 cfg_mem->dflt = *cfg;
222 215
223 if (cfg->index == 0) 216 if (cfg->index == 0)
224 return -ENODEV; 217 return -ENODEV;
@@ -233,17 +226,17 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
233 /* Note that the CIS values need to be rescaled */ 226 /* Note that the CIS values need to be rescaled */
234 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 227 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
235 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 228 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
236 else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 229 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
237 p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 230 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
238 231
239 /* Do we need to allocate an interrupt? */ 232 /* Do we need to allocate an interrupt? */
240 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 233 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
241 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 234 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
242 235
243 /* IO window settings */ 236 /* IO window settings */
244 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 237 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
245 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 238 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
246 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 239 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
247 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 240 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
248 if (!(io->flags & CISTPL_IO_8BIT)) 241 if (!(io->flags & CISTPL_IO_8BIT))
249 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 242 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
@@ -273,14 +266,14 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
273 needs to be mapped to virtual space with ioremap() before it 266 needs to be mapped to virtual space with ioremap() before it
274 is used. 267 is used.
275 */ 268 */
276 if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { 269 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
277 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; 270 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
278 memreq_t map; 271 memreq_t map;
279 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 272 req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
280 cfg_mem->req.Base = mem->win[0].host_addr; 273 req->Base = mem->win[0].host_addr;
281 cfg_mem->req.Size = mem->win[0].len; 274 req->Size = mem->win[0].len;
282 cfg_mem->req.AccessSpeed = 0; 275 req->AccessSpeed = 0;
283 if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) 276 if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0)
284 return -ENODEV; 277 return -ENODEV;
285 map.Page = 0; 278 map.Page = 0;
286 map.CardOffset = mem->win[0].card_addr; 279 map.CardOffset = mem->win[0].card_addr;
@@ -295,15 +288,15 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
295static int airo_config(struct pcmcia_device *link) 288static int airo_config(struct pcmcia_device *link)
296{ 289{
297 local_info_t *dev; 290 local_info_t *dev;
298 struct airo_cs_config_data *cfg_mem; 291 win_req_t *req;
299 int last_fn, last_ret; 292 int last_fn, last_ret;
300 293
301 dev = link->priv; 294 dev = link->priv;
302 295
303 DEBUG(0, "airo_config(0x%p)\n", link); 296 DEBUG(0, "airo_config(0x%p)\n", link);
304 297
305 cfg_mem = kzalloc(sizeof(struct airo_cs_config_data), GFP_KERNEL); 298 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
306 if (!cfg_mem) 299 if (!req)
307 return -ENOMEM; 300 return -ENOMEM;
308 301
309 /* 302 /*
@@ -320,7 +313,7 @@ static int airo_config(struct pcmcia_device *link)
320 * and most client drivers will only use the CIS to fill in 313 * and most client drivers will only use the CIS to fill in
321 * implementation-defined details. 314 * implementation-defined details.
322 */ 315 */
323 last_ret = pcmcia_loop_config(link, airo_cs_config_check, cfg_mem); 316 last_ret = pcmcia_loop_config(link, airo_cs_config_check, req);
324 if (last_ret) 317 if (last_ret)
325 goto failed; 318 goto failed;
326 319
@@ -365,17 +358,17 @@ static int airo_config(struct pcmcia_device *link)
365 printk(" & 0x%04x-0x%04x", link->io.BasePort2, 358 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
366 link->io.BasePort2+link->io.NumPorts2-1); 359 link->io.BasePort2+link->io.NumPorts2-1);
367 if (link->win) 360 if (link->win)
368 printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 361 printk(", mem 0x%06lx-0x%06lx", req->Base,
369 cfg_mem->req.Base+cfg_mem->req.Size-1); 362 req->Base+req->Size-1);
370 printk("\n"); 363 printk("\n");
371 kfree(cfg_mem); 364 kfree(req);
372 return 0; 365 return 0;
373 366
374 cs_failed: 367 cs_failed:
375 cs_error(link, last_fn, last_ret); 368 cs_error(link, last_fn, last_ret);
376 failed: 369 failed:
377 airo_release(link); 370 airo_release(link);
378 kfree(cfg_mem); 371 kfree(req);
379 return -ENODEV; 372 return -ENODEV;
380} /* airo_config */ 373} /* airo_config */
381 374
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 12efd44d64a1..c71aae992ecc 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -226,14 +226,12 @@ static int card_present(void *arg)
226 226
227static int atmel_config_check(struct pcmcia_device *p_dev, 227static 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 void *priv_data) 230 void *priv_data)
230{ 231{
231 cistpl_cftable_entry_t *dflt = priv_data;
232
233 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
234 *dflt = *cfg;
235 if (cfg->index == 0) 232 if (cfg->index == 0)
236 return -ENODEV; 233 return -ENODEV;
234
237 /* Does this card need audio output? */ 235 /* Does this card need audio output? */
238 if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 236 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
239 p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 237 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
@@ -278,7 +276,6 @@ static int atmel_config(struct pcmcia_device *link)
278 local_info_t *dev; 276 local_info_t *dev;
279 int last_fn, last_ret; 277 int last_fn, last_ret;
280 struct pcmcia_device_id *did; 278 struct pcmcia_device_id *did;
281 cistpl_cftable_entry_t dflt = { 0 };
282 279
283 dev = link->priv; 280 dev = link->priv;
284 did = handle_to_dev(link).driver_data; 281 did = handle_to_dev(link).driver_data;
@@ -297,7 +294,7 @@ static int atmel_config(struct pcmcia_device *link)
297 these things without consulting the CIS, and most client drivers 294 these things without consulting the CIS, and most client drivers
298 will only use the CIS to fill in implementation-defined details. 295 will only use the CIS to fill in implementation-defined details.
299 */ 296 */
300 if (pcmcia_loop_config(link, atmel_config_check, &dflt)) 297 if (pcmcia_loop_config(link, atmel_config_check, NULL))
301 goto failed; 298 goto failed;
302 299
303 /* 300 /*
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 2abaa90b799d..f9595ca71a06 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -537,23 +537,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
537 * socket and make the device available to the system */ 537 * socket and make the device available to the system */
538 538
539struct prism2_config_data { 539struct prism2_config_data {
540 cistpl_cftable_entry_t dflt;
541 config_info_t conf; 540 config_info_t conf;
542}; 541};
543 542
544static int prism2_config_check(struct pcmcia_device *p_dev, 543static int prism2_config_check(struct pcmcia_device *p_dev,
545 cistpl_cftable_entry_t *cfg, 544 cistpl_cftable_entry_t *cfg,
545 cistpl_cftable_entry_t *dflt,
546 void *priv_data) 546 void *priv_data)
547{ 547{
548 struct prism2_config_data *cfg_mem = priv_data; 548 struct prism2_config_data *cfg_mem = priv_data;
549 549
550 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
551 cfg_mem->dflt = *cfg;
552 if (cfg->index == 0) 550 if (cfg->index == 0)
553 return -ENODEV; 551 return -ENODEV;
554 552
555 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " 553 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
556 "(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index); 554 "(default 0x%02X)\n", cfg->index, dflt->index);
557 555
558 /* Does this card need audio output? */ 556 /* Does this card need audio output? */
559 if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 557 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
@@ -570,8 +568,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
570 " this entry\n"); 568 " this entry\n");
571 return -ENODEV; 569 return -ENODEV;
572 } 570 }
573 } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 571 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
574 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 572 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
575 10000 && !ignore_cis_vcc) { 573 10000 && !ignore_cis_vcc) {
576 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " 574 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
577 "- skipping this entry\n"); 575 "- skipping this entry\n");
@@ -581,11 +579,11 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
581 579
582 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 580 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
583 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 581 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
584 else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 582 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
585 p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 583 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
586 584
587 /* Do we need to allocate an interrupt? */ 585 /* Do we need to allocate an interrupt? */
588 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 586 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
589 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 587 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
590 else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) { 588 else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) {
591 /* At least Compaq WL200 does not have IRQInfo1 set, 589 /* At least Compaq WL200 does not have IRQInfo1 set,
@@ -597,11 +595,11 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
597 595
598 /* IO window settings */ 596 /* IO window settings */
599 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " 597 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
600 "cfg_mem->dflt.io.nwin=%d\n", 598 "dflt->io.nwin=%d\n",
601 cfg->io.nwin, cfg_mem->dflt.io.nwin); 599 cfg->io.nwin, dflt->io.nwin);
602 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 600 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
603 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 601 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
604 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 602 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
605 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 603 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
606 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " 604 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
607 "io.base=0x%04x, len=%d\n", io->flags, 605 "io.base=0x%04x, len=%d\n", io->flags,
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 67a172dfb2db..8a367f96db37 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -165,18 +165,16 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
165 } while (0) 165 } while (0)
166 166
167struct orinoco_cs_config_data { 167struct orinoco_cs_config_data {
168 cistpl_cftable_entry_t dflt;
169 config_info_t conf; 168 config_info_t conf;
170}; 169};
171 170
172static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 171static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
173 cistpl_cftable_entry_t *cfg, 172 cistpl_cftable_entry_t *cfg,
173 cistpl_cftable_entry_t *dflt,
174 void *priv_data) 174 void *priv_data)
175{ 175{
176 struct orinoco_cs_config_data *cfg_mem = priv_data; 176 struct orinoco_cs_config_data *cfg_mem = priv_data;
177 177
178 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
179 cfg_mem->dflt = *cfg;
180 if (cfg->index == 0) 178 if (cfg->index == 0)
181 goto next_entry; 179 goto next_entry;
182 180
@@ -188,9 +186,9 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
188 if (!ignore_cis_vcc) 186 if (!ignore_cis_vcc)
189 goto next_entry; 187 goto next_entry;
190 } 188 }
191 } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 189 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
192 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { 190 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
193 DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->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);
194 if (!ignore_cis_vcc) 192 if (!ignore_cis_vcc)
195 goto next_entry; 193 goto next_entry;
196 } 194 }
@@ -199,17 +197,17 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
199 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 197 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
200 p_dev->conf.Vpp = 198 p_dev->conf.Vpp =
201 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 199 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
202 else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 200 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
203 p_dev->conf.Vpp = 201 p_dev->conf.Vpp =
204 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 202 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
205 203
206 /* Do we need to allocate an interrupt? */ 204 /* Do we need to allocate an interrupt? */
207 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 205 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
208 206
209 /* IO window settings */ 207 /* IO window settings */
210 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 208 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
211 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 209 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
212 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 210 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
213 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 211 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
214 if (!(io->flags & CISTPL_IO_8BIT)) 212 if (!(io->flags & CISTPL_IO_8BIT))
215 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 213 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 7536aa91dad7..e28878dfaba3 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -634,18 +634,16 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
634 */ 634 */
635 635
636struct spectrum_cs_config_data { 636struct spectrum_cs_config_data {
637 cistpl_cftable_entry_t dflt;
638 config_info_t conf; 637 config_info_t conf;
639}; 638};
640 639
641static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 640static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
642 cistpl_cftable_entry_t *cfg, 641 cistpl_cftable_entry_t *cfg,
642 cistpl_cftable_entry_t *dflt,
643 void *priv_data) 643 void *priv_data)
644{ 644{
645 struct spectrum_cs_config_data *cfg_mem = priv_data; 645 struct spectrum_cs_config_data *cfg_mem = priv_data;
646 646
647 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
648 cfg_mem->dflt = *cfg;
649 if (cfg->index == 0) 647 if (cfg->index == 0)
650 goto next_entry; 648 goto next_entry;
651 649
@@ -657,9 +655,9 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
657 if (!ignore_cis_vcc) 655 if (!ignore_cis_vcc)
658 goto next_entry; 656 goto next_entry;
659 } 657 }
660 } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 658 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
661 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { 659 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
662 DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->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);
663 if (!ignore_cis_vcc) 661 if (!ignore_cis_vcc)
664 goto next_entry; 662 goto next_entry;
665 } 663 }
@@ -668,17 +666,17 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
668 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 666 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
669 p_dev->conf.Vpp = 667 p_dev->conf.Vpp =
670 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 668 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
671 else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 669 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
672 p_dev->conf.Vpp = 670 p_dev->conf.Vpp =
673 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 671 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
674 672
675 /* Do we need to allocate an interrupt? */ 673 /* Do we need to allocate an interrupt? */
676 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 674 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
677 675
678 /* IO window settings */ 676 /* IO window settings */
679 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 677 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
680 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 678 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
681 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 679 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
682 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 680 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
683 if (!(io->flags & CISTPL_IO_8BIT)) 681 if (!(io->flags & CISTPL_IO_8BIT))
684 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 682 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;