aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/spectrum_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r--drivers/net/wireless/spectrum_cs.c28
1 files changed, 6 insertions, 22 deletions
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
636struct spectrum_cs_config_data {
637 config_info_t conf;
638};
639
640static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 636static 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:
705static int 700static int
706spectrum_cs_config(struct pcmcia_device *link) 701spectrum_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