diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-02 09:30:31 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-22 19:22:00 -0400 |
commit | 8e2fc39ddea7fe8c6798837da282db88a09af793 (patch) | |
tree | 7cba37b5b86f4ff25562012a14e29424e3872de0 /drivers/net/wireless/hostap/hostap_cs.c | |
parent | 498ac1899b62626bf6879a251d75c22ec564c559 (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/wireless/hostap/hostap_cs.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 24 |
1 files changed, 11 insertions, 13 deletions
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 | ||
539 | struct prism2_config_data { | 539 | struct prism2_config_data { |
540 | cistpl_cftable_entry_t dflt; | ||
541 | config_info_t conf; | 540 | config_info_t conf; |
542 | }; | 541 | }; |
543 | 542 | ||
544 | static int prism2_config_check(struct pcmcia_device *p_dev, | 543 | static 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, |