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 /drivers/net/wireless/hostap | |
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>
Diffstat (limited to 'drivers/net/wireless/hostap')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 23 |
1 files changed, 4 insertions, 19 deletions
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 | } |