diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-30 03:51:52 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-09-29 11:20:23 -0400 |
commit | 440eed43e2a95bb842488755683716814da10f2b (patch) | |
tree | 45c49181a077f845cd366cfa7dc07f259fd01078 /drivers/net/wireless/hostap | |
parent | 9485ee14e143c7076e88deea1e87ca3eb0b2f94e (diff) |
pcmcia: introduce autoconfiguration feature
Introduce an autoconfiguration feature to set certain values in
pcmcia_loop_config(), instead of copying the same code over and over
in each PCMCIA driver. At first, introduce the following options:
CONF_AUTO_CHECK_VCC check or matching Vcc entry
CONF_AUTO_SET_VPP set Vpp
CONF_AUTO_AUDIO enable the speaker line
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
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 | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 5b0b5828b3cf..d4f19af1757f 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -472,7 +472,6 @@ static void prism2_detach(struct pcmcia_device *link) | |||
472 | static int prism2_config_check(struct pcmcia_device *p_dev, | 472 | static int prism2_config_check(struct pcmcia_device *p_dev, |
473 | cistpl_cftable_entry_t *cfg, | 473 | cistpl_cftable_entry_t *cfg, |
474 | cistpl_cftable_entry_t *dflt, | 474 | cistpl_cftable_entry_t *dflt, |
475 | unsigned int vcc, | ||
476 | void *priv_data) | 475 | void *priv_data) |
477 | { | 476 | { |
478 | if (cfg->index == 0) | 477 | if (cfg->index == 0) |
@@ -481,28 +480,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev, | |||
481 | PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " | 480 | PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " |
482 | "(default 0x%02X)\n", cfg->index, dflt->index); | 481 | "(default 0x%02X)\n", cfg->index, dflt->index); |
483 | 482 | ||
484 | /* Does this card need audio output? */ | ||
485 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) | ||
486 | p_dev->config_flags |= CONF_ENABLE_SPKR; | ||
487 | |||
488 | /* Use power settings for Vcc and Vpp if present */ | ||
489 | /* Note that the CIS values need to be rescaled */ | ||
490 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
491 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / | ||
492 | 10000 && !ignore_cis_vcc) { | ||
493 | PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" | ||
494 | " this entry\n"); | ||
495 | return -ENODEV; | ||
496 | } | ||
497 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
498 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / | ||
499 | 10000 && !ignore_cis_vcc) { | ||
500 | PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " | ||
501 | "- skipping this entry\n"); | ||
502 | return -ENODEV; | ||
503 | } | ||
504 | } | ||
505 | |||
506 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 483 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
507 | p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 484 | p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
508 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 485 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
@@ -553,6 +530,10 @@ static int prism2_config(struct pcmcia_device *link) | |||
553 | } | 530 | } |
554 | 531 | ||
555 | /* Look for an appropriate configuration table entry in the CIS */ | 532 | /* Look for an appropriate configuration table entry in the CIS */ |
533 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | | ||
534 | CONF_AUTO_CHECK_VCC; | ||
535 | if (ignore_cis_vcc) | ||
536 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; | ||
556 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); | 537 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); |
557 | if (ret) { | 538 | if (ret) { |
558 | if (!ignore_cis_vcc) | 539 | if (!ignore_cis_vcc) |