aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/spectrum_cs.c
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/wireless/spectrum_cs.c
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/wireless/spectrum_cs.c')
-rw-r--r--drivers/net/wireless/spectrum_cs.c18
1 files changed, 8 insertions, 10 deletions
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;