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.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index f10d97bc45f0..405b7baa8bc3 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -63,8 +63,8 @@ struct orinoco_pccard {
63/* Function prototypes */ 63/* Function prototypes */
64/********************************************************************/ 64/********************************************************************/
65 65
66static void orinoco_cs_config(dev_link_t *link); 66static void orinoco_cs_config(struct pcmcia_device *link);
67static void orinoco_cs_release(dev_link_t *link); 67static void orinoco_cs_release(struct pcmcia_device *link);
68static void orinoco_cs_detach(struct pcmcia_device *p_dev); 68static void orinoco_cs_detach(struct pcmcia_device *p_dev);
69 69
70/********************************************************************/ 70/********************************************************************/
@@ -75,13 +75,13 @@ static int
75orinoco_cs_hard_reset(struct orinoco_private *priv) 75orinoco_cs_hard_reset(struct orinoco_private *priv)
76{ 76{
77 struct orinoco_pccard *card = priv->card; 77 struct orinoco_pccard *card = priv->card;
78 dev_link_t *link = card->p_dev; 78 struct pcmcia_device *link = card->p_dev;
79 int err; 79 int err;
80 80
81 /* We need atomic ops here, because we're not holding the lock */ 81 /* We need atomic ops here, because we're not holding the lock */
82 set_bit(0, &card->hard_reset_in_progress); 82 set_bit(0, &card->hard_reset_in_progress);
83 83
84 err = pcmcia_reset_card(link->handle, NULL); 84 err = pcmcia_reset_card(link, NULL);
85 if (err) 85 if (err)
86 return err; 86 return err;
87 87
@@ -104,12 +104,11 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
104 * configure the card at this point -- we wait until we receive a card 104 * configure the card at this point -- we wait until we receive a card
105 * insertion event. */ 105 * insertion event. */
106static int 106static int
107orinoco_cs_attach(struct pcmcia_device *p_dev) 107orinoco_cs_attach(struct pcmcia_device *link)
108{ 108{
109 struct net_device *dev; 109 struct net_device *dev;
110 struct orinoco_private *priv; 110 struct orinoco_private *priv;
111 struct orinoco_pccard *card; 111 struct orinoco_pccard *card;
112 dev_link_t *link = dev_to_instance(p_dev);
113 112
114 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); 113 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset);
115 if (! dev) 114 if (! dev)
@@ -118,7 +117,7 @@ orinoco_cs_attach(struct pcmcia_device *p_dev)
118 card = priv->card; 117 card = priv->card;
119 118
120 /* Link both structures together */ 119 /* Link both structures together */
121 card->p_dev = p_dev; 120 card->p_dev = link;
122 link->priv = dev; 121 link->priv = dev;
123 122
124 /* Interrupt setup */ 123 /* Interrupt setup */
@@ -147,9 +146,8 @@ orinoco_cs_attach(struct pcmcia_device *p_dev)
147 * are freed. Otherwise, the structures will be freed when the device 146 * are freed. Otherwise, the structures will be freed when the device
148 * is released. 147 * is released.
149 */ 148 */
150static void orinoco_cs_detach(struct pcmcia_device *p_dev) 149static void orinoco_cs_detach(struct pcmcia_device *link)
151{ 150{
152 dev_link_t *link = dev_to_instance(p_dev);
153 struct net_device *dev = link->priv; 151 struct net_device *dev = link->priv;
154 152
155 if (link->state & DEV_CONFIG) 153 if (link->state & DEV_CONFIG)
@@ -175,10 +173,9 @@ static void orinoco_cs_detach(struct pcmcia_device *p_dev)
175 } while (0) 173 } while (0)
176 174
177static void 175static void
178orinoco_cs_config(dev_link_t *link) 176orinoco_cs_config(struct pcmcia_device *link)
179{ 177{
180 struct net_device *dev = link->priv; 178 struct net_device *dev = link->priv;
181 client_handle_t handle = link->handle;
182 struct orinoco_private *priv = netdev_priv(dev); 179 struct orinoco_private *priv = netdev_priv(dev);
183 struct orinoco_pccard *card = priv->card; 180 struct orinoco_pccard *card = priv->card;
184 hermes_t *hw = &priv->hw; 181 hermes_t *hw = &priv->hw;
@@ -190,7 +187,7 @@ orinoco_cs_config(dev_link_t *link)
190 cisparse_t parse; 187 cisparse_t parse;
191 void __iomem *mem; 188 void __iomem *mem;
192 189
193 CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info)); 190 CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info));
194 191
195 /* 192 /*
196 * This reads the card's CONFIG tuple to find its 193 * This reads the card's CONFIG tuple to find its
@@ -201,9 +198,9 @@ orinoco_cs_config(dev_link_t *link)
201 tuple.TupleData = buf; 198 tuple.TupleData = buf;
202 tuple.TupleDataMax = sizeof(buf); 199 tuple.TupleDataMax = sizeof(buf);
203 tuple.TupleOffset = 0; 200 tuple.TupleOffset = 0;
204 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 201 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
205 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 202 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
206 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 203 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
207 link->conf.ConfigBase = parse.config.base; 204 link->conf.ConfigBase = parse.config.base;
208 link->conf.Present = parse.config.rmask[0]; 205 link->conf.Present = parse.config.rmask[0];
209 206
@@ -212,7 +209,7 @@ orinoco_cs_config(dev_link_t *link)
212 209
213 /* Look up the current Vcc */ 210 /* Look up the current Vcc */
214 CS_CHECK(GetConfigurationInfo, 211 CS_CHECK(GetConfigurationInfo,
215 pcmcia_get_configuration_info(link->handle, &conf)); 212 pcmcia_get_configuration_info(link, &conf));
216 213
217 /* 214 /*
218 * In this loop, we scan the CIS for configuration table 215 * In this loop, we scan the CIS for configuration table
@@ -229,13 +226,13 @@ orinoco_cs_config(dev_link_t *link)
229 * implementation-defined details. 226 * implementation-defined details.
230 */ 227 */
231 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 228 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
232 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 229 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
233 while (1) { 230 while (1) {
234 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 231 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
235 cistpl_cftable_entry_t dflt = { .index = 0 }; 232 cistpl_cftable_entry_t dflt = { .index = 0 };
236 233
237 if ( (pcmcia_get_tuple_data(handle, &tuple) != 0) 234 if ( (pcmcia_get_tuple_data(link, &tuple) != 0)
238 || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0)) 235 || (pcmcia_parse_tuple(link, &tuple, &parse) != 0))
239 goto next_entry; 236 goto next_entry;
240 237
241 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 238 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
@@ -300,7 +297,7 @@ orinoco_cs_config(dev_link_t *link)
300 } 297 }
301 298
302 /* This reserves IO space but doesn't actually enable it */ 299 /* This reserves IO space but doesn't actually enable it */
303 if (pcmcia_request_io(link->handle, &link->io) != 0) 300 if (pcmcia_request_io(link, &link->io) != 0)
304 goto next_entry; 301 goto next_entry;
305 } 302 }
306 303
@@ -310,8 +307,8 @@ orinoco_cs_config(dev_link_t *link)
310 break; 307 break;
311 308
312 next_entry: 309 next_entry:
313 pcmcia_disable_device(handle); 310 pcmcia_disable_device(link);
314 last_ret = pcmcia_get_next_tuple(handle, &tuple); 311 last_ret = pcmcia_get_next_tuple(link, &tuple);
315 if (last_ret == CS_NO_MORE_ITEMS) { 312 if (last_ret == CS_NO_MORE_ITEMS) {
316 printk(KERN_ERR PFX "GetNextTuple(): No matching " 313 printk(KERN_ERR PFX "GetNextTuple(): No matching "
317 "CIS configuration. Maybe you need the " 314 "CIS configuration. Maybe you need the "
@@ -325,7 +322,7 @@ orinoco_cs_config(dev_link_t *link)
325 * a handler to the interrupt, unless the 'Handler' member of 322 * a handler to the interrupt, unless the 'Handler' member of
326 * the irq structure is initialized. 323 * the irq structure is initialized.
327 */ 324 */
328 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 325 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
329 326
330 /* We initialize the hermes structure before completing PCMCIA 327 /* We initialize the hermes structure before completing PCMCIA
331 * configuration just in case the interrupt handler gets 328 * configuration just in case the interrupt handler gets
@@ -342,7 +339,7 @@ orinoco_cs_config(dev_link_t *link)
342 * card and host interface into "Memory and IO" mode. 339 * card and host interface into "Memory and IO" mode.
343 */ 340 */
344 CS_CHECK(RequestConfiguration, 341 CS_CHECK(RequestConfiguration,
345 pcmcia_request_configuration(link->handle, &link->conf)); 342 pcmcia_request_configuration(link, &link->conf));
346 343
347 /* Ok, we have the configuration, prepare to register the netdev */ 344 /* Ok, we have the configuration, prepare to register the netdev */
348 dev->base_addr = link->io.BasePort1; 345 dev->base_addr = link->io.BasePort1;
@@ -350,7 +347,7 @@ orinoco_cs_config(dev_link_t *link)
350 SET_MODULE_OWNER(dev); 347 SET_MODULE_OWNER(dev);
351 card->node.major = card->node.minor = 0; 348 card->node.major = card->node.minor = 0;
352 349
353 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 350 SET_NETDEV_DEV(dev, &handle_to_dev(link));
354 /* Tell the stack we exist */ 351 /* Tell the stack we exist */
355 if (register_netdev(dev) != 0) { 352 if (register_netdev(dev) != 0) {
356 printk(KERN_ERR PFX "register_netdev() failed\n"); 353 printk(KERN_ERR PFX "register_netdev() failed\n");
@@ -383,7 +380,7 @@ orinoco_cs_config(dev_link_t *link)
383 return; 380 return;
384 381
385 cs_failed: 382 cs_failed:
386 cs_error(link->handle, last_fn, last_ret); 383 cs_error(link, last_fn, last_ret);
387 384
388 failed: 385 failed:
389 orinoco_cs_release(link); 386 orinoco_cs_release(link);
@@ -395,7 +392,7 @@ orinoco_cs_config(dev_link_t *link)
395 * still open, this will be postponed until it is closed. 392 * still open, this will be postponed until it is closed.
396 */ 393 */
397static void 394static void
398orinoco_cs_release(dev_link_t *link) 395orinoco_cs_release(struct pcmcia_device *link)
399{ 396{
400 struct net_device *dev = link->priv; 397 struct net_device *dev = link->priv;
401 struct orinoco_private *priv = netdev_priv(dev); 398 struct orinoco_private *priv = netdev_priv(dev);
@@ -407,14 +404,13 @@ orinoco_cs_release(dev_link_t *link)
407 priv->hw_unavailable++; 404 priv->hw_unavailable++;
408 spin_unlock_irqrestore(&priv->lock, flags); 405 spin_unlock_irqrestore(&priv->lock, flags);
409 406
410 pcmcia_disable_device(link->handle); 407 pcmcia_disable_device(link);
411 if (priv->hw.iobase) 408 if (priv->hw.iobase)
412 ioport_unmap(priv->hw.iobase); 409 ioport_unmap(priv->hw.iobase);
413} /* orinoco_cs_release */ 410} /* orinoco_cs_release */
414 411
415static int orinoco_cs_suspend(struct pcmcia_device *p_dev) 412static int orinoco_cs_suspend(struct pcmcia_device *link)
416{ 413{
417 dev_link_t *link = dev_to_instance(p_dev);
418 struct net_device *dev = link->priv; 414 struct net_device *dev = link->priv;
419 struct orinoco_private *priv = netdev_priv(dev); 415 struct orinoco_private *priv = netdev_priv(dev);
420 struct orinoco_pccard *card = priv->card; 416 struct orinoco_pccard *card = priv->card;
@@ -443,9 +439,8 @@ static int orinoco_cs_suspend(struct pcmcia_device *p_dev)
443 return 0; 439 return 0;
444} 440}
445 441
446static int orinoco_cs_resume(struct pcmcia_device *p_dev) 442static int orinoco_cs_resume(struct pcmcia_device *link)
447{ 443{
448 dev_link_t *link = dev_to_instance(p_dev);
449 struct net_device *dev = link->priv; 444 struct net_device *dev = link->priv;
450 struct orinoco_private *priv = netdev_priv(dev); 445 struct orinoco_private *priv = netdev_priv(dev);
451 struct orinoco_pccard *card = priv->card; 446 struct orinoco_pccard *card = priv->card;