aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/airo_cs.c')
-rw-r--r--drivers/net/wireless/airo_cs.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 836c71ff7762..76970197f98f 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -80,8 +80,8 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
80 event handler. 80 event handler.
81*/ 81*/
82 82
83static void airo_config(dev_link_t *link); 83static void airo_config(struct pcmcia_device *link);
84static void airo_release(dev_link_t *link); 84static void airo_release(struct pcmcia_device *link);
85 85
86/* 86/*
87 The attach() and detach() entry points are used to create and destroy 87 The attach() and detach() entry points are used to create and destroy
@@ -101,10 +101,10 @@ static void airo_detach(struct pcmcia_device *p_dev);
101/* 101/*
102 A linked list of "instances" of the aironet device. Each actual 102 A linked list of "instances" of the aironet device. Each actual
103 PCMCIA card corresponds to one device instance, and is described 103 PCMCIA card corresponds to one device instance, and is described
104 by one dev_link_t structure (defined in ds.h). 104 by one struct pcmcia_device structure (defined in ds.h).
105 105
106 You may not want to use a linked list for this -- for example, the 106 You may not want to use a linked list for this -- for example, the
107 memory card driver uses an array of dev_link_t pointers, where minor 107 memory card driver uses an array of struct pcmcia_device pointers, where minor
108 device numbers are used to derive the corresponding array index. 108 device numbers are used to derive the corresponding array index.
109*/ 109*/
110 110
@@ -114,7 +114,7 @@ static void airo_detach(struct pcmcia_device *p_dev);
114 example, ethernet cards, modems). In other cases, there may be 114 example, ethernet cards, modems). In other cases, there may be
115 many actual or logical devices (SCSI adapters, memory cards with 115 many actual or logical devices (SCSI adapters, memory cards with
116 multiple partitions). The dev_node_t structures need to be kept 116 multiple partitions). The dev_node_t structures need to be kept
117 in a linked list starting at the 'dev' field of a dev_link_t 117 in a linked list starting at the 'dev' field of a struct pcmcia_device
118 structure. We allocate them in the card's private data structure, 118 structure. We allocate them in the card's private data structure,
119 because they generally shouldn't be allocated dynamically. 119 because they generally shouldn't be allocated dynamically.
120 120
@@ -185,10 +185,8 @@ static int airo_attach(struct pcmcia_device *p_dev)
185 185
186 ======================================================================*/ 186 ======================================================================*/
187 187
188static void airo_detach(struct pcmcia_device *p_dev) 188static void airo_detach(struct pcmcia_device *link)
189{ 189{
190 dev_link_t *link = dev_to_instance(p_dev);
191
192 DEBUG(0, "airo_detach(0x%p)\n", link); 190 DEBUG(0, "airo_detach(0x%p)\n", link);
193 191
194 if (link->state & DEV_CONFIG) 192 if (link->state & DEV_CONFIG)
@@ -213,9 +211,8 @@ static void airo_detach(struct pcmcia_device *p_dev)
213#define CS_CHECK(fn, ret) \ 211#define CS_CHECK(fn, ret) \
214do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 212do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
215 213
216static void airo_config(dev_link_t *link) 214static void airo_config(struct pcmcia_device *link)
217{ 215{
218 client_handle_t handle;
219 tuple_t tuple; 216 tuple_t tuple;
220 cisparse_t parse; 217 cisparse_t parse;
221 local_info_t *dev; 218 local_info_t *dev;
@@ -223,8 +220,7 @@ static void airo_config(dev_link_t *link)
223 u_char buf[64]; 220 u_char buf[64];
224 win_req_t req; 221 win_req_t req;
225 memreq_t map; 222 memreq_t map;
226 223
227 handle = link->handle;
228 dev = link->priv; 224 dev = link->priv;
229 225
230 DEBUG(0, "airo_config(0x%p)\n", link); 226 DEBUG(0, "airo_config(0x%p)\n", link);
@@ -238,9 +234,9 @@ static void airo_config(dev_link_t *link)
238 tuple.TupleData = buf; 234 tuple.TupleData = buf;
239 tuple.TupleDataMax = sizeof(buf); 235 tuple.TupleDataMax = sizeof(buf);
240 tuple.TupleOffset = 0; 236 tuple.TupleOffset = 0;
241 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 237 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
242 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 238 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
243 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 239 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
244 link->conf.ConfigBase = parse.config.base; 240 link->conf.ConfigBase = parse.config.base;
245 link->conf.Present = parse.config.rmask[0]; 241 link->conf.Present = parse.config.rmask[0];
246 242
@@ -260,12 +256,12 @@ static void airo_config(dev_link_t *link)
260 will only use the CIS to fill in implementation-defined details. 256 will only use the CIS to fill in implementation-defined details.
261 */ 257 */
262 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 258 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
263 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 259 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
264 while (1) { 260 while (1) {
265 cistpl_cftable_entry_t dflt = { 0 }; 261 cistpl_cftable_entry_t dflt = { 0 };
266 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 262 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
267 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 263 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
268 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 264 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
269 goto next_entry; 265 goto next_entry;
270 266
271 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 267 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
@@ -310,12 +306,12 @@ static void airo_config(dev_link_t *link)
310 } 306 }
311 307
312 /* This reserves IO space but doesn't actually enable it */ 308 /* This reserves IO space but doesn't actually enable it */
313 if (pcmcia_request_io(link->handle, &link->io) != 0) 309 if (pcmcia_request_io(link, &link->io) != 0)
314 goto next_entry; 310 goto next_entry;
315 311
316 /* 312 /*
317 Now set up a common memory window, if needed. There is room 313 Now set up a common memory window, if needed. There is room
318 in the dev_link_t structure for one memory window handle, 314 in the struct pcmcia_device structure for one memory window handle,
319 but if the base addresses need to be saved, or if multiple 315 but if the base addresses need to be saved, or if multiple
320 windows are needed, the info should go in the private data 316 windows are needed, the info should go in the private data
321 structure for this device. 317 structure for this device.
@@ -331,7 +327,7 @@ static void airo_config(dev_link_t *link)
331 req.Base = mem->win[0].host_addr; 327 req.Base = mem->win[0].host_addr;
332 req.Size = mem->win[0].len; 328 req.Size = mem->win[0].len;
333 req.AccessSpeed = 0; 329 req.AccessSpeed = 0;
334 if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) 330 if (pcmcia_request_window(&link, &req, &link->win) != 0)
335 goto next_entry; 331 goto next_entry;
336 map.Page = 0; map.CardOffset = mem->win[0].card_addr; 332 map.Page = 0; map.CardOffset = mem->win[0].card_addr;
337 if (pcmcia_map_mem_page(link->win, &map) != 0) 333 if (pcmcia_map_mem_page(link->win, &map) != 0)
@@ -341,7 +337,7 @@ static void airo_config(dev_link_t *link)
341 break; 337 break;
342 338
343 next_entry: 339 next_entry:
344 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 340 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
345 } 341 }
346 342
347 /* 343 /*
@@ -350,17 +346,17 @@ static void airo_config(dev_link_t *link)
350 irq structure is initialized. 346 irq structure is initialized.
351 */ 347 */
352 if (link->conf.Attributes & CONF_ENABLE_IRQ) 348 if (link->conf.Attributes & CONF_ENABLE_IRQ)
353 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 349 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
354 350
355 /* 351 /*
356 This actually configures the PCMCIA socket -- setting up 352 This actually configures the PCMCIA socket -- setting up
357 the I/O windows and the interrupt mapping, and putting the 353 the I/O windows and the interrupt mapping, and putting the
358 card and host interface into "Memory and IO" mode. 354 card and host interface into "Memory and IO" mode.
359 */ 355 */
360 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 356 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
361 ((local_info_t*)link->priv)->eth_dev = 357 ((local_info_t*)link->priv)->eth_dev =
362 init_airo_card( link->irq.AssignedIRQ, 358 init_airo_card( link->irq.AssignedIRQ,
363 link->io.BasePort1, 1, &handle_to_dev(handle) ); 359 link->io.BasePort1, 1, &handle_to_dev(link) );
364 if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed; 360 if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed;
365 361
366 /* 362 /*
@@ -393,7 +389,7 @@ static void airo_config(dev_link_t *link)
393 return; 389 return;
394 390
395 cs_failed: 391 cs_failed:
396 cs_error(link->handle, last_fn, last_ret); 392 cs_error(link, last_fn, last_ret);
397 airo_release(link); 393 airo_release(link);
398 394
399} /* airo_config */ 395} /* airo_config */
@@ -406,15 +402,14 @@ static void airo_config(dev_link_t *link)
406 402
407 ======================================================================*/ 403 ======================================================================*/
408 404
409static void airo_release(dev_link_t *link) 405static void airo_release(struct pcmcia_device *link)
410{ 406{
411 DEBUG(0, "airo_release(0x%p)\n", link); 407 DEBUG(0, "airo_release(0x%p)\n", link);
412 pcmcia_disable_device(link->handle); 408 pcmcia_disable_device(link);
413} 409}
414 410
415static int airo_suspend(struct pcmcia_device *p_dev) 411static int airo_suspend(struct pcmcia_device *link)
416{ 412{
417 dev_link_t *link = dev_to_instance(p_dev);
418 local_info_t *local = link->priv; 413 local_info_t *local = link->priv;
419 414
420 if (link->state & DEV_CONFIG) 415 if (link->state & DEV_CONFIG)
@@ -423,9 +418,8 @@ static int airo_suspend(struct pcmcia_device *p_dev)
423 return 0; 418 return 0;
424} 419}
425 420
426static int airo_resume(struct pcmcia_device *p_dev) 421static int airo_resume(struct pcmcia_device *link)
427{ 422{
428 dev_link_t *link = dev_to_instance(p_dev);
429 local_info_t *local = link->priv; 423 local_info_t *local = link->priv;
430 424
431 if ((link->state & DEV_CONFIG) && (link->open)) { 425 if ((link->state & DEV_CONFIG) && (link->open)) {