summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/spectrum_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 16:12:00 +0200
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-23 01:22:52 +0200
commitad913c11928f51abb6174f165db8d8d205b22e21 (patch)
treea8542c846afb4950a12f46b16c1eacfa2280971a /drivers/net/wireless/spectrum_cs.c
parent8e2fc39ddea7fe8c6798837da282db88a09af793 (diff)
downloadlinux-next-ad913c11928f51abb6174f165db8d8d205b22e21.tar.gz
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/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)
* device available to the system.
*/
-struct spectrum_cs_config_data {
- config_info_t conf;
-};
-
static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
+ unsigned int vcc,
void *priv_data)
{
- struct spectrum_cs_config_data *cfg_mem = priv_data;
-
if (cfg->index == 0)
goto next_entry;
/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
- 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);
+ if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
+ DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
if (!ignore_cis_vcc)
goto next_entry;
}
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
- 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);
+ if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
+ DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
if (!ignore_cis_vcc)
goto next_entry;
}
@@ -705,7 +700,6 @@ next_entry:
static int
spectrum_cs_config(struct pcmcia_device *link)
{
- struct spectrum_cs_config_data *cfg_mem;
struct net_device *dev = link->priv;
struct orinoco_private *priv = netdev_priv(dev);
struct orinoco_pccard *card = priv->card;
@@ -713,14 +707,6 @@ spectrum_cs_config(struct pcmcia_device *link)
int last_fn, last_ret;
void __iomem *mem;
- cfg_mem = kzalloc(sizeof(struct spectrum_cs_config_data), GFP_KERNEL);
- if (!cfg_mem)
- return -ENOMEM;
-
- /* Look up the current Vcc */
- CS_CHECK(GetConfigurationInfo,
- pcmcia_get_configuration_info(link, &cfg_mem->conf));
-
/*
* In this loop, we scan the CIS for configuration table
* entries, each of which describes a valid card
@@ -735,7 +721,7 @@ spectrum_cs_config(struct pcmcia_device *link)
* and most client drivers will only use the CIS to fill in
* implementation-defined details.
*/
- last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, cfg_mem);
+ last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
if (last_ret) {
if (!ignore_cis_vcc)
printk(KERN_ERR PFX "GetNextTuple(): No matching "
@@ -799,7 +785,6 @@ spectrum_cs_config(struct pcmcia_device *link)
link->irq.AssignedIRQ, link->io.BasePort1,
link->io.BasePort1 + link->io.NumPorts1 - 1);
- kfree(cfg_mem);
return 0;
cs_failed:
@@ -807,7 +792,6 @@ spectrum_cs_config(struct pcmcia_device *link)
failed:
spectrum_cs_release(link);
- kfree(cfg_mem);
return -ENODEV;
} /* spectrum_cs_config */