aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/orinoco_cs.c')
-rw-r--r--drivers/net/wireless/orinoco_cs.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 8a367f96db37..c7b57d9d499d 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)
164 last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ 164 last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
165 } while (0) 165 } while (0)
166 166
167struct orinoco_cs_config_data {
168 config_info_t conf;
169};
170
171static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 167static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
172 cistpl_cftable_entry_t *cfg, 168 cistpl_cftable_entry_t *cfg,
173 cistpl_cftable_entry_t *dflt, 169 cistpl_cftable_entry_t *dflt,
170 unsigned int vcc,
174 void *priv_data) 171 void *priv_data)
175{ 172{
176 struct orinoco_cs_config_data *cfg_mem = priv_data;
177
178 if (cfg->index == 0) 173 if (cfg->index == 0)
179 goto next_entry; 174 goto next_entry;
180 175
181 /* Use power settings for Vcc and Vpp if present */ 176 /* Use power settings for Vcc and Vpp if present */
182 /* Note that the CIS values need to be rescaled */ 177 /* Note that the CIS values need to be rescaled */
183 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 178 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
184 if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { 179 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
185 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); 180 DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
186 if (!ignore_cis_vcc) 181 if (!ignore_cis_vcc)
187 goto next_entry; 182 goto next_entry;
188 } 183 }
189 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 184 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
190 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { 185 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
191 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); 186 DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
192 if (!ignore_cis_vcc) 187 if (!ignore_cis_vcc)
193 goto next_entry; 188 goto next_entry;
194 } 189 }
@@ -236,7 +231,6 @@ next_entry:
236static int 231static int
237orinoco_cs_config(struct pcmcia_device *link) 232orinoco_cs_config(struct pcmcia_device *link)
238{ 233{
239 struct orinoco_cs_config_data *cfg_mem;
240 struct net_device *dev = link->priv; 234 struct net_device *dev = link->priv;
241 struct orinoco_private *priv = netdev_priv(dev); 235 struct orinoco_private *priv = netdev_priv(dev);
242 struct orinoco_pccard *card = priv->card; 236 struct orinoco_pccard *card = priv->card;
@@ -244,14 +238,6 @@ orinoco_cs_config(struct pcmcia_device *link)
244 int last_fn, last_ret; 238 int last_fn, last_ret;
245 void __iomem *mem; 239 void __iomem *mem;
246 240
247 cfg_mem = kzalloc(sizeof(struct orinoco_cs_config_data), GFP_KERNEL);
248 if (!cfg_mem)
249 return -ENOMEM;
250
251 /* Look up the current Vcc */
252 CS_CHECK(GetConfigurationInfo,
253 pcmcia_get_configuration_info(link, &cfg_mem->conf));
254
255 /* 241 /*
256 * In this loop, we scan the CIS for configuration table 242 * In this loop, we scan the CIS for configuration table
257 * entries, each of which describes a valid card 243 * entries, each of which describes a valid card
@@ -266,7 +252,7 @@ orinoco_cs_config(struct pcmcia_device *link)
266 * and most client drivers will only use the CIS to fill in 252 * and most client drivers will only use the CIS to fill in
267 * implementation-defined details. 253 * implementation-defined details.
268 */ 254 */
269 last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, cfg_mem); 255 last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
270 if (last_ret) { 256 if (last_ret) {
271 if (!ignore_cis_vcc) 257 if (!ignore_cis_vcc)
272 printk(KERN_ERR PFX "GetNextTuple(): No matching " 258 printk(KERN_ERR PFX "GetNextTuple(): No matching "
@@ -324,7 +310,6 @@ orinoco_cs_config(struct pcmcia_device *link)
324 "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id, 310 "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
325 link->irq.AssignedIRQ, link->io.BasePort1, 311 link->irq.AssignedIRQ, link->io.BasePort1,
326 link->io.BasePort1 + link->io.NumPorts1 - 1); 312 link->io.BasePort1 + link->io.NumPorts1 - 1);
327 kfree(cfg_mem);
328 return 0; 313 return 0;
329 314
330 cs_failed: 315 cs_failed:
@@ -332,7 +317,6 @@ orinoco_cs_config(struct pcmcia_device *link)
332 317
333 failed: 318 failed:
334 orinoco_cs_release(link); 319 orinoco_cs_release(link);
335 kfree(cfg_mem);
336 return -ENODEV; 320 return -ENODEV;
337} /* orinoco_cs_config */ 321} /* orinoco_cs_config */
338 322