aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
commitfba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch)
tree5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/net/wireless
parentfd238232cd0ff4840ae6946bb338502154096d88 (diff)
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/airo_cs.c58
-rw-r--r--drivers/net/wireless/atmel_cs.c56
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c82
-rw-r--r--drivers/net/wireless/netwave_cs.c61
-rw-r--r--drivers/net/wireless/orinoco_cs.c59
-rw-r--r--drivers/net/wireless/ray_cs.c92
-rw-r--r--drivers/net/wireless/ray_cs.h2
-rw-r--r--drivers/net/wireless/spectrum_cs.c80
-rw-r--r--drivers/net/wireless/wavelan_cs.c67
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h6
-rw-r--r--drivers/net/wireless/wl3501_cs.c67
11 files changed, 292 insertions, 338 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)) {
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 522bbed47a05..843dd1a036d2 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -91,8 +91,8 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
91 event handler. 91 event handler.
92*/ 92*/
93 93
94static void atmel_config(dev_link_t *link); 94static void atmel_config(struct pcmcia_device *link);
95static void atmel_release(dev_link_t *link); 95static void atmel_release(struct pcmcia_device *link);
96 96
97/* 97/*
98 The attach() and detach() entry points are used to create and destroy 98 The attach() and detach() entry points are used to create and destroy
@@ -112,10 +112,10 @@ static void atmel_detach(struct pcmcia_device *p_dev);
112/* 112/*
113 A linked list of "instances" of the atmelnet device. Each actual 113 A linked list of "instances" of the atmelnet device. Each actual
114 PCMCIA card corresponds to one device instance, and is described 114 PCMCIA card corresponds to one device instance, and is described
115 by one dev_link_t structure (defined in ds.h). 115 by one struct pcmcia_device structure (defined in ds.h).
116 116
117 You may not want to use a linked list for this -- for example, the 117 You may not want to use a linked list for this -- for example, the
118 memory card driver uses an array of dev_link_t pointers, where minor 118 memory card driver uses an array of struct pcmcia_device pointers, where minor
119 device numbers are used to derive the corresponding array index. 119 device numbers are used to derive the corresponding array index.
120*/ 120*/
121 121
@@ -125,7 +125,7 @@ static void atmel_detach(struct pcmcia_device *p_dev);
125 example, ethernet cards, modems). In other cases, there may be 125 example, ethernet cards, modems). In other cases, there may be
126 many actual or logical devices (SCSI adapters, memory cards with 126 many actual or logical devices (SCSI adapters, memory cards with
127 multiple partitions). The dev_node_t structures need to be kept 127 multiple partitions). The dev_node_t structures need to be kept
128 in a linked list starting at the 'dev' field of a dev_link_t 128 in a linked list starting at the 'dev' field of a struct pcmcia_device
129 structure. We allocate them in the card's private data structure, 129 structure. We allocate them in the card's private data structure,
130 because they generally shouldn't be allocated dynamically. 130 because they generally shouldn't be allocated dynamically.
131 131
@@ -196,10 +196,8 @@ static int atmel_attach(struct pcmcia_device *p_dev)
196 196
197 ======================================================================*/ 197 ======================================================================*/
198 198
199static void atmel_detach(struct pcmcia_device *p_dev) 199static void atmel_detach(struct pcmcia_device *link)
200{ 200{
201 dev_link_t *link = dev_to_instance(p_dev);
202
203 DEBUG(0, "atmel_detach(0x%p)\n", link); 201 DEBUG(0, "atmel_detach(0x%p)\n", link);
204 202
205 if (link->state & DEV_CONFIG) 203 if (link->state & DEV_CONFIG)
@@ -223,7 +221,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
223 about the current existance of the card */ 221 about the current existance of the card */
224static int card_present(void *arg) 222static int card_present(void *arg)
225{ 223{
226 dev_link_t *link = (dev_link_t *)arg; 224 struct pcmcia_device *link = (struct pcmcia_device *)arg;
227 if (link->state & DEV_SUSPEND) 225 if (link->state & DEV_SUSPEND)
228 return 0; 226 return 0;
229 else if (link->state & DEV_PRESENT) 227 else if (link->state & DEV_PRESENT)
@@ -232,9 +230,8 @@ static int card_present(void *arg)
232 return 0; 230 return 0;
233} 231}
234 232
235static void atmel_config(dev_link_t *link) 233static void atmel_config(struct pcmcia_device *link)
236{ 234{
237 client_handle_t handle;
238 tuple_t tuple; 235 tuple_t tuple;
239 cisparse_t parse; 236 cisparse_t parse;
240 local_info_t *dev; 237 local_info_t *dev;
@@ -242,9 +239,8 @@ static void atmel_config(dev_link_t *link)
242 u_char buf[64]; 239 u_char buf[64];
243 struct pcmcia_device_id *did; 240 struct pcmcia_device_id *did;
244 241
245 handle = link->handle;
246 dev = link->priv; 242 dev = link->priv;
247 did = handle_to_dev(handle).driver_data; 243 did = handle_to_dev(link).driver_data;
248 244
249 DEBUG(0, "atmel_config(0x%p)\n", link); 245 DEBUG(0, "atmel_config(0x%p)\n", link);
250 246
@@ -258,9 +254,9 @@ static void atmel_config(dev_link_t *link)
258 registers. 254 registers.
259 */ 255 */
260 tuple.DesiredTuple = CISTPL_CONFIG; 256 tuple.DesiredTuple = CISTPL_CONFIG;
261 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 257 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
262 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 258 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
263 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 259 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
264 link->conf.ConfigBase = parse.config.base; 260 link->conf.ConfigBase = parse.config.base;
265 link->conf.Present = parse.config.rmask[0]; 261 link->conf.Present = parse.config.rmask[0];
266 262
@@ -280,12 +276,12 @@ static void atmel_config(dev_link_t *link)
280 will only use the CIS to fill in implementation-defined details. 276 will only use the CIS to fill in implementation-defined details.
281 */ 277 */
282 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 278 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
283 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 279 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
284 while (1) { 280 while (1) {
285 cistpl_cftable_entry_t dflt = { 0 }; 281 cistpl_cftable_entry_t dflt = { 0 };
286 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 282 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
287 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 283 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
288 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 284 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
289 goto next_entry; 285 goto next_entry;
290 286
291 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 287 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
@@ -330,14 +326,14 @@ static void atmel_config(dev_link_t *link)
330 } 326 }
331 327
332 /* This reserves IO space but doesn't actually enable it */ 328 /* This reserves IO space but doesn't actually enable it */
333 if (pcmcia_request_io(link->handle, &link->io) != 0) 329 if (pcmcia_request_io(link, &link->io) != 0)
334 goto next_entry; 330 goto next_entry;
335 331
336 /* If we got this far, we're cool! */ 332 /* If we got this far, we're cool! */
337 break; 333 break;
338 334
339 next_entry: 335 next_entry:
340 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 336 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
341 } 337 }
342 338
343 /* 339 /*
@@ -346,14 +342,14 @@ static void atmel_config(dev_link_t *link)
346 irq structure is initialized. 342 irq structure is initialized.
347 */ 343 */
348 if (link->conf.Attributes & CONF_ENABLE_IRQ) 344 if (link->conf.Attributes & CONF_ENABLE_IRQ)
349 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 345 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
350 346
351 /* 347 /*
352 This actually configures the PCMCIA socket -- setting up 348 This actually configures the PCMCIA socket -- setting up
353 the I/O windows and the interrupt mapping, and putting the 349 the I/O windows and the interrupt mapping, and putting the
354 card and host interface into "Memory and IO" mode. 350 card and host interface into "Memory and IO" mode.
355 */ 351 */
356 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 352 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
357 353
358 if (link->irq.AssignedIRQ == 0) { 354 if (link->irq.AssignedIRQ == 0) {
359 printk(KERN_ALERT 355 printk(KERN_ALERT
@@ -365,7 +361,7 @@ static void atmel_config(dev_link_t *link)
365 init_atmel_card(link->irq.AssignedIRQ, 361 init_atmel_card(link->irq.AssignedIRQ,
366 link->io.BasePort1, 362 link->io.BasePort1,
367 did ? did->driver_info : ATMEL_FW_TYPE_NONE, 363 did ? did->driver_info : ATMEL_FW_TYPE_NONE,
368 &handle_to_dev(handle), 364 &handle_to_dev(link),
369 card_present, 365 card_present,
370 link); 366 link);
371 if (!((local_info_t*)link->priv)->eth_dev) 367 if (!((local_info_t*)link->priv)->eth_dev)
@@ -384,7 +380,7 @@ static void atmel_config(dev_link_t *link)
384 return; 380 return;
385 381
386 cs_failed: 382 cs_failed:
387 cs_error(link->handle, last_fn, last_ret); 383 cs_error(link, last_fn, last_ret);
388 atmel_release(link); 384 atmel_release(link);
389} 385}
390 386
@@ -396,7 +392,7 @@ static void atmel_config(dev_link_t *link)
396 392
397 ======================================================================*/ 393 ======================================================================*/
398 394
399static void atmel_release(dev_link_t *link) 395static void atmel_release(struct pcmcia_device *link)
400{ 396{
401 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; 397 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
402 398
@@ -406,12 +402,11 @@ static void atmel_release(dev_link_t *link)
406 stop_atmel_card(dev); 402 stop_atmel_card(dev);
407 ((local_info_t*)link->priv)->eth_dev = NULL; 403 ((local_info_t*)link->priv)->eth_dev = NULL;
408 404
409 pcmcia_disable_device(link->handle); 405 pcmcia_disable_device(link);
410} 406}
411 407
412static int atmel_suspend(struct pcmcia_device *dev) 408static int atmel_suspend(struct pcmcia_device *link)
413{ 409{
414 dev_link_t *link = dev_to_instance(dev);
415 local_info_t *local = link->priv; 410 local_info_t *local = link->priv;
416 411
417 if (link->state & DEV_CONFIG) 412 if (link->state & DEV_CONFIG)
@@ -420,9 +415,8 @@ static int atmel_suspend(struct pcmcia_device *dev)
420 return 0; 415 return 0;
421} 416}
422 417
423static int atmel_resume(struct pcmcia_device *dev) 418static int atmel_resume(struct pcmcia_device *link)
424{ 419{
425 dev_link_t *link = dev_to_instance(dev);
426 local_info_t *local = link->priv; 420 local_info_t *local = link->priv;
427 421
428 if (link->state & DEV_CONFIG) { 422 if (link->state & DEV_CONFIG) {
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index e3095a88745c..89b178106edf 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -42,7 +42,7 @@ MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
42/* struct local_info::hw_priv */ 42/* struct local_info::hw_priv */
43struct hostap_cs_priv { 43struct hostap_cs_priv {
44 dev_node_t node; 44 dev_node_t node;
45 dev_link_t *link; 45 struct pcmcia_device *link;
46 int sandisk_connectplus; 46 int sandisk_connectplus;
47}; 47};
48 48
@@ -204,7 +204,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
204 204
205static void prism2_detach(struct pcmcia_device *p_dev); 205static void prism2_detach(struct pcmcia_device *p_dev);
206static void prism2_release(u_long arg); 206static void prism2_release(u_long arg);
207static int prism2_config(dev_link_t *link); 207static int prism2_config(struct pcmcia_device *link);
208 208
209 209
210static int prism2_pccard_card_present(local_info_t *local) 210static int prism2_pccard_card_present(local_info_t *local)
@@ -237,7 +237,7 @@ static void sandisk_set_iobase(local_info_t *local)
237 reg.Action = CS_WRITE; 237 reg.Action = CS_WRITE;
238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */ 238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; 239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
240 res = pcmcia_access_configuration_register(hw_priv->link->handle, 240 res = pcmcia_access_configuration_register(hw_priv->link,
241 &reg); 241 &reg);
242 if (res != CS_SUCCESS) { 242 if (res != CS_SUCCESS) {
243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
@@ -249,7 +249,7 @@ static void sandisk_set_iobase(local_info_t *local)
249 reg.Action = CS_WRITE; 249 reg.Action = CS_WRITE;
250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */ 250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; 251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
252 res = pcmcia_access_configuration_register(hw_priv->link->handle, 252 res = pcmcia_access_configuration_register(hw_priv->link,
253 &reg); 253 &reg);
254 if (res != CS_SUCCESS) { 254 if (res != CS_SUCCESS) {
255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
@@ -301,9 +301,9 @@ static int sandisk_enable_wireless(struct net_device *dev)
301 tuple.TupleData = buf; 301 tuple.TupleData = buf;
302 tuple.TupleDataMax = sizeof(buf); 302 tuple.TupleDataMax = sizeof(buf);
303 tuple.TupleOffset = 0; 303 tuple.TupleOffset = 0;
304 if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || 304 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
305 pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || 305 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
306 pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || 306 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) { 307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
308 /* No SanDisk manfid found */ 308 /* No SanDisk manfid found */
309 ret = -ENODEV; 309 ret = -ENODEV;
@@ -311,9 +311,9 @@ static int sandisk_enable_wireless(struct net_device *dev)
311 } 311 }
312 312
313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC; 313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC;
314 if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || 314 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
315 pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || 315 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
316 pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || 316 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
317 parse->longlink_mfc.nfn < 2) { 317 parse->longlink_mfc.nfn < 2) {
318 /* No multi-function links found */ 318 /* No multi-function links found */
319 ret = -ENODEV; 319 ret = -ENODEV;
@@ -328,7 +328,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
328 reg.Action = CS_WRITE; 328 reg.Action = CS_WRITE;
329 reg.Offset = CISREG_COR; 329 reg.Offset = CISREG_COR;
330 reg.Value = COR_SOFT_RESET; 330 reg.Value = COR_SOFT_RESET;
331 res = pcmcia_access_configuration_register(hw_priv->link->handle, 331 res = pcmcia_access_configuration_register(hw_priv->link,
332 &reg); 332 &reg);
333 if (res != CS_SUCCESS) { 333 if (res != CS_SUCCESS) {
334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
@@ -345,7 +345,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
345 * will be enabled during the first cor_sreset call. 345 * will be enabled during the first cor_sreset call.
346 */ 346 */
347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
348 res = pcmcia_access_configuration_register(hw_priv->link->handle, 348 res = pcmcia_access_configuration_register(hw_priv->link,
349 &reg); 349 &reg);
350 if (res != CS_SUCCESS) { 350 if (res != CS_SUCCESS) {
351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
@@ -380,7 +380,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
380 reg.Action = CS_READ; 380 reg.Action = CS_READ;
381 reg.Offset = CISREG_COR; 381 reg.Offset = CISREG_COR;
382 reg.Value = 0; 382 reg.Value = 0;
383 res = pcmcia_access_configuration_register(hw_priv->link->handle, 383 res = pcmcia_access_configuration_register(hw_priv->link,
384 &reg); 384 &reg);
385 if (res != CS_SUCCESS) { 385 if (res != CS_SUCCESS) {
386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
@@ -392,7 +392,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
392 392
393 reg.Action = CS_WRITE; 393 reg.Action = CS_WRITE;
394 reg.Value |= COR_SOFT_RESET; 394 reg.Value |= COR_SOFT_RESET;
395 res = pcmcia_access_configuration_register(hw_priv->link->handle, 395 res = pcmcia_access_configuration_register(hw_priv->link,
396 &reg); 396 &reg);
397 if (res != CS_SUCCESS) { 397 if (res != CS_SUCCESS) {
398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
@@ -405,7 +405,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
405 reg.Value &= ~COR_SOFT_RESET; 405 reg.Value &= ~COR_SOFT_RESET;
406 if (hw_priv->sandisk_connectplus) 406 if (hw_priv->sandisk_connectplus)
407 reg.Value |= COR_IREQ_ENA; 407 reg.Value |= COR_IREQ_ENA;
408 res = pcmcia_access_configuration_register(hw_priv->link->handle, 408 res = pcmcia_access_configuration_register(hw_priv->link,
409 &reg); 409 &reg);
410 if (res != CS_SUCCESS) { 410 if (res != CS_SUCCESS) {
411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
@@ -439,7 +439,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
439 reg.Action = CS_READ; 439 reg.Action = CS_READ;
440 reg.Offset = CISREG_COR; 440 reg.Offset = CISREG_COR;
441 reg.Value = 0; 441 reg.Value = 0;
442 res = pcmcia_access_configuration_register(hw_priv->link->handle, 442 res = pcmcia_access_configuration_register(hw_priv->link,
443 &reg); 443 &reg);
444 if (res != CS_SUCCESS) { 444 if (res != CS_SUCCESS) {
445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
@@ -452,7 +452,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
452 452
453 reg.Action = CS_WRITE; 453 reg.Action = CS_WRITE;
454 reg.Value |= COR_SOFT_RESET; 454 reg.Value |= COR_SOFT_RESET;
455 res = pcmcia_access_configuration_register(hw_priv->link->handle, 455 res = pcmcia_access_configuration_register(hw_priv->link,
456 &reg); 456 &reg);
457 if (res != CS_SUCCESS) { 457 if (res != CS_SUCCESS) {
458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
@@ -466,7 +466,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
466 reg.Action = CS_WRITE; 466 reg.Action = CS_WRITE;
467 reg.Value = hcr; 467 reg.Value = hcr;
468 reg.Offset = CISREG_CCSR; 468 reg.Offset = CISREG_CCSR;
469 res = pcmcia_access_configuration_register(hw_priv->link->handle, 469 res = pcmcia_access_configuration_register(hw_priv->link,
470 &reg); 470 &reg);
471 if (res != CS_SUCCESS) { 471 if (res != CS_SUCCESS) {
472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
@@ -478,7 +478,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
478 reg.Action = CS_WRITE; 478 reg.Action = CS_WRITE;
479 reg.Offset = CISREG_COR; 479 reg.Offset = CISREG_COR;
480 reg.Value = old_cor & ~COR_SOFT_RESET; 480 reg.Value = old_cor & ~COR_SOFT_RESET;
481 res = pcmcia_access_configuration_register(hw_priv->link->handle, 481 res = pcmcia_access_configuration_register(hw_priv->link,
482 &reg); 482 &reg);
483 if (res != CS_SUCCESS) { 483 if (res != CS_SUCCESS) {
484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
@@ -514,10 +514,8 @@ static int prism2_attach(struct pcmcia_device *p_dev)
514} 514}
515 515
516 516
517static void prism2_detach(struct pcmcia_device *p_dev) 517static void prism2_detach(struct pcmcia_device *link)
518{ 518{
519 dev_link_t *link = dev_to_instance(p_dev);
520
521 PDEBUG(DEBUG_FLOW, "prism2_detach\n"); 519 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
522 520
523 if (link->state & DEV_CONFIG) { 521 if (link->state & DEV_CONFIG) {
@@ -545,7 +543,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
545do { int ret = (retf); \ 543do { int ret = (retf); \
546if (ret != 0) { \ 544if (ret != 0) { \
547 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \ 545 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
548 cs_error(link->handle, fn, ret); \ 546 cs_error(link, fn, ret); \
549 goto next_entry; \ 547 goto next_entry; \
550} \ 548} \
551} while (0) 549} while (0)
@@ -553,7 +551,7 @@ if (ret != 0) { \
553 551
554/* run after a CARD_INSERTION event is received to configure the PCMCIA 552/* run after a CARD_INSERTION event is received to configure the PCMCIA
555 * socket and make the device available to the system */ 553 * socket and make the device available to the system */
556static int prism2_config(dev_link_t *link) 554static int prism2_config(struct pcmcia_device *link)
557{ 555{
558 struct net_device *dev; 556 struct net_device *dev;
559 struct hostap_interface *iface; 557 struct hostap_interface *iface;
@@ -582,24 +580,24 @@ static int prism2_config(dev_link_t *link)
582 tuple.TupleData = buf; 580 tuple.TupleData = buf;
583 tuple.TupleDataMax = sizeof(buf); 581 tuple.TupleDataMax = sizeof(buf);
584 tuple.TupleOffset = 0; 582 tuple.TupleOffset = 0;
585 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link->handle, &tuple)); 583 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
586 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link->handle, &tuple)); 584 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
587 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link->handle, &tuple, parse)); 585 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
588 link->conf.ConfigBase = parse->config.base; 586 link->conf.ConfigBase = parse->config.base;
589 link->conf.Present = parse->config.rmask[0]; 587 link->conf.Present = parse->config.rmask[0];
590 588
591 CS_CHECK(GetConfigurationInfo, 589 CS_CHECK(GetConfigurationInfo,
592 pcmcia_get_configuration_info(link->handle, &conf)); 590 pcmcia_get_configuration_info(link, &conf));
593 591
594 /* Look for an appropriate configuration table entry in the CIS */ 592 /* Look for an appropriate configuration table entry in the CIS */
595 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 593 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
596 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link->handle, &tuple)); 594 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
597 for (;;) { 595 for (;;) {
598 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry); 596 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry);
599 CFG_CHECK2(GetTupleData, 597 CFG_CHECK2(GetTupleData,
600 pcmcia_get_tuple_data(link->handle, &tuple)); 598 pcmcia_get_tuple_data(link, &tuple));
601 CFG_CHECK2(ParseTuple, 599 CFG_CHECK2(ParseTuple,
602 pcmcia_parse_tuple(link->handle, &tuple, parse)); 600 pcmcia_parse_tuple(link, &tuple, parse));
603 601
604 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 602 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
605 dflt = *cfg; 603 dflt = *cfg;
@@ -679,19 +677,19 @@ static int prism2_config(dev_link_t *link)
679 677
680 /* This reserves IO space but doesn't actually enable it */ 678 /* This reserves IO space but doesn't actually enable it */
681 CFG_CHECK2(RequestIO, 679 CFG_CHECK2(RequestIO,
682 pcmcia_request_io(link->handle, &link->io)); 680 pcmcia_request_io(link, &link->io));
683 681
684 /* This configuration table entry is OK */ 682 /* This configuration table entry is OK */
685 break; 683 break;
686 684
687 next_entry: 685 next_entry:
688 CS_CHECK(GetNextTuple, 686 CS_CHECK(GetNextTuple,
689 pcmcia_get_next_tuple(link->handle, &tuple)); 687 pcmcia_get_next_tuple(link, &tuple));
690 } 688 }
691 689
692 /* Need to allocate net_device before requesting IRQ handler */ 690 /* Need to allocate net_device before requesting IRQ handler */
693 dev = prism2_init_local_data(&prism2_pccard_funcs, 0, 691 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
694 &handle_to_dev(link->handle)); 692 &handle_to_dev(link));
695 if (dev == NULL) 693 if (dev == NULL)
696 goto failed; 694 goto failed;
697 link->priv = dev; 695 link->priv = dev;
@@ -714,7 +712,7 @@ static int prism2_config(dev_link_t *link)
714 link->irq.Handler = prism2_interrupt; 712 link->irq.Handler = prism2_interrupt;
715 link->irq.Instance = dev; 713 link->irq.Instance = dev;
716 CS_CHECK(RequestIRQ, 714 CS_CHECK(RequestIRQ,
717 pcmcia_request_irq(link->handle, &link->irq)); 715 pcmcia_request_irq(link, &link->irq));
718 } 716 }
719 717
720 /* 718 /*
@@ -723,7 +721,7 @@ static int prism2_config(dev_link_t *link)
723 * card and host interface into "Memory and IO" mode. 721 * card and host interface into "Memory and IO" mode.
724 */ 722 */
725 CS_CHECK(RequestConfiguration, 723 CS_CHECK(RequestConfiguration,
726 pcmcia_request_configuration(link->handle, &link->conf)); 724 pcmcia_request_configuration(link, &link->conf));
727 725
728 dev->irq = link->irq.AssignedIRQ; 726 dev->irq = link->irq.AssignedIRQ;
729 dev->base_addr = link->io.BasePort1; 727 dev->base_addr = link->io.BasePort1;
@@ -761,7 +759,7 @@ static int prism2_config(dev_link_t *link)
761 return ret; 759 return ret;
762 760
763 cs_failed: 761 cs_failed:
764 cs_error(link->handle, last_fn, last_ret); 762 cs_error(link, last_fn, last_ret);
765 763
766 failed: 764 failed:
767 kfree(parse); 765 kfree(parse);
@@ -773,7 +771,7 @@ static int prism2_config(dev_link_t *link)
773 771
774static void prism2_release(u_long arg) 772static void prism2_release(u_long arg)
775{ 773{
776 dev_link_t *link = (dev_link_t *)arg; 774 struct pcmcia_device *link = (struct pcmcia_device *)arg;
777 775
778 PDEBUG(DEBUG_FLOW, "prism2_release\n"); 776 PDEBUG(DEBUG_FLOW, "prism2_release\n");
779 777
@@ -787,13 +785,12 @@ static void prism2_release(u_long arg)
787 iface->local->shutdown = 1; 785 iface->local->shutdown = 1;
788 } 786 }
789 787
790 pcmcia_disable_device(link->handle); 788 pcmcia_disable_device(link);
791 PDEBUG(DEBUG_FLOW, "release - done\n"); 789 PDEBUG(DEBUG_FLOW, "release - done\n");
792} 790}
793 791
794static int hostap_cs_suspend(struct pcmcia_device *p_dev) 792static int hostap_cs_suspend(struct pcmcia_device *link)
795{ 793{
796 dev_link_t *link = dev_to_instance(p_dev);
797 struct net_device *dev = (struct net_device *) link->priv; 794 struct net_device *dev = (struct net_device *) link->priv;
798 int dev_open = 0; 795 int dev_open = 0;
799 796
@@ -813,9 +810,8 @@ static int hostap_cs_suspend(struct pcmcia_device *p_dev)
813 return 0; 810 return 0;
814} 811}
815 812
816static int hostap_cs_resume(struct pcmcia_device *p_dev) 813static int hostap_cs_resume(struct pcmcia_device *link)
817{ 814{
818 dev_link_t *link = dev_to_instance(p_dev);
819 struct net_device *dev = (struct net_device *) link->priv; 815 struct net_device *dev = (struct net_device *) link->priv;
820 int dev_open = 0; 816 int dev_open = 0;
821 817
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 68dfe68ffecf..2a688865f777 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -190,8 +190,8 @@ module_param(mem_speed, int, 0);
190/*====================================================================*/ 190/*====================================================================*/
191 191
192/* PCMCIA (Card Services) related functions */ 192/* PCMCIA (Card Services) related functions */
193static void netwave_release(dev_link_t *link); /* Card removal */ 193static void netwave_release(struct pcmcia_device *link); /* Card removal */
194static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card 194static void netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
195 insertion */ 195 insertion */
196static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ 196static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
197 197
@@ -221,10 +221,10 @@ static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
221static void set_multicast_list(struct net_device *dev); 221static void set_multicast_list(struct net_device *dev);
222 222
223/* 223/*
224 A dev_link_t structure has fields for most things that are needed 224 A struct pcmcia_device structure has fields for most things that are needed
225 to keep track of a socket, but there will usually be some device 225 to keep track of a socket, but there will usually be some device
226 specific information that also needs to be kept track of. The 226 specific information that also needs to be kept track of. The
227 'priv' pointer in a dev_link_t structure can be used to point to 227 'priv' pointer in a struct pcmcia_device structure can be used to point to
228 a device-specific private data structure, like this. 228 a device-specific private data structure, like this.
229 229
230 A driver needs to provide a dev_node_t structure for each device 230 A driver needs to provide a dev_node_t structure for each device
@@ -232,7 +232,7 @@ static void set_multicast_list(struct net_device *dev);
232 example, ethernet cards, modems). In other cases, there may be 232 example, ethernet cards, modems). In other cases, there may be
233 many actual or logical devices (SCSI adapters, memory cards with 233 many actual or logical devices (SCSI adapters, memory cards with
234 multiple partitions). The dev_node_t structures need to be kept 234 multiple partitions). The dev_node_t structures need to be kept
235 in a linked list starting at the 'dev' field of a dev_link_t 235 in a linked list starting at the 'dev' field of a struct pcmcia_device
236 structure. We allocate them in the card's private data structure, 236 structure. We allocate them in the card's private data structure,
237 because they generally can't be allocated dynamically. 237 because they generally can't be allocated dynamically.
238*/ 238*/
@@ -376,20 +376,19 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
376 * configure the card at this point -- we wait until we receive a 376 * configure the card at this point -- we wait until we receive a
377 * card insertion event. 377 * card insertion event.
378 */ 378 */
379static int netwave_attach(struct pcmcia_device *p_dev) 379static int netwave_attach(struct pcmcia_device *link)
380{ 380{
381 struct net_device *dev; 381 struct net_device *dev;
382 netwave_private *priv; 382 netwave_private *priv;
383 dev_link_t *link = dev_to_instance(p_dev);
384 383
385 DEBUG(0, "netwave_attach()\n"); 384 DEBUG(0, "netwave_attach()\n");
386 385
387 /* Initialize the dev_link_t structure */ 386 /* Initialize the struct pcmcia_device structure */
388 dev = alloc_etherdev(sizeof(netwave_private)); 387 dev = alloc_etherdev(sizeof(netwave_private));
389 if (!dev) 388 if (!dev)
390 return -ENOMEM; 389 return -ENOMEM;
391 priv = netdev_priv(dev); 390 priv = netdev_priv(dev);
392 priv->p_dev = p_dev; 391 priv->p_dev = link;
393 link->priv = dev; 392 link->priv = dev;
394 393
395 /* The io structure describes IO port mapping */ 394 /* The io structure describes IO port mapping */
@@ -443,9 +442,8 @@ static int netwave_attach(struct pcmcia_device *p_dev)
443 * structures are freed. Otherwise, the structures will be freed 442 * structures are freed. Otherwise, the structures will be freed
444 * when the device is released. 443 * when the device is released.
445 */ 444 */
446static void netwave_detach(struct pcmcia_device *p_dev) 445static void netwave_detach(struct pcmcia_device *link)
447{ 446{
448 dev_link_t *link = dev_to_instance(p_dev);
449 struct net_device *dev = link->priv; 447 struct net_device *dev = link->priv;
450 448
451 DEBUG(0, "netwave_detach(0x%p)\n", link); 449 DEBUG(0, "netwave_detach(0x%p)\n", link);
@@ -739,8 +737,7 @@ static const struct iw_handler_def netwave_handler_def =
739#define CS_CHECK(fn, ret) \ 737#define CS_CHECK(fn, ret) \
740do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 738do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
741 739
742static void netwave_pcmcia_config(dev_link_t *link) { 740static void netwave_pcmcia_config(struct pcmcia_device *link) {
743 client_handle_t handle = link->handle;
744 struct net_device *dev = link->priv; 741 struct net_device *dev = link->priv;
745 netwave_private *priv = netdev_priv(dev); 742 netwave_private *priv = netdev_priv(dev);
746 tuple_t tuple; 743 tuple_t tuple;
@@ -762,9 +759,9 @@ static void netwave_pcmcia_config(dev_link_t *link) {
762 tuple.TupleDataMax = 64; 759 tuple.TupleDataMax = 64;
763 tuple.TupleOffset = 0; 760 tuple.TupleOffset = 0;
764 tuple.DesiredTuple = CISTPL_CONFIG; 761 tuple.DesiredTuple = CISTPL_CONFIG;
765 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 762 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
766 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 763 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
767 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 764 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
768 link->conf.ConfigBase = parse.config.base; 765 link->conf.ConfigBase = parse.config.base;
769 link->conf.Present = parse.config.rmask[0]; 766 link->conf.Present = parse.config.rmask[0];
770 767
@@ -778,11 +775,11 @@ static void netwave_pcmcia_config(dev_link_t *link) {
778 */ 775 */
779 for (i = j = 0x0; j < 0x400; j += 0x20) { 776 for (i = j = 0x0; j < 0x400; j += 0x20) {
780 link->io.BasePort1 = j ^ 0x300; 777 link->io.BasePort1 = j ^ 0x300;
781 i = pcmcia_request_io(link->handle, &link->io); 778 i = pcmcia_request_io(link, &link->io);
782 if (i == CS_SUCCESS) break; 779 if (i == CS_SUCCESS) break;
783 } 780 }
784 if (i != CS_SUCCESS) { 781 if (i != CS_SUCCESS) {
785 cs_error(link->handle, RequestIO, i); 782 cs_error(link, RequestIO, i);
786 goto failed; 783 goto failed;
787 } 784 }
788 785
@@ -790,16 +787,16 @@ static void netwave_pcmcia_config(dev_link_t *link) {
790 * Now allocate an interrupt line. Note that this does not 787 * Now allocate an interrupt line. Note that this does not
791 * actually assign a handler to the interrupt. 788 * actually assign a handler to the interrupt.
792 */ 789 */
793 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 790 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
794 791
795 /* 792 /*
796 * This actually configures the PCMCIA socket -- setting up 793 * This actually configures the PCMCIA socket -- setting up
797 * the I/O windows and the interrupt mapping. 794 * the I/O windows and the interrupt mapping.
798 */ 795 */
799 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 796 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
800 797
801 /* 798 /*
802 * Allocate a 32K memory window. Note that the dev_link_t 799 * Allocate a 32K memory window. Note that the struct pcmcia_device
803 * structure provides space for one window handle -- if your 800 * structure provides space for one window handle -- if your
804 * device needs several windows, you'll need to keep track of 801 * device needs several windows, you'll need to keep track of
805 * the handles in your private data structure, dev->priv. 802 * the handles in your private data structure, dev->priv.
@@ -809,7 +806,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
809 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 806 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
810 req.Base = 0; req.Size = 0x8000; 807 req.Base = 0; req.Size = 0x8000;
811 req.AccessSpeed = mem_speed; 808 req.AccessSpeed = mem_speed;
812 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 809 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
813 mem.CardOffset = 0x20000; mem.Page = 0; 810 mem.CardOffset = 0x20000; mem.Page = 0;
814 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 811 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
815 812
@@ -819,7 +816,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
819 816
820 dev->irq = link->irq.AssignedIRQ; 817 dev->irq = link->irq.AssignedIRQ;
821 dev->base_addr = link->io.BasePort1; 818 dev->base_addr = link->io.BasePort1;
822 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 819 SET_NETDEV_DEV(dev, &handle_to_dev(link));
823 820
824 if (register_netdev(dev) != 0) { 821 if (register_netdev(dev) != 0) {
825 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); 822 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n");
@@ -851,7 +848,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
851 return; 848 return;
852 849
853cs_failed: 850cs_failed:
854 cs_error(link->handle, last_fn, last_ret); 851 cs_error(link, last_fn, last_ret);
855failed: 852failed:
856 netwave_release(link); 853 netwave_release(link);
857} /* netwave_pcmcia_config */ 854} /* netwave_pcmcia_config */
@@ -863,21 +860,20 @@ failed:
863 * device, and release the PCMCIA configuration. If the device is 860 * device, and release the PCMCIA configuration. If the device is
864 * still open, this will be postponed until it is closed. 861 * still open, this will be postponed until it is closed.
865 */ 862 */
866static void netwave_release(dev_link_t *link) 863static void netwave_release(struct pcmcia_device *link)
867{ 864{
868 struct net_device *dev = link->priv; 865 struct net_device *dev = link->priv;
869 netwave_private *priv = netdev_priv(dev); 866 netwave_private *priv = netdev_priv(dev);
870 867
871 DEBUG(0, "netwave_release(0x%p)\n", link); 868 DEBUG(0, "netwave_release(0x%p)\n", link);
872 869
873 pcmcia_disable_device(link->handle); 870 pcmcia_disable_device(link);
874 if (link->win) 871 if (link->win)
875 iounmap(priv->ramBase); 872 iounmap(priv->ramBase);
876} 873}
877 874
878static int netwave_suspend(struct pcmcia_device *p_dev) 875static int netwave_suspend(struct pcmcia_device *link)
879{ 876{
880 dev_link_t *link = dev_to_instance(p_dev);
881 struct net_device *dev = link->priv; 877 struct net_device *dev = link->priv;
882 878
883 if ((link->state & DEV_CONFIG) && (link->open)) 879 if ((link->state & DEV_CONFIG) && (link->open))
@@ -886,9 +882,8 @@ static int netwave_suspend(struct pcmcia_device *p_dev)
886 return 0; 882 return 0;
887} 883}
888 884
889static int netwave_resume(struct pcmcia_device *p_dev) 885static int netwave_resume(struct pcmcia_device *link)
890{ 886{
891 dev_link_t *link = dev_to_instance(p_dev);
892 struct net_device *dev = link->priv; 887 struct net_device *dev = link->priv;
893 888
894 if ((link->state & DEV_CONFIG) && (link->open)) { 889 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1100,7 +1095,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs
1100 u_char __iomem *ramBase; 1095 u_char __iomem *ramBase;
1101 struct net_device *dev = (struct net_device *)dev_id; 1096 struct net_device *dev = (struct net_device *)dev_id;
1102 struct netwave_private *priv = netdev_priv(dev); 1097 struct netwave_private *priv = netdev_priv(dev);
1103 dev_link_t *link = priv->p_dev; 1098 struct pcmcia_device *link = priv->p_dev;
1104 int i; 1099 int i;
1105 1100
1106 if (!netif_device_present(dev)) 1101 if (!netif_device_present(dev))
@@ -1354,7 +1349,7 @@ static int netwave_rx(struct net_device *dev)
1354 1349
1355static int netwave_open(struct net_device *dev) { 1350static int netwave_open(struct net_device *dev) {
1356 netwave_private *priv = netdev_priv(dev); 1351 netwave_private *priv = netdev_priv(dev);
1357 dev_link_t *link = priv->p_dev; 1352 struct pcmcia_device *link = priv->p_dev;
1358 1353
1359 DEBUG(1, "netwave_open: starting.\n"); 1354 DEBUG(1, "netwave_open: starting.\n");
1360 1355
@@ -1371,7 +1366,7 @@ static int netwave_open(struct net_device *dev) {
1371 1366
1372static int netwave_close(struct net_device *dev) { 1367static int netwave_close(struct net_device *dev) {
1373 netwave_private *priv = netdev_priv(dev); 1368 netwave_private *priv = netdev_priv(dev);
1374 dev_link_t *link = priv->p_dev; 1369 struct pcmcia_device *link = priv->p_dev;
1375 1370
1376 DEBUG(1, "netwave_close: finishing.\n"); 1371 DEBUG(1, "netwave_close: finishing.\n");
1377 1372
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;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 60297460debd..415ae8be1e22 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -90,8 +90,8 @@ module_param(pc_debug, int, 0);
90#define DEBUG(n, args...) 90#define DEBUG(n, args...)
91#endif 91#endif
92/** Prototypes based on PCMCIA skeleton driver *******************************/ 92/** Prototypes based on PCMCIA skeleton driver *******************************/
93static void ray_config(dev_link_t *link); 93static void ray_config(struct pcmcia_device *link);
94static void ray_release(dev_link_t *link); 94static void ray_release(struct pcmcia_device *link);
95static void ray_detach(struct pcmcia_device *p_dev); 95static void ray_detach(struct pcmcia_device *p_dev);
96 96
97/***** Prototypes indicated by device structure ******************************/ 97/***** Prototypes indicated by device structure ******************************/
@@ -190,10 +190,10 @@ static int bc;
190static char *phy_addr = NULL; 190static char *phy_addr = NULL;
191 191
192 192
193/* A dev_link_t structure has fields for most things that are needed 193/* A struct pcmcia_device structure has fields for most things that are needed
194 to keep track of a socket, but there will usually be some device 194 to keep track of a socket, but there will usually be some device
195 specific information that also needs to be kept track of. The 195 specific information that also needs to be kept track of. The
196 'priv' pointer in a dev_link_t structure can be used to point to 196 'priv' pointer in a struct pcmcia_device structure can be used to point to
197 a device-specific private data structure, like this. 197 a device-specific private data structure, like this.
198*/ 198*/
199static unsigned int ray_mem_speed = 500; 199static unsigned int ray_mem_speed = 500;
@@ -381,9 +381,8 @@ fail_alloc_dev:
381 structures are freed. Otherwise, the structures will be freed 381 structures are freed. Otherwise, the structures will be freed
382 when the device is released. 382 when the device is released.
383=============================================================================*/ 383=============================================================================*/
384static void ray_detach(struct pcmcia_device *p_dev) 384static void ray_detach(struct pcmcia_device *link)
385{ 385{
386 dev_link_t *link = dev_to_instance(p_dev);
387 struct net_device *dev; 386 struct net_device *dev;
388 ray_dev_t *local; 387 ray_dev_t *local;
389 388
@@ -413,9 +412,8 @@ static void ray_detach(struct pcmcia_device *p_dev)
413#define CS_CHECK(fn, ret) \ 412#define CS_CHECK(fn, ret) \
414do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 413do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
415#define MAX_TUPLE_SIZE 128 414#define MAX_TUPLE_SIZE 128
416static void ray_config(dev_link_t *link) 415static void ray_config(struct pcmcia_device *link)
417{ 416{
418 client_handle_t handle = link->handle;
419 tuple_t tuple; 417 tuple_t tuple;
420 cisparse_t parse; 418 cisparse_t parse;
421 int last_fn = 0, last_ret = 0; 419 int last_fn = 0, last_ret = 0;
@@ -430,23 +428,23 @@ static void ray_config(dev_link_t *link)
430 428
431 /* This reads the card's CONFIG tuple to find its configuration regs */ 429 /* This reads the card's CONFIG tuple to find its configuration regs */
432 tuple.DesiredTuple = CISTPL_CONFIG; 430 tuple.DesiredTuple = CISTPL_CONFIG;
433 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 431 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
434 tuple.TupleData = buf; 432 tuple.TupleData = buf;
435 tuple.TupleDataMax = MAX_TUPLE_SIZE; 433 tuple.TupleDataMax = MAX_TUPLE_SIZE;
436 tuple.TupleOffset = 0; 434 tuple.TupleOffset = 0;
437 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 435 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
438 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 436 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
439 link->conf.ConfigBase = parse.config.base; 437 link->conf.ConfigBase = parse.config.base;
440 link->conf.Present = parse.config.rmask[0]; 438 link->conf.Present = parse.config.rmask[0];
441 439
442 /* Determine card type and firmware version */ 440 /* Determine card type and firmware version */
443 buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0; 441 buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
444 tuple.DesiredTuple = CISTPL_VERS_1; 442 tuple.DesiredTuple = CISTPL_VERS_1;
445 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 443 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
446 tuple.TupleData = buf; 444 tuple.TupleData = buf;
447 tuple.TupleDataMax = MAX_TUPLE_SIZE; 445 tuple.TupleDataMax = MAX_TUPLE_SIZE;
448 tuple.TupleOffset = 2; 446 tuple.TupleOffset = 2;
449 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 447 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
450 448
451 for (i=0; i<tuple.TupleDataLen - 4; i++) 449 for (i=0; i<tuple.TupleDataLen - 4; i++)
452 if (buf[i] == 0) buf[i] = ' '; 450 if (buf[i] == 0) buf[i] = ' ';
@@ -458,20 +456,20 @@ static void ray_config(dev_link_t *link)
458 /* Now allocate an interrupt line. Note that this does not 456 /* Now allocate an interrupt line. Note that this does not
459 actually assign a handler to the interrupt. 457 actually assign a handler to the interrupt.
460 */ 458 */
461 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 459 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
462 dev->irq = link->irq.AssignedIRQ; 460 dev->irq = link->irq.AssignedIRQ;
463 461
464 /* This actually configures the PCMCIA socket -- setting up 462 /* This actually configures the PCMCIA socket -- setting up
465 the I/O windows and the interrupt mapping. 463 the I/O windows and the interrupt mapping.
466 */ 464 */
467 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 465 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
468 466
469/*** Set up 32k window for shared memory (transmit and control) ************/ 467/*** Set up 32k window for shared memory (transmit and control) ************/
470 req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 468 req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
471 req.Base = 0; 469 req.Base = 0;
472 req.Size = 0x8000; 470 req.Size = 0x8000;
473 req.AccessSpeed = ray_mem_speed; 471 req.AccessSpeed = ray_mem_speed;
474 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 472 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
475 mem.CardOffset = 0x0000; mem.Page = 0; 473 mem.CardOffset = 0x0000; mem.Page = 0;
476 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 474 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
477 local->sram = ioremap(req.Base,req.Size); 475 local->sram = ioremap(req.Base,req.Size);
@@ -481,7 +479,7 @@ static void ray_config(dev_link_t *link)
481 req.Base = 0; 479 req.Base = 0;
482 req.Size = 0x4000; 480 req.Size = 0x4000;
483 req.AccessSpeed = ray_mem_speed; 481 req.AccessSpeed = ray_mem_speed;
484 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &local->rmem_handle)); 482 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &local->rmem_handle));
485 mem.CardOffset = 0x8000; mem.Page = 0; 483 mem.CardOffset = 0x8000; mem.Page = 0;
486 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem)); 484 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem));
487 local->rmem = ioremap(req.Base,req.Size); 485 local->rmem = ioremap(req.Base,req.Size);
@@ -491,7 +489,7 @@ static void ray_config(dev_link_t *link)
491 req.Base = 0; 489 req.Base = 0;
492 req.Size = 0x1000; 490 req.Size = 0x1000;
493 req.AccessSpeed = ray_mem_speed; 491 req.AccessSpeed = ray_mem_speed;
494 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &local->amem_handle)); 492 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &local->amem_handle));
495 mem.CardOffset = 0x0000; mem.Page = 0; 493 mem.CardOffset = 0x0000; mem.Page = 0;
496 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem)); 494 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem));
497 local->amem = ioremap(req.Base,req.Size); 495 local->amem = ioremap(req.Base,req.Size);
@@ -504,7 +502,7 @@ static void ray_config(dev_link_t *link)
504 return; 502 return;
505 } 503 }
506 504
507 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 505 SET_NETDEV_DEV(dev, &handle_to_dev(link));
508 i = register_netdev(dev); 506 i = register_netdev(dev);
509 if (i != 0) { 507 if (i != 0) {
510 printk("ray_config register_netdev() failed\n"); 508 printk("ray_config register_netdev() failed\n");
@@ -524,7 +522,7 @@ static void ray_config(dev_link_t *link)
524 return; 522 return;
525 523
526cs_failed: 524cs_failed:
527 cs_error(link->handle, last_fn, last_ret); 525 cs_error(link, last_fn, last_ret);
528 526
529 ray_release(link); 527 ray_release(link);
530} /* ray_config */ 528} /* ray_config */
@@ -553,7 +551,7 @@ static int ray_init(struct net_device *dev)
553 UCHAR *p; 551 UCHAR *p;
554 struct ccs __iomem *pccs; 552 struct ccs __iomem *pccs;
555 ray_dev_t *local = (ray_dev_t *)dev->priv; 553 ray_dev_t *local = (ray_dev_t *)dev->priv;
556 dev_link_t *link = local->finder; 554 struct pcmcia_device *link = local->finder;
557 DEBUG(1, "ray_init(0x%p)\n", dev); 555 DEBUG(1, "ray_init(0x%p)\n", dev);
558 if (!(link->state & DEV_PRESENT)) { 556 if (!(link->state & DEV_PRESENT)) {
559 DEBUG(0,"ray_init - device not present\n"); 557 DEBUG(0,"ray_init - device not present\n");
@@ -615,7 +613,7 @@ static int dl_startup_params(struct net_device *dev)
615 int ccsindex; 613 int ccsindex;
616 ray_dev_t *local = (ray_dev_t *)dev->priv; 614 ray_dev_t *local = (ray_dev_t *)dev->priv;
617 struct ccs __iomem *pccs; 615 struct ccs __iomem *pccs;
618 dev_link_t *link = local->finder; 616 struct pcmcia_device *link = local->finder;
619 617
620 DEBUG(1,"dl_startup_params entered\n"); 618 DEBUG(1,"dl_startup_params entered\n");
621 if (!(link->state & DEV_PRESENT)) { 619 if (!(link->state & DEV_PRESENT)) {
@@ -722,7 +720,7 @@ static void verify_dl_startup(u_long data)
722 ray_dev_t *local = (ray_dev_t *)data; 720 ray_dev_t *local = (ray_dev_t *)data;
723 struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs; 721 struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs;
724 UCHAR status; 722 UCHAR status;
725 dev_link_t *link = local->finder; 723 struct pcmcia_device *link = local->finder;
726 724
727 if (!(link->state & DEV_PRESENT)) { 725 if (!(link->state & DEV_PRESENT)) {
728 DEBUG(2,"ray_cs verify_dl_startup - device not present\n"); 726 DEBUG(2,"ray_cs verify_dl_startup - device not present\n");
@@ -762,7 +760,7 @@ static void start_net(u_long data)
762 ray_dev_t *local = (ray_dev_t *)data; 760 ray_dev_t *local = (ray_dev_t *)data;
763 struct ccs __iomem *pccs; 761 struct ccs __iomem *pccs;
764 int ccsindex; 762 int ccsindex;
765 dev_link_t *link = local->finder; 763 struct pcmcia_device *link = local->finder;
766 if (!(link->state & DEV_PRESENT)) { 764 if (!(link->state & DEV_PRESENT)) {
767 DEBUG(2,"ray_cs start_net - device not present\n"); 765 DEBUG(2,"ray_cs start_net - device not present\n");
768 return; 766 return;
@@ -789,7 +787,7 @@ static void join_net(u_long data)
789 787
790 struct ccs __iomem *pccs; 788 struct ccs __iomem *pccs;
791 int ccsindex; 789 int ccsindex;
792 dev_link_t *link = local->finder; 790 struct pcmcia_device *link = local->finder;
793 791
794 if (!(link->state & DEV_PRESENT)) { 792 if (!(link->state & DEV_PRESENT)) {
795 DEBUG(2,"ray_cs join_net - device not present\n"); 793 DEBUG(2,"ray_cs join_net - device not present\n");
@@ -815,7 +813,7 @@ static void join_net(u_long data)
815 device, and release the PCMCIA configuration. If the device is 813 device, and release the PCMCIA configuration. If the device is
816 still open, this will be postponed until it is closed. 814 still open, this will be postponed until it is closed.
817=============================================================================*/ 815=============================================================================*/
818static void ray_release(dev_link_t *link) 816static void ray_release(struct pcmcia_device *link)
819{ 817{
820 struct net_device *dev = link->priv; 818 struct net_device *dev = link->priv;
821 ray_dev_t *local = dev->priv; 819 ray_dev_t *local = dev->priv;
@@ -833,14 +831,13 @@ static void ray_release(dev_link_t *link)
833 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i); 831 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i);
834 i = pcmcia_release_window(local->rmem_handle); 832 i = pcmcia_release_window(local->rmem_handle);
835 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i); 833 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i);
836 pcmcia_disable_device(link->handle); 834 pcmcia_disable_device(link);
837 835
838 DEBUG(2,"ray_release ending\n"); 836 DEBUG(2,"ray_release ending\n");
839} 837}
840 838
841static int ray_suspend(struct pcmcia_device *p_dev) 839static int ray_suspend(struct pcmcia_device *link)
842{ 840{
843 dev_link_t *link = dev_to_instance(p_dev);
844 struct net_device *dev = link->priv; 841 struct net_device *dev = link->priv;
845 842
846 if ((link->state & DEV_CONFIG) && (link->open)) 843 if ((link->state & DEV_CONFIG) && (link->open))
@@ -849,9 +846,8 @@ static int ray_suspend(struct pcmcia_device *p_dev)
849 return 0; 846 return 0;
850} 847}
851 848
852static int ray_resume(struct pcmcia_device *p_dev) 849static int ray_resume(struct pcmcia_device *link)
853{ 850{
854 dev_link_t *link = dev_to_instance(p_dev);
855 struct net_device *dev = link->priv; 851 struct net_device *dev = link->priv;
856 852
857 if ((link->state & DEV_CONFIG) && (link->open)) { 853 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -869,7 +865,7 @@ int ray_dev_init(struct net_device *dev)
869 int i; 865 int i;
870#endif /* RAY_IMMEDIATE_INIT */ 866#endif /* RAY_IMMEDIATE_INIT */
871 ray_dev_t *local = dev->priv; 867 ray_dev_t *local = dev->priv;
872 dev_link_t *link = local->finder; 868 struct pcmcia_device *link = local->finder;
873 869
874 DEBUG(1,"ray_dev_init(dev=%p)\n",dev); 870 DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
875 if (!(link->state & DEV_PRESENT)) { 871 if (!(link->state & DEV_PRESENT)) {
@@ -903,7 +899,7 @@ int ray_dev_init(struct net_device *dev)
903static int ray_dev_config(struct net_device *dev, struct ifmap *map) 899static int ray_dev_config(struct net_device *dev, struct ifmap *map)
904{ 900{
905 ray_dev_t *local = dev->priv; 901 ray_dev_t *local = dev->priv;
906 dev_link_t *link = local->finder; 902 struct pcmcia_device *link = local->finder;
907 /* Dummy routine to satisfy device structure */ 903 /* Dummy routine to satisfy device structure */
908 DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map); 904 DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
909 if (!(link->state & DEV_PRESENT)) { 905 if (!(link->state & DEV_PRESENT)) {
@@ -917,7 +913,7 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
917static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) 913static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
918{ 914{
919 ray_dev_t *local = dev->priv; 915 ray_dev_t *local = dev->priv;
920 dev_link_t *link = local->finder; 916 struct pcmcia_device *link = local->finder;
921 short length = skb->len; 917 short length = skb->len;
922 918
923 if (!(link->state & DEV_PRESENT)) { 919 if (!(link->state & DEV_PRESENT)) {
@@ -1529,7 +1525,7 @@ static int ray_commit(struct net_device *dev,
1529static iw_stats * ray_get_wireless_stats(struct net_device * dev) 1525static iw_stats * ray_get_wireless_stats(struct net_device * dev)
1530{ 1526{
1531 ray_dev_t * local = (ray_dev_t *) dev->priv; 1527 ray_dev_t * local = (ray_dev_t *) dev->priv;
1532 dev_link_t *link = local->finder; 1528 struct pcmcia_device *link = local->finder;
1533 struct status __iomem *p = local->sram + STATUS_BASE; 1529 struct status __iomem *p = local->sram + STATUS_BASE;
1534 1530
1535 if(local == (ray_dev_t *) NULL) 1531 if(local == (ray_dev_t *) NULL)
@@ -1617,7 +1613,7 @@ static const struct iw_handler_def ray_handler_def =
1617static int ray_open(struct net_device *dev) 1613static int ray_open(struct net_device *dev)
1618{ 1614{
1619 ray_dev_t *local = (ray_dev_t *)dev->priv; 1615 ray_dev_t *local = (ray_dev_t *)dev->priv;
1620 dev_link_t *link; 1616 struct pcmcia_device *link;
1621 link = local->finder; 1617 link = local->finder;
1622 1618
1623 DEBUG(1, "ray_open('%s')\n", dev->name); 1619 DEBUG(1, "ray_open('%s')\n", dev->name);
@@ -1651,7 +1647,7 @@ static int ray_open(struct net_device *dev)
1651static int ray_dev_close(struct net_device *dev) 1647static int ray_dev_close(struct net_device *dev)
1652{ 1648{
1653 ray_dev_t *local = (ray_dev_t *)dev->priv; 1649 ray_dev_t *local = (ray_dev_t *)dev->priv;
1654 dev_link_t *link; 1650 struct pcmcia_device *link;
1655 link = local->finder; 1651 link = local->finder;
1656 1652
1657 DEBUG(1, "ray_dev_close('%s')\n", dev->name); 1653 DEBUG(1, "ray_dev_close('%s')\n", dev->name);
@@ -1677,7 +1673,7 @@ static void ray_reset(struct net_device *dev) {
1677static int interrupt_ecf(ray_dev_t *local, int ccs) 1673static int interrupt_ecf(ray_dev_t *local, int ccs)
1678{ 1674{
1679 int i = 50; 1675 int i = 50;
1680 dev_link_t *link = local->finder; 1676 struct pcmcia_device *link = local->finder;
1681 1677
1682 if (!(link->state & DEV_PRESENT)) { 1678 if (!(link->state & DEV_PRESENT)) {
1683 DEBUG(2,"ray_cs interrupt_ecf - device not present\n"); 1679 DEBUG(2,"ray_cs interrupt_ecf - device not present\n");
@@ -1704,7 +1700,7 @@ static int get_free_tx_ccs(ray_dev_t *local)
1704{ 1700{
1705 int i; 1701 int i;
1706 struct ccs __iomem *pccs = ccs_base(local); 1702 struct ccs __iomem *pccs = ccs_base(local);
1707 dev_link_t *link = local->finder; 1703 struct pcmcia_device *link = local->finder;
1708 1704
1709 if (!(link->state & DEV_PRESENT)) { 1705 if (!(link->state & DEV_PRESENT)) {
1710 DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n"); 1706 DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n");
@@ -1735,7 +1731,7 @@ static int get_free_ccs(ray_dev_t *local)
1735{ 1731{
1736 int i; 1732 int i;
1737 struct ccs __iomem *pccs = ccs_base(local); 1733 struct ccs __iomem *pccs = ccs_base(local);
1738 dev_link_t *link = local->finder; 1734 struct pcmcia_device *link = local->finder;
1739 1735
1740 if (!(link->state & DEV_PRESENT)) { 1736 if (!(link->state & DEV_PRESENT)) {
1741 DEBUG(2,"ray_cs get_free_ccs - device not present\n"); 1737 DEBUG(2,"ray_cs get_free_ccs - device not present\n");
@@ -1810,7 +1806,7 @@ static int parse_addr(char *in_str, UCHAR *out)
1810static struct net_device_stats *ray_get_stats(struct net_device *dev) 1806static struct net_device_stats *ray_get_stats(struct net_device *dev)
1811{ 1807{
1812 ray_dev_t *local = (ray_dev_t *)dev->priv; 1808 ray_dev_t *local = (ray_dev_t *)dev->priv;
1813 dev_link_t *link = local->finder; 1809 struct pcmcia_device *link = local->finder;
1814 struct status __iomem *p = local->sram + STATUS_BASE; 1810 struct status __iomem *p = local->sram + STATUS_BASE;
1815 if (!(link->state & DEV_PRESENT)) { 1811 if (!(link->state & DEV_PRESENT)) {
1816 DEBUG(2,"ray_cs net_device_stats - device not present\n"); 1812 DEBUG(2,"ray_cs net_device_stats - device not present\n");
@@ -1840,7 +1836,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev)
1840static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len) 1836static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len)
1841{ 1837{
1842 ray_dev_t *local = (ray_dev_t *)dev->priv; 1838 ray_dev_t *local = (ray_dev_t *)dev->priv;
1843 dev_link_t *link = local->finder; 1839 struct pcmcia_device *link = local->finder;
1844 int ccsindex; 1840 int ccsindex;
1845 int i; 1841 int i;
1846 struct ccs __iomem *pccs; 1842 struct ccs __iomem *pccs;
@@ -1877,7 +1873,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1877 struct ccs __iomem *pccs; 1873 struct ccs __iomem *pccs;
1878 int i = 0; 1874 int i = 0;
1879 ray_dev_t *local = (ray_dev_t *)dev->priv; 1875 ray_dev_t *local = (ray_dev_t *)dev->priv;
1880 dev_link_t *link = local->finder; 1876 struct pcmcia_device *link = local->finder;
1881 void __iomem *p = local->sram + HOST_TO_ECF_BASE; 1877 void __iomem *p = local->sram + HOST_TO_ECF_BASE;
1882 1878
1883 if (!(link->state & DEV_PRESENT)) { 1879 if (!(link->state & DEV_PRESENT)) {
@@ -1957,7 +1953,7 @@ static void set_multicast_list(struct net_device *dev)
1957static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs) 1953static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1958{ 1954{
1959 struct net_device *dev = (struct net_device *)dev_id; 1955 struct net_device *dev = (struct net_device *)dev_id;
1960 dev_link_t *link; 1956 struct pcmcia_device *link;
1961 ray_dev_t *local; 1957 ray_dev_t *local;
1962 struct ccs __iomem *pccs; 1958 struct ccs __iomem *pccs;
1963 struct rcs __iomem *prcs; 1959 struct rcs __iomem *prcs;
@@ -1972,7 +1968,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1972 DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev); 1968 DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev);
1973 1969
1974 local = (ray_dev_t *)dev->priv; 1970 local = (ray_dev_t *)dev->priv;
1975 link = (dev_link_t *)local->finder; 1971 link = (struct pcmcia_device *)local->finder;
1976 if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) { 1972 if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) {
1977 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n"); 1973 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
1978 return IRQ_NONE; 1974 return IRQ_NONE;
@@ -2492,7 +2488,7 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem * prcs)
2492/*===========================================================================*/ 2488/*===========================================================================*/
2493static void authenticate(ray_dev_t *local) 2489static void authenticate(ray_dev_t *local)
2494{ 2490{
2495 dev_link_t *link = local->finder; 2491 struct pcmcia_device *link = local->finder;
2496 DEBUG(0,"ray_cs Starting authentication.\n"); 2492 DEBUG(0,"ray_cs Starting authentication.\n");
2497 if (!(link->state & DEV_PRESENT)) { 2493 if (!(link->state & DEV_PRESENT)) {
2498 DEBUG(2,"ray_cs authenticate - device not present\n"); 2494 DEBUG(2,"ray_cs authenticate - device not present\n");
@@ -2558,7 +2554,7 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2558static void associate(ray_dev_t *local) 2554static void associate(ray_dev_t *local)
2559{ 2555{
2560 struct ccs __iomem *pccs; 2556 struct ccs __iomem *pccs;
2561 dev_link_t *link = local->finder; 2557 struct pcmcia_device *link = local->finder;
2562 struct net_device *dev = link->priv; 2558 struct net_device *dev = link->priv;
2563 int ccsindex; 2559 int ccsindex;
2564 if (!(link->state & DEV_PRESENT)) { 2560 if (!(link->state & DEV_PRESENT)) {
@@ -2641,7 +2637,7 @@ static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len)
2641 * eg ifconfig 2637 * eg ifconfig
2642 */ 2638 */
2643 int i; 2639 int i;
2644 dev_link_t *link; 2640 struct pcmcia_device *link;
2645 struct net_device *dev; 2641 struct net_device *dev;
2646 ray_dev_t *local; 2642 ray_dev_t *local;
2647 UCHAR *p; 2643 UCHAR *p;
diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h
index 42660fe64bfd..bd73ebf03340 100644
--- a/drivers/net/wireless/ray_cs.h
+++ b/drivers/net/wireless/ray_cs.h
@@ -31,7 +31,7 @@ typedef struct ray_dev_t {
31 void __iomem *sram; /* pointer to beginning of shared RAM */ 31 void __iomem *sram; /* pointer to beginning of shared RAM */
32 void __iomem *amem; /* pointer to attribute mem window */ 32 void __iomem *amem; /* pointer to attribute mem window */
33 void __iomem *rmem; /* pointer to receive buffer window */ 33 void __iomem *rmem; /* pointer to receive buffer window */
34 dev_link_t *finder; /* pointer back to dev_link_t for card */ 34 struct pcmcia_device *finder; /* pointer back to struct pcmcia_device for card */
35 struct timer_list timer; 35 struct timer_list timer;
36 long tx_ccs_lock; 36 long tx_ccs_lock;
37 long ccs_lock; 37 long ccs_lock;
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index be36679c8c95..a75ea7e593ac 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -71,8 +71,8 @@ struct orinoco_pccard {
71/* Function prototypes */ 71/* Function prototypes */
72/********************************************************************/ 72/********************************************************************/
73 73
74static void spectrum_cs_config(dev_link_t *link); 74static void spectrum_cs_config(struct pcmcia_device *link);
75static void spectrum_cs_release(dev_link_t *link); 75static void spectrum_cs_release(struct pcmcia_device *link);
76 76
77/********************************************************************/ 77/********************************************************************/
78/* Firmware downloader */ 78/* Firmware downloader */
@@ -238,7 +238,7 @@ spectrum_aux_open(hermes_t *hw)
238 * If IDLE is 1, stop the firmware, so that it can be safely rewritten. 238 * If IDLE is 1, stop the firmware, so that it can be safely rewritten.
239 */ 239 */
240static int 240static int
241spectrum_reset(dev_link_t *link, int idle) 241spectrum_reset(struct pcmcia_device *link, int idle)
242{ 242{
243 int last_ret, last_fn; 243 int last_ret, last_fn;
244 conf_reg_t reg; 244 conf_reg_t reg;
@@ -253,7 +253,7 @@ spectrum_reset(dev_link_t *link, int idle)
253 reg.Action = CS_READ; 253 reg.Action = CS_READ;
254 reg.Offset = CISREG_COR; 254 reg.Offset = CISREG_COR;
255 CS_CHECK(AccessConfigurationRegister, 255 CS_CHECK(AccessConfigurationRegister,
256 pcmcia_access_configuration_register(link->handle, &reg)); 256 pcmcia_access_configuration_register(link, &reg));
257 save_cor = reg.Value; 257 save_cor = reg.Value;
258 258
259 /* Soft-Reset card */ 259 /* Soft-Reset card */
@@ -261,14 +261,14 @@ spectrum_reset(dev_link_t *link, int idle)
261 reg.Offset = CISREG_COR; 261 reg.Offset = CISREG_COR;
262 reg.Value = (save_cor | COR_SOFT_RESET); 262 reg.Value = (save_cor | COR_SOFT_RESET);
263 CS_CHECK(AccessConfigurationRegister, 263 CS_CHECK(AccessConfigurationRegister,
264 pcmcia_access_configuration_register(link->handle, &reg)); 264 pcmcia_access_configuration_register(link, &reg));
265 udelay(1000); 265 udelay(1000);
266 266
267 /* Read CCSR */ 267 /* Read CCSR */
268 reg.Action = CS_READ; 268 reg.Action = CS_READ;
269 reg.Offset = CISREG_CCSR; 269 reg.Offset = CISREG_CCSR;
270 CS_CHECK(AccessConfigurationRegister, 270 CS_CHECK(AccessConfigurationRegister,
271 pcmcia_access_configuration_register(link->handle, &reg)); 271 pcmcia_access_configuration_register(link, &reg));
272 272
273 /* 273 /*
274 * Start or stop the firmware. Memory width bit should be 274 * Start or stop the firmware. Memory width bit should be
@@ -278,7 +278,7 @@ spectrum_reset(dev_link_t *link, int idle)
278 reg.Offset = CISREG_CCSR; 278 reg.Offset = CISREG_CCSR;
279 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); 279 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16);
280 CS_CHECK(AccessConfigurationRegister, 280 CS_CHECK(AccessConfigurationRegister,
281 pcmcia_access_configuration_register(link->handle, &reg)); 281 pcmcia_access_configuration_register(link, &reg));
282 udelay(1000); 282 udelay(1000);
283 283
284 /* Restore original COR configuration index */ 284 /* Restore original COR configuration index */
@@ -286,12 +286,12 @@ spectrum_reset(dev_link_t *link, int idle)
286 reg.Offset = CISREG_COR; 286 reg.Offset = CISREG_COR;
287 reg.Value = (save_cor & ~COR_SOFT_RESET); 287 reg.Value = (save_cor & ~COR_SOFT_RESET);
288 CS_CHECK(AccessConfigurationRegister, 288 CS_CHECK(AccessConfigurationRegister,
289 pcmcia_access_configuration_register(link->handle, &reg)); 289 pcmcia_access_configuration_register(link, &reg));
290 udelay(1000); 290 udelay(1000);
291 return 0; 291 return 0;
292 292
293 cs_failed: 293 cs_failed:
294 cs_error(link->handle, last_fn, last_ret); 294 cs_error(link, last_fn, last_ret);
295 return -ENODEV; 295 return -ENODEV;
296} 296}
297 297
@@ -441,7 +441,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block)
441 * care of the PDA - read it and then write it on top of the firmware. 441 * care of the PDA - read it and then write it on top of the firmware.
442 */ 442 */
443static int 443static int
444spectrum_dl_image(hermes_t *hw, dev_link_t *link, 444spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
445 const unsigned char *image) 445 const unsigned char *image)
446{ 446{
447 int ret; 447 int ret;
@@ -505,14 +505,13 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link,
505 * reset on the card, to make sure it's in a sane state. 505 * reset on the card, to make sure it's in a sane state.
506 */ 506 */
507static int 507static int
508spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) 508spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link)
509{ 509{
510 int ret; 510 int ret;
511 client_handle_t handle = link->handle;
512 const struct firmware *fw_entry; 511 const struct firmware *fw_entry;
513 512
514 if (request_firmware(&fw_entry, primary_fw_name, 513 if (request_firmware(&fw_entry, primary_fw_name,
515 &handle_to_dev(handle)) == 0) { 514 &handle_to_dev(link)) == 0) {
516 primsym = fw_entry->data; 515 primsym = fw_entry->data;
517 } else { 516 } else {
518 printk(KERN_ERR PFX "Cannot find firmware: %s\n", 517 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
@@ -521,7 +520,7 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link)
521 } 520 }
522 521
523 if (request_firmware(&fw_entry, secondary_fw_name, 522 if (request_firmware(&fw_entry, secondary_fw_name,
524 &handle_to_dev(handle)) == 0) { 523 &handle_to_dev(link)) == 0) {
525 secsym = fw_entry->data; 524 secsym = fw_entry->data;
526 } else { 525 } else {
527 printk(KERN_ERR PFX "Cannot find firmware: %s\n", 526 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
@@ -554,7 +553,7 @@ static int
554spectrum_cs_hard_reset(struct orinoco_private *priv) 553spectrum_cs_hard_reset(struct orinoco_private *priv)
555{ 554{
556 struct orinoco_pccard *card = priv->card; 555 struct orinoco_pccard *card = priv->card;
557 dev_link_t *link = card->p_dev; 556 struct pcmcia_device *link = card->p_dev;
558 int err; 557 int err;
559 558
560 if (!hermes_present(&priv->hw)) { 559 if (!hermes_present(&priv->hw)) {
@@ -584,12 +583,11 @@ spectrum_cs_hard_reset(struct orinoco_private *priv)
584 * configure the card at this point -- we wait until we receive a card 583 * configure the card at this point -- we wait until we receive a card
585 * insertion event. */ 584 * insertion event. */
586static int 585static int
587spectrum_cs_attach(struct pcmcia_device *p_dev) 586spectrum_cs_attach(struct pcmcia_device *link)
588{ 587{
589 struct net_device *dev; 588 struct net_device *dev;
590 struct orinoco_private *priv; 589 struct orinoco_private *priv;
591 struct orinoco_pccard *card; 590 struct orinoco_pccard *card;
592 dev_link_t *link = dev_to_instance(p_dev);
593 591
594 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); 592 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset);
595 if (! dev) 593 if (! dev)
@@ -598,7 +596,7 @@ spectrum_cs_attach(struct pcmcia_device *p_dev)
598 card = priv->card; 596 card = priv->card;
599 597
600 /* Link both structures together */ 598 /* Link both structures together */
601 card->p_dev = p_dev; 599 card->p_dev = link;
602 link->priv = dev; 600 link->priv = dev;
603 601
604 /* Interrupt setup */ 602 /* Interrupt setup */
@@ -627,9 +625,8 @@ spectrum_cs_attach(struct pcmcia_device *p_dev)
627 * are freed. Otherwise, the structures will be freed when the device 625 * are freed. Otherwise, the structures will be freed when the device
628 * is released. 626 * is released.
629 */ 627 */
630static void spectrum_cs_detach(struct pcmcia_device *p_dev) 628static void spectrum_cs_detach(struct pcmcia_device *link)
631{ 629{
632 dev_link_t *link = dev_to_instance(p_dev);
633 struct net_device *dev = link->priv; 630 struct net_device *dev = link->priv;
634 631
635 if (link->state & DEV_CONFIG) 632 if (link->state & DEV_CONFIG)
@@ -651,10 +648,9 @@ static void spectrum_cs_detach(struct pcmcia_device *p_dev)
651 */ 648 */
652 649
653static void 650static void
654spectrum_cs_config(dev_link_t *link) 651spectrum_cs_config(struct pcmcia_device *link)
655{ 652{
656 struct net_device *dev = link->priv; 653 struct net_device *dev = link->priv;
657 client_handle_t handle = link->handle;
658 struct orinoco_private *priv = netdev_priv(dev); 654 struct orinoco_private *priv = netdev_priv(dev);
659 struct orinoco_pccard *card = priv->card; 655 struct orinoco_pccard *card = priv->card;
660 hermes_t *hw = &priv->hw; 656 hermes_t *hw = &priv->hw;
@@ -666,7 +662,7 @@ spectrum_cs_config(dev_link_t *link)
666 cisparse_t parse; 662 cisparse_t parse;
667 void __iomem *mem; 663 void __iomem *mem;
668 664
669 CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info)); 665 CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info));
670 666
671 /* 667 /*
672 * This reads the card's CONFIG tuple to find its 668 * This reads the card's CONFIG tuple to find its
@@ -677,9 +673,9 @@ spectrum_cs_config(dev_link_t *link)
677 tuple.TupleData = buf; 673 tuple.TupleData = buf;
678 tuple.TupleDataMax = sizeof(buf); 674 tuple.TupleDataMax = sizeof(buf);
679 tuple.TupleOffset = 0; 675 tuple.TupleOffset = 0;
680 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 676 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
681 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 677 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
682 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 678 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
683 link->conf.ConfigBase = parse.config.base; 679 link->conf.ConfigBase = parse.config.base;
684 link->conf.Present = parse.config.rmask[0]; 680 link->conf.Present = parse.config.rmask[0];
685 681
@@ -688,7 +684,7 @@ spectrum_cs_config(dev_link_t *link)
688 684
689 /* Look up the current Vcc */ 685 /* Look up the current Vcc */
690 CS_CHECK(GetConfigurationInfo, 686 CS_CHECK(GetConfigurationInfo,
691 pcmcia_get_configuration_info(handle, &conf)); 687 pcmcia_get_configuration_info(link, &conf));
692 688
693 /* 689 /*
694 * In this loop, we scan the CIS for configuration table 690 * In this loop, we scan the CIS for configuration table
@@ -705,13 +701,13 @@ spectrum_cs_config(dev_link_t *link)
705 * implementation-defined details. 701 * implementation-defined details.
706 */ 702 */
707 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 703 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
708 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 704 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
709 while (1) { 705 while (1) {
710 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 706 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
711 cistpl_cftable_entry_t dflt = { .index = 0 }; 707 cistpl_cftable_entry_t dflt = { .index = 0 };
712 708
713 if ( (pcmcia_get_tuple_data(handle, &tuple) != 0) 709 if ( (pcmcia_get_tuple_data(link, &tuple) != 0)
714 || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0)) 710 || (pcmcia_parse_tuple(link, &tuple, &parse) != 0))
715 goto next_entry; 711 goto next_entry;
716 712
717 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 713 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
@@ -776,7 +772,7 @@ spectrum_cs_config(dev_link_t *link)
776 } 772 }
777 773
778 /* This reserves IO space but doesn't actually enable it */ 774 /* This reserves IO space but doesn't actually enable it */
779 if (pcmcia_request_io(link->handle, &link->io) != 0) 775 if (pcmcia_request_io(link, &link->io) != 0)
780 goto next_entry; 776 goto next_entry;
781 } 777 }
782 778
@@ -786,8 +782,8 @@ spectrum_cs_config(dev_link_t *link)
786 break; 782 break;
787 783
788 next_entry: 784 next_entry:
789 pcmcia_disable_device(handle); 785 pcmcia_disable_device(link);
790 last_ret = pcmcia_get_next_tuple(handle, &tuple); 786 last_ret = pcmcia_get_next_tuple(link, &tuple);
791 if (last_ret == CS_NO_MORE_ITEMS) { 787 if (last_ret == CS_NO_MORE_ITEMS) {
792 printk(KERN_ERR PFX "GetNextTuple(): No matching " 788 printk(KERN_ERR PFX "GetNextTuple(): No matching "
793 "CIS configuration. Maybe you need the " 789 "CIS configuration. Maybe you need the "
@@ -801,7 +797,7 @@ spectrum_cs_config(dev_link_t *link)
801 * a handler to the interrupt, unless the 'Handler' member of 797 * a handler to the interrupt, unless the 'Handler' member of
802 * the irq structure is initialized. 798 * the irq structure is initialized.
803 */ 799 */
804 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 800 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
805 801
806 /* We initialize the hermes structure before completing PCMCIA 802 /* We initialize the hermes structure before completing PCMCIA
807 * configuration just in case the interrupt handler gets 803 * configuration just in case the interrupt handler gets
@@ -818,7 +814,7 @@ spectrum_cs_config(dev_link_t *link)
818 * card and host interface into "Memory and IO" mode. 814 * card and host interface into "Memory and IO" mode.
819 */ 815 */
820 CS_CHECK(RequestConfiguration, 816 CS_CHECK(RequestConfiguration,
821 pcmcia_request_configuration(link->handle, &link->conf)); 817 pcmcia_request_configuration(link, &link->conf));
822 818
823 /* Ok, we have the configuration, prepare to register the netdev */ 819 /* Ok, we have the configuration, prepare to register the netdev */
824 dev->base_addr = link->io.BasePort1; 820 dev->base_addr = link->io.BasePort1;
@@ -831,7 +827,7 @@ spectrum_cs_config(dev_link_t *link)
831 goto failed; 827 goto failed;
832 } 828 }
833 829
834 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 830 SET_NETDEV_DEV(dev, &handle_to_dev(link));
835 /* Tell the stack we exist */ 831 /* Tell the stack we exist */
836 if (register_netdev(dev) != 0) { 832 if (register_netdev(dev) != 0) {
837 printk(KERN_ERR PFX "register_netdev() failed\n"); 833 printk(KERN_ERR PFX "register_netdev() failed\n");
@@ -864,7 +860,7 @@ spectrum_cs_config(dev_link_t *link)
864 return; 860 return;
865 861
866 cs_failed: 862 cs_failed:
867 cs_error(link->handle, last_fn, last_ret); 863 cs_error(link, last_fn, last_ret);
868 864
869 failed: 865 failed:
870 spectrum_cs_release(link); 866 spectrum_cs_release(link);
@@ -876,7 +872,7 @@ spectrum_cs_config(dev_link_t *link)
876 * still open, this will be postponed until it is closed. 872 * still open, this will be postponed until it is closed.
877 */ 873 */
878static void 874static void
879spectrum_cs_release(dev_link_t *link) 875spectrum_cs_release(struct pcmcia_device *link)
880{ 876{
881 struct net_device *dev = link->priv; 877 struct net_device *dev = link->priv;
882 struct orinoco_private *priv = netdev_priv(dev); 878 struct orinoco_private *priv = netdev_priv(dev);
@@ -888,16 +884,15 @@ spectrum_cs_release(dev_link_t *link)
888 priv->hw_unavailable++; 884 priv->hw_unavailable++;
889 spin_unlock_irqrestore(&priv->lock, flags); 885 spin_unlock_irqrestore(&priv->lock, flags);
890 886
891 pcmcia_disable_device(link->handle); 887 pcmcia_disable_device(link);
892 if (priv->hw.iobase) 888 if (priv->hw.iobase)
893 ioport_unmap(priv->hw.iobase); 889 ioport_unmap(priv->hw.iobase);
894} /* spectrum_cs_release */ 890} /* spectrum_cs_release */
895 891
896 892
897static int 893static int
898spectrum_cs_suspend(struct pcmcia_device *p_dev) 894spectrum_cs_suspend(struct pcmcia_device *link)
899{ 895{
900 dev_link_t *link = dev_to_instance(p_dev);
901 struct net_device *dev = link->priv; 896 struct net_device *dev = link->priv;
902 struct orinoco_private *priv = netdev_priv(dev); 897 struct orinoco_private *priv = netdev_priv(dev);
903 unsigned long flags; 898 unsigned long flags;
@@ -922,9 +917,8 @@ spectrum_cs_suspend(struct pcmcia_device *p_dev)
922} 917}
923 918
924static int 919static int
925spectrum_cs_resume(struct pcmcia_device *p_dev) 920spectrum_cs_resume(struct pcmcia_device *link)
926{ 921{
927 dev_link_t *link = dev_to_instance(p_dev);
928 struct net_device *dev = link->priv; 922 struct net_device *dev = link->priv;
929 struct orinoco_private *priv = netdev_priv(dev); 923 struct orinoco_private *priv = netdev_priv(dev);
930 924
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index baa1011e70e0..352d4a50b799 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -1005,7 +1005,7 @@ static inline void
1005wv_82593_reconfig(struct net_device * dev) 1005wv_82593_reconfig(struct net_device * dev)
1006{ 1006{
1007 net_local * lp = netdev_priv(dev); 1007 net_local * lp = netdev_priv(dev);
1008 dev_link_t * link = lp->link; 1008 struct pcmcia_device * link = lp->link;
1009 unsigned long flags; 1009 unsigned long flags;
1010 1010
1011 /* Arm the flag, will be cleard in wv_82593_config() */ 1011 /* Arm the flag, will be cleard in wv_82593_config() */
@@ -3744,16 +3744,16 @@ wv_pcmcia_reset(struct net_device * dev)
3744{ 3744{
3745 int i; 3745 int i;
3746 conf_reg_t reg = { 0, CS_READ, CISREG_COR, 0 }; 3746 conf_reg_t reg = { 0, CS_READ, CISREG_COR, 0 };
3747 dev_link_t * link = ((net_local *)netdev_priv(dev))->link; 3747 struct pcmcia_device * link = ((net_local *)netdev_priv(dev))->link;
3748 3748
3749#ifdef DEBUG_CONFIG_TRACE 3749#ifdef DEBUG_CONFIG_TRACE
3750 printk(KERN_DEBUG "%s: ->wv_pcmcia_reset()\n", dev->name); 3750 printk(KERN_DEBUG "%s: ->wv_pcmcia_reset()\n", dev->name);
3751#endif 3751#endif
3752 3752
3753 i = pcmcia_access_configuration_register(link->handle, &reg); 3753 i = pcmcia_access_configuration_register(link, &reg);
3754 if(i != CS_SUCCESS) 3754 if(i != CS_SUCCESS)
3755 { 3755 {
3756 cs_error(link->handle, AccessConfigurationRegister, i); 3756 cs_error(link, AccessConfigurationRegister, i);
3757 return FALSE; 3757 return FALSE;
3758 } 3758 }
3759 3759
@@ -3764,19 +3764,19 @@ wv_pcmcia_reset(struct net_device * dev)
3764 3764
3765 reg.Action = CS_WRITE; 3765 reg.Action = CS_WRITE;
3766 reg.Value = reg.Value | COR_SW_RESET; 3766 reg.Value = reg.Value | COR_SW_RESET;
3767 i = pcmcia_access_configuration_register(link->handle, &reg); 3767 i = pcmcia_access_configuration_register(link, &reg);
3768 if(i != CS_SUCCESS) 3768 if(i != CS_SUCCESS)
3769 { 3769 {
3770 cs_error(link->handle, AccessConfigurationRegister, i); 3770 cs_error(link, AccessConfigurationRegister, i);
3771 return FALSE; 3771 return FALSE;
3772 } 3772 }
3773 3773
3774 reg.Action = CS_WRITE; 3774 reg.Action = CS_WRITE;
3775 reg.Value = COR_LEVEL_IRQ | COR_CONFIG; 3775 reg.Value = COR_LEVEL_IRQ | COR_CONFIG;
3776 i = pcmcia_access_configuration_register(link->handle, &reg); 3776 i = pcmcia_access_configuration_register(link, &reg);
3777 if(i != CS_SUCCESS) 3777 if(i != CS_SUCCESS)
3778 { 3778 {
3779 cs_error(link->handle, AccessConfigurationRegister, i); 3779 cs_error(link, AccessConfigurationRegister, i);
3780 return FALSE; 3780 return FALSE;
3781 } 3781 }
3782 3782
@@ -3940,9 +3940,8 @@ wv_hw_reset(struct net_device * dev)
3940 * (called by wavelan_event()) 3940 * (called by wavelan_event())
3941 */ 3941 */
3942static inline int 3942static inline int
3943wv_pcmcia_config(dev_link_t * link) 3943wv_pcmcia_config(struct pcmcia_device * link)
3944{ 3944{
3945 client_handle_t handle = link->handle;
3946 tuple_t tuple; 3945 tuple_t tuple;
3947 cisparse_t parse; 3946 cisparse_t parse;
3948 struct net_device * dev = (struct net_device *) link->priv; 3947 struct net_device * dev = (struct net_device *) link->priv;
@@ -3965,16 +3964,16 @@ wv_pcmcia_config(dev_link_t * link)
3965 { 3964 {
3966 tuple.Attributes = 0; 3965 tuple.Attributes = 0;
3967 tuple.DesiredTuple = CISTPL_CONFIG; 3966 tuple.DesiredTuple = CISTPL_CONFIG;
3968 i = pcmcia_get_first_tuple(handle, &tuple); 3967 i = pcmcia_get_first_tuple(link, &tuple);
3969 if(i != CS_SUCCESS) 3968 if(i != CS_SUCCESS)
3970 break; 3969 break;
3971 tuple.TupleData = (cisdata_t *)buf; 3970 tuple.TupleData = (cisdata_t *)buf;
3972 tuple.TupleDataMax = 64; 3971 tuple.TupleDataMax = 64;
3973 tuple.TupleOffset = 0; 3972 tuple.TupleOffset = 0;
3974 i = pcmcia_get_tuple_data(handle, &tuple); 3973 i = pcmcia_get_tuple_data(link, &tuple);
3975 if(i != CS_SUCCESS) 3974 if(i != CS_SUCCESS)
3976 break; 3975 break;
3977 i = pcmcia_parse_tuple(handle, &tuple, &parse); 3976 i = pcmcia_parse_tuple(link, &tuple, &parse);
3978 if(i != CS_SUCCESS) 3977 if(i != CS_SUCCESS)
3979 break; 3978 break;
3980 link->conf.ConfigBase = parse.config.base; 3979 link->conf.ConfigBase = parse.config.base;
@@ -3983,7 +3982,7 @@ wv_pcmcia_config(dev_link_t * link)
3983 while(0); 3982 while(0);
3984 if(i != CS_SUCCESS) 3983 if(i != CS_SUCCESS)
3985 { 3984 {
3986 cs_error(link->handle, ParseTuple, i); 3985 cs_error(link, ParseTuple, i);
3987 link->state &= ~DEV_CONFIG_PENDING; 3986 link->state &= ~DEV_CONFIG_PENDING;
3988 return FALSE; 3987 return FALSE;
3989 } 3988 }
@@ -3992,10 +3991,10 @@ wv_pcmcia_config(dev_link_t * link)
3992 link->state |= DEV_CONFIG; 3991 link->state |= DEV_CONFIG;
3993 do 3992 do
3994 { 3993 {
3995 i = pcmcia_request_io(link->handle, &link->io); 3994 i = pcmcia_request_io(link, &link->io);
3996 if(i != CS_SUCCESS) 3995 if(i != CS_SUCCESS)
3997 { 3996 {
3998 cs_error(link->handle, RequestIO, i); 3997 cs_error(link, RequestIO, i);
3999 break; 3998 break;
4000 } 3999 }
4001 4000
@@ -4003,10 +4002,10 @@ wv_pcmcia_config(dev_link_t * link)
4003 * Now allocate an interrupt line. Note that this does not 4002 * Now allocate an interrupt line. Note that this does not
4004 * actually assign a handler to the interrupt. 4003 * actually assign a handler to the interrupt.
4005 */ 4004 */
4006 i = pcmcia_request_irq(link->handle, &link->irq); 4005 i = pcmcia_request_irq(link, &link->irq);
4007 if(i != CS_SUCCESS) 4006 if(i != CS_SUCCESS)
4008 { 4007 {
4009 cs_error(link->handle, RequestIRQ, i); 4008 cs_error(link, RequestIRQ, i);
4010 break; 4009 break;
4011 } 4010 }
4012 4011
@@ -4015,15 +4014,15 @@ wv_pcmcia_config(dev_link_t * link)
4015 * the I/O windows and the interrupt mapping. 4014 * the I/O windows and the interrupt mapping.
4016 */ 4015 */
4017 link->conf.ConfigIndex = 1; 4016 link->conf.ConfigIndex = 1;
4018 i = pcmcia_request_configuration(link->handle, &link->conf); 4017 i = pcmcia_request_configuration(link, &link->conf);
4019 if(i != CS_SUCCESS) 4018 if(i != CS_SUCCESS)
4020 { 4019 {
4021 cs_error(link->handle, RequestConfiguration, i); 4020 cs_error(link, RequestConfiguration, i);
4022 break; 4021 break;
4023 } 4022 }
4024 4023
4025 /* 4024 /*
4026 * Allocate a small memory window. Note that the dev_link_t 4025 * Allocate a small memory window. Note that the struct pcmcia_device
4027 * structure provides space for one window handle -- if your 4026 * structure provides space for one window handle -- if your
4028 * device needs several windows, you'll need to keep track of 4027 * device needs several windows, you'll need to keep track of
4029 * the handles in your private data structure, link->priv. 4028 * the handles in your private data structure, link->priv.
@@ -4031,10 +4030,10 @@ wv_pcmcia_config(dev_link_t * link)
4031 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 4030 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
4032 req.Base = req.Size = 0; 4031 req.Base = req.Size = 0;
4033 req.AccessSpeed = mem_speed; 4032 req.AccessSpeed = mem_speed;
4034 i = pcmcia_request_window(&link->handle, &req, &link->win); 4033 i = pcmcia_request_window(&link, &req, &link->win);
4035 if(i != CS_SUCCESS) 4034 if(i != CS_SUCCESS)
4036 { 4035 {
4037 cs_error(link->handle, RequestWindow, i); 4036 cs_error(link, RequestWindow, i);
4038 break; 4037 break;
4039 } 4038 }
4040 4039
@@ -4046,7 +4045,7 @@ wv_pcmcia_config(dev_link_t * link)
4046 i = pcmcia_map_mem_page(link->win, &mem); 4045 i = pcmcia_map_mem_page(link->win, &mem);
4047 if(i != CS_SUCCESS) 4046 if(i != CS_SUCCESS)
4048 { 4047 {
4049 cs_error(link->handle, MapMemPage, i); 4048 cs_error(link, MapMemPage, i);
4050 break; 4049 break;
4051 } 4050 }
4052 4051
@@ -4060,7 +4059,7 @@ wv_pcmcia_config(dev_link_t * link)
4060 lp->mem, dev->irq, (u_int) dev->base_addr); 4059 lp->mem, dev->irq, (u_int) dev->base_addr);
4061#endif 4060#endif
4062 4061
4063 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 4062 SET_NETDEV_DEV(dev, &handle_to_dev(link));
4064 i = register_netdev(dev); 4063 i = register_netdev(dev);
4065 if(i != 0) 4064 if(i != 0)
4066 { 4065 {
@@ -4096,7 +4095,7 @@ wv_pcmcia_config(dev_link_t * link)
4096 * still open, this will be postponed until it is closed. 4095 * still open, this will be postponed until it is closed.
4097 */ 4096 */
4098static void 4097static void
4099wv_pcmcia_release(dev_link_t *link) 4098wv_pcmcia_release(struct pcmcia_device *link)
4100{ 4099{
4101 struct net_device * dev = (struct net_device *) link->priv; 4100 struct net_device * dev = (struct net_device *) link->priv;
4102 net_local * lp = netdev_priv(dev); 4101 net_local * lp = netdev_priv(dev);
@@ -4106,7 +4105,7 @@ wv_pcmcia_release(dev_link_t *link)
4106#endif 4105#endif
4107 4106
4108 iounmap(lp->mem); 4107 iounmap(lp->mem);
4109 pcmcia_disable_device(link->handle); 4108 pcmcia_disable_device(link);
4110 4109
4111#ifdef DEBUG_CONFIG_TRACE 4110#ifdef DEBUG_CONFIG_TRACE
4112 printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name); 4111 printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
@@ -4473,7 +4472,7 @@ static int
4473wavelan_open(struct net_device * dev) 4472wavelan_open(struct net_device * dev)
4474{ 4473{
4475 net_local * lp = netdev_priv(dev); 4474 net_local * lp = netdev_priv(dev);
4476 dev_link_t * link = lp->link; 4475 struct pcmcia_device * link = lp->link;
4477 kio_addr_t base = dev->base_addr; 4476 kio_addr_t base = dev->base_addr;
4478 4477
4479#ifdef DEBUG_CALLBACK_TRACE 4478#ifdef DEBUG_CALLBACK_TRACE
@@ -4527,7 +4526,7 @@ wavelan_open(struct net_device * dev)
4527static int 4526static int
4528wavelan_close(struct net_device * dev) 4527wavelan_close(struct net_device * dev)
4529{ 4528{
4530 dev_link_t * link = ((net_local *)netdev_priv(dev))->link; 4529 struct pcmcia_device * link = ((net_local *)netdev_priv(dev))->link;
4531 kio_addr_t base = dev->base_addr; 4530 kio_addr_t base = dev->base_addr;
4532 4531
4533#ifdef DEBUG_CALLBACK_TRACE 4532#ifdef DEBUG_CALLBACK_TRACE
@@ -4673,10 +4672,8 @@ wavelan_attach(struct pcmcia_device *p_dev)
4673 * is released. 4672 * is released.
4674 */ 4673 */
4675static void 4674static void
4676wavelan_detach(struct pcmcia_device *p_dev) 4675wavelan_detach(struct pcmcia_device *link)
4677{ 4676{
4678 dev_link_t *link = dev_to_instance(p_dev);
4679
4680#ifdef DEBUG_CALLBACK_TRACE 4677#ifdef DEBUG_CALLBACK_TRACE
4681 printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); 4678 printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link);
4682#endif 4679#endif
@@ -4713,9 +4710,8 @@ wavelan_detach(struct pcmcia_device *p_dev)
4713#endif 4710#endif
4714} 4711}
4715 4712
4716static int wavelan_suspend(struct pcmcia_device *p_dev) 4713static int wavelan_suspend(struct pcmcia_device *link)
4717{ 4714{
4718 dev_link_t *link = dev_to_instance(p_dev);
4719 struct net_device * dev = (struct net_device *) link->priv; 4715 struct net_device * dev = (struct net_device *) link->priv;
4720 4716
4721 /* NB: wavelan_close will be called, but too late, so we are 4717 /* NB: wavelan_close will be called, but too late, so we are
@@ -4736,9 +4732,8 @@ static int wavelan_suspend(struct pcmcia_device *p_dev)
4736 return 0; 4732 return 0;
4737} 4733}
4738 4734
4739static int wavelan_resume(struct pcmcia_device *p_dev) 4735static int wavelan_resume(struct pcmcia_device *link)
4740{ 4736{
4741 dev_link_t *link = dev_to_instance(p_dev);
4742 struct net_device * dev = (struct net_device *) link->priv; 4737 struct net_device * dev = (struct net_device *) link->priv;
4743 4738
4744 link->state &= ~DEV_SUSPEND; 4739 link->state &= ~DEV_SUSPEND;
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index 451f6271dcbc..c65fe7a391ec 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -602,7 +602,7 @@ struct net_local
602 dev_node_t node; /* ???? What is this stuff ???? */ 602 dev_node_t node; /* ???? What is this stuff ???? */
603 struct net_device * dev; /* Reverse link... */ 603 struct net_device * dev; /* Reverse link... */
604 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ 604 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
605 dev_link_t * link; /* pcmcia structure */ 605 struct pcmcia_device * link; /* pcmcia structure */
606 en_stats stats; /* Ethernet interface statistics */ 606 en_stats stats; /* Ethernet interface statistics */
607 int nresets; /* Number of hw resets */ 607 int nresets; /* Number of hw resets */
608 u_char configured; /* If it is configured */ 608 u_char configured; /* If it is configured */
@@ -733,9 +733,9 @@ static int
733static inline void 733static inline void
734 wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ 734 wv_hw_reset(struct net_device *); /* Same, + start receiver unit */
735static inline int 735static inline int
736 wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */ 736 wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */
737static void 737static void
738 wv_pcmcia_release(dev_link_t *);/* Remove a device */ 738 wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */
739/* ---------------------- INTERRUPT HANDLING ---------------------- */ 739/* ---------------------- INTERRUPT HANDLING ---------------------- */
740static irqreturn_t 740static irqreturn_t
741 wavelan_interrupt(int, /* Interrupt handler */ 741 wavelan_interrupt(int, /* Interrupt handler */
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 4b054f54e9d5..752d22260080 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -103,8 +103,8 @@ module_param(pc_debug, int, 0);
103 * release a socket, in response to card insertion and ejection events. They 103 * release a socket, in response to card insertion and ejection events. They
104 * are invoked from the wl24 event handler. 104 * are invoked from the wl24 event handler.
105 */ 105 */
106static void wl3501_config(dev_link_t *link); 106static void wl3501_config(struct pcmcia_device *link);
107static void wl3501_release(dev_link_t *link); 107static void wl3501_release(struct pcmcia_device *link);
108 108
109/* 109/*
110 * The dev_info variable is the "key" that is used to match up this 110 * The dev_info variable is the "key" that is used to match up this
@@ -1270,7 +1270,7 @@ static int wl3501_close(struct net_device *dev)
1270 struct wl3501_card *this = dev->priv; 1270 struct wl3501_card *this = dev->priv;
1271 int rc = -ENODEV; 1271 int rc = -ENODEV;
1272 unsigned long flags; 1272 unsigned long flags;
1273 dev_link_t *link; 1273 struct pcmcia_device *link;
1274 link = this->p_dev; 1274 link = this->p_dev;
1275 1275
1276 spin_lock_irqsave(&this->lock, flags); 1276 spin_lock_irqsave(&this->lock, flags);
@@ -1383,7 +1383,7 @@ static int wl3501_open(struct net_device *dev)
1383 int rc = -ENODEV; 1383 int rc = -ENODEV;
1384 struct wl3501_card *this = dev->priv; 1384 struct wl3501_card *this = dev->priv;
1385 unsigned long flags; 1385 unsigned long flags;
1386 dev_link_t *link; 1386 struct pcmcia_device *link;
1387 link = this->p_dev; 1387 link = this->p_dev;
1388 1388
1389 spin_lock_irqsave(&this->lock, flags); 1389 spin_lock_irqsave(&this->lock, flags);
@@ -1477,9 +1477,8 @@ static struct ethtool_ops ops = {
1477 * Services. If it has been released, all local data structures are freed. 1477 * Services. If it has been released, all local data structures are freed.
1478 * Otherwise, the structures will be freed when the device is released. 1478 * Otherwise, the structures will be freed when the device is released.
1479 */ 1479 */
1480static void wl3501_detach(struct pcmcia_device *p_dev) 1480static void wl3501_detach(struct pcmcia_device *link)
1481{ 1481{
1482 dev_link_t *link = dev_to_instance(p_dev);
1483 struct net_device *dev = link->priv; 1482 struct net_device *dev = link->priv;
1484 1483
1485 /* If the device is currently configured and active, we won't actually 1484 /* If the device is currently configured and active, we won't actually
@@ -1925,23 +1924,22 @@ static int wl3501_attach(struct pcmcia_device *p_dev)
1925{ 1924{
1926 struct net_device *dev; 1925 struct net_device *dev;
1927 struct wl3501_card *this; 1926 struct wl3501_card *this;
1928 dev_link_t *link = dev_to_instance(p_dev);
1929 1927
1930 /* The io structure describes IO port mapping */ 1928 /* The io structure describes IO port mapping */
1931 link->io.NumPorts1 = 16; 1929 p_dev->io.NumPorts1 = 16;
1932 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1930 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
1933 link->io.IOAddrLines = 5; 1931 p_dev->io.IOAddrLines = 5;
1934 1932
1935 /* Interrupt setup */ 1933 /* Interrupt setup */
1936 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 1934 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
1937 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 1935 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
1938 link->irq.Handler = wl3501_interrupt; 1936 p_dev->irq.Handler = wl3501_interrupt;
1939 1937
1940 /* General socket configuration */ 1938 /* General socket configuration */
1941 link->conf.Attributes = CONF_ENABLE_IRQ; 1939 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
1942 link->conf.IntType = INT_MEMORY_AND_IO; 1940 p_dev->conf.IntType = INT_MEMORY_AND_IO;
1943 link->conf.ConfigIndex = 1; 1941 p_dev->conf.ConfigIndex = 1;
1944 link->conf.Present = PRESENT_OPTION; 1942 p_dev->conf.Present = PRESENT_OPTION;
1945 1943
1946 dev = alloc_etherdev(sizeof(struct wl3501_card)); 1944 dev = alloc_etherdev(sizeof(struct wl3501_card));
1947 if (!dev) 1945 if (!dev)
@@ -1959,9 +1957,9 @@ static int wl3501_attach(struct pcmcia_device *p_dev)
1959 dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; 1957 dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def;
1960 SET_ETHTOOL_OPS(dev, &ops); 1958 SET_ETHTOOL_OPS(dev, &ops);
1961 netif_stop_queue(dev); 1959 netif_stop_queue(dev);
1962 link->priv = link->irq.Instance = dev; 1960 p_dev->priv = p_dev->irq.Instance = dev;
1963 1961
1964 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1962 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1965 wl3501_config(p_dev); 1963 wl3501_config(p_dev);
1966 1964
1967 return 0; 1965 return 0;
@@ -1980,11 +1978,10 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1980 * received, to configure the PCMCIA socket, and to make the ethernet device 1978 * received, to configure the PCMCIA socket, and to make the ethernet device
1981 * available to the system. 1979 * available to the system.
1982 */ 1980 */
1983static void wl3501_config(dev_link_t *link) 1981static void wl3501_config(struct pcmcia_device *link)
1984{ 1982{
1985 tuple_t tuple; 1983 tuple_t tuple;
1986 cisparse_t parse; 1984 cisparse_t parse;
1987 client_handle_t handle = link->handle;
1988 struct net_device *dev = link->priv; 1985 struct net_device *dev = link->priv;
1989 int i = 0, j, last_fn, last_ret; 1986 int i = 0, j, last_fn, last_ret;
1990 unsigned char bf[64]; 1987 unsigned char bf[64];
@@ -1993,12 +1990,12 @@ static void wl3501_config(dev_link_t *link)
1993 /* This reads the card's CONFIG tuple to find its config registers. */ 1990 /* This reads the card's CONFIG tuple to find its config registers. */
1994 tuple.Attributes = 0; 1991 tuple.Attributes = 0;
1995 tuple.DesiredTuple = CISTPL_CONFIG; 1992 tuple.DesiredTuple = CISTPL_CONFIG;
1996 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 1993 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
1997 tuple.TupleData = bf; 1994 tuple.TupleData = bf;
1998 tuple.TupleDataMax = sizeof(bf); 1995 tuple.TupleDataMax = sizeof(bf);
1999 tuple.TupleOffset = 0; 1996 tuple.TupleOffset = 0;
2000 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 1997 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
2001 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 1998 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
2002 link->conf.ConfigBase = parse.config.base; 1999 link->conf.ConfigBase = parse.config.base;
2003 link->conf.Present = parse.config.rmask[0]; 2000 link->conf.Present = parse.config.rmask[0];
2004 2001
@@ -2014,28 +2011,28 @@ static void wl3501_config(dev_link_t *link)
2014 * 0x200-0x2ff, and so on, because this seems safer */ 2011 * 0x200-0x2ff, and so on, because this seems safer */
2015 link->io.BasePort1 = j; 2012 link->io.BasePort1 = j;
2016 link->io.BasePort2 = link->io.BasePort1 + 0x10; 2013 link->io.BasePort2 = link->io.BasePort1 + 0x10;
2017 i = pcmcia_request_io(link->handle, &link->io); 2014 i = pcmcia_request_io(link, &link->io);
2018 if (i == CS_SUCCESS) 2015 if (i == CS_SUCCESS)
2019 break; 2016 break;
2020 } 2017 }
2021 if (i != CS_SUCCESS) { 2018 if (i != CS_SUCCESS) {
2022 cs_error(link->handle, RequestIO, i); 2019 cs_error(link, RequestIO, i);
2023 goto failed; 2020 goto failed;
2024 } 2021 }
2025 2022
2026 /* Now allocate an interrupt line. Note that this does not actually 2023 /* Now allocate an interrupt line. Note that this does not actually
2027 * assign a handler to the interrupt. */ 2024 * assign a handler to the interrupt. */
2028 2025
2029 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 2026 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
2030 2027
2031 /* This actually configures the PCMCIA socket -- setting up the I/O 2028 /* This actually configures the PCMCIA socket -- setting up the I/O
2032 * windows and the interrupt mapping. */ 2029 * windows and the interrupt mapping. */
2033 2030
2034 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 2031 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
2035 2032
2036 dev->irq = link->irq.AssignedIRQ; 2033 dev->irq = link->irq.AssignedIRQ;
2037 dev->base_addr = link->io.BasePort1; 2034 dev->base_addr = link->io.BasePort1;
2038 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 2035 SET_NETDEV_DEV(dev, &handle_to_dev(link));
2039 if (register_netdev(dev)) { 2036 if (register_netdev(dev)) {
2040 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); 2037 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n");
2041 goto failed; 2038 goto failed;
@@ -2087,7 +2084,7 @@ static void wl3501_config(dev_link_t *link)
2087 netif_start_queue(dev); 2084 netif_start_queue(dev);
2088 goto out; 2085 goto out;
2089cs_failed: 2086cs_failed:
2090 cs_error(link->handle, last_fn, last_ret); 2087 cs_error(link, last_fn, last_ret);
2091failed: 2088failed:
2092 wl3501_release(link); 2089 wl3501_release(link);
2093out: 2090out:
@@ -2102,7 +2099,7 @@ out:
2102 * and release the PCMCIA configuration. If the device is still open, this 2099 * and release the PCMCIA configuration. If the device is still open, this
2103 * will be postponed until it is closed. 2100 * will be postponed until it is closed.
2104 */ 2101 */
2105static void wl3501_release(dev_link_t *link) 2102static void wl3501_release(struct pcmcia_device *link)
2106{ 2103{
2107 struct net_device *dev = link->priv; 2104 struct net_device *dev = link->priv;
2108 2105
@@ -2110,12 +2107,11 @@ static void wl3501_release(dev_link_t *link)
2110 if (link->dev_node) 2107 if (link->dev_node)
2111 unregister_netdev(dev); 2108 unregister_netdev(dev);
2112 2109
2113 pcmcia_disable_device(link->handle); 2110 pcmcia_disable_device(link);
2114} 2111}
2115 2112
2116static int wl3501_suspend(struct pcmcia_device *p_dev) 2113static int wl3501_suspend(struct pcmcia_device *link)
2117{ 2114{
2118 dev_link_t *link = dev_to_instance(p_dev);
2119 struct net_device *dev = link->priv; 2115 struct net_device *dev = link->priv;
2120 2116
2121 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); 2117 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND);
@@ -2125,9 +2121,8 @@ static int wl3501_suspend(struct pcmcia_device *p_dev)
2125 return 0; 2121 return 0;
2126} 2122}
2127 2123
2128static int wl3501_resume(struct pcmcia_device *p_dev) 2124static int wl3501_resume(struct pcmcia_device *link)
2129{ 2125{
2130 dev_link_t *link = dev_to_instance(p_dev);
2131 struct net_device *dev = link->priv; 2126 struct net_device *dev = link->priv;
2132 2127
2133 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); 2128 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME);