aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless
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
parent8e2fc39ddea7fe8c6798837da282db88a09af793 (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')
-rw-r--r--drivers/net/wireless/airo_cs.c1
-rw-r--r--drivers/net/wireless/atmel_cs.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c23
-rw-r--r--drivers/net/wireless/orinoco_cs.c28
-rw-r--r--drivers/net/wireless/spectrum_cs.c28
5 files changed, 18 insertions, 63 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 657adf85ab7..fac1526e49a 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -209,6 +209,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int airo_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
+ unsigned int vcc,
void *priv_data)
{
win_req_t *req = priv_data;
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index c71aae992ec..4830d51900a 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -227,6 +227,7 @@ static int card_present(void *arg)
static int atmel_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
+ unsigned int vcc,
void *priv_data)
{
if (cfg->index == 0)
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index f9595ca71a0..c768d42d517 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)
/* run after a CARD_INSERTION event is received to configure the PCMCIA
* socket and make the device available to the system */
-struct prism2_config_data {
- config_info_t conf;
-};
-
static int prism2_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
cistpl_cftable_entry_t *dflt,
+ unsigned int vcc,
void *priv_data)
{
- struct prism2_config_data *cfg_mem = priv_data;
-
if (cfg->index == 0)
return -ENODEV;
@@ -562,14 +557,14 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
/* 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] /
+ if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
10000 && !ignore_cis_vcc) {
PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
" this entry\n");
return -ENODEV;
}
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
- if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
+ if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
10000 && !ignore_cis_vcc) {
PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
"- skipping this entry\n");
@@ -627,7 +622,6 @@ static int prism2_config(struct pcmcia_device *link)
{
struct net_device *dev;
struct hostap_interface *iface;
- struct prism2_config_data *cfg_mem;
local_info_t *local;
int ret = 1;
int last_fn, last_ret;
@@ -635,21 +629,14 @@ static int prism2_config(struct pcmcia_device *link)
PDEBUG(DEBUG_FLOW, "prism2_config()\n");
- cfg_mem = kzalloc(sizeof(struct prism2_config_data), GFP_KERNEL);
- if (!cfg_mem)
- return -ENOMEM;
-
hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
if (hw_priv == NULL) {
ret = -ENOMEM;
goto failed;
}
- CS_CHECK(GetConfigurationInfo,
- pcmcia_get_configuration_info(link, &cfg_mem->conf));
-
/* Look for an appropriate configuration table entry in the CIS */
- last_ret = pcmcia_loop_config(link, prism2_config_check, cfg_mem);
+ last_ret = pcmcia_loop_config(link, prism2_config_check, NULL);
if (last_ret) {
if (!ignore_cis_vcc)
printk(KERN_ERR "GetNextTuple(): No matching "
@@ -724,7 +711,6 @@ static int prism2_config(struct pcmcia_device *link)
if (ret == 0 && local->ddev)
strcpy(hw_priv->node.dev_name, local->ddev->name);
}
- kfree(cfg_mem);
return ret;
cs_failed:
@@ -732,7 +718,6 @@ static int prism2_config(struct pcmcia_device *link)
failed:
kfree(hw_priv);
- kfree(cfg_mem);
prism2_release((u_long)link);
return ret;
}
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 8a367f96db3..c7b57d9d499 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -164,31 +164,26 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
} while (0)
-struct orinoco_cs_config_data {
- config_info_t conf;
-};
-
static int orinoco_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 orinoco_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;
}
@@ -236,7 +231,6 @@ next_entry:
static int
orinoco_cs_config(struct pcmcia_device *link)
{
- struct orinoco_cs_config_data *cfg_mem;
struct net_device *dev = link->priv;
struct orinoco_private *priv = netdev_priv(dev);
struct orinoco_pccard *card = priv->card;
@@ -244,14 +238,6 @@ orinoco_cs_config(struct pcmcia_device *link)
int last_fn, last_ret;
void __iomem *mem;
- cfg_mem = kzalloc(sizeof(struct orinoco_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
@@ -266,7 +252,7 @@ orinoco_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, orinoco_cs_config_check, cfg_mem);
+ last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
if (last_ret) {
if (!ignore_cis_vcc)
printk(KERN_ERR PFX "GetNextTuple(): No matching "
@@ -324,7 +310,6 @@ orinoco_cs_config(struct pcmcia_device *link)
"0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
link->irq.AssignedIRQ, link->io.BasePort1,
link->io.BasePort1 + link->io.NumPorts1 - 1);
- kfree(cfg_mem);
return 0;
cs_failed:
@@ -332,7 +317,6 @@ orinoco_cs_config(struct pcmcia_device *link)
failed:
orinoco_cs_release(link);
- kfree(cfg_mem);
return -ENODEV;
} /* orinoco_cs_config */
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index e28878dfaba..d7e9d9c3042 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 */