aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/sedlbauer_cs.c
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/isdn/hisax/sedlbauer_cs.c
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/isdn/hisax/sedlbauer_cs.c')
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 6025722001fa..2af48a684654 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -95,8 +95,8 @@ module_param(protocol, int, 0);
95 event handler. 95 event handler.
96*/ 96*/
97 97
98static void sedlbauer_config(dev_link_t *link); 98static void sedlbauer_config(struct pcmcia_device *link);
99static void sedlbauer_release(dev_link_t *link); 99static void sedlbauer_release(struct pcmcia_device *link);
100 100
101/* 101/*
102 The attach() and detach() entry points are used to create and destroy 102 The attach() and detach() entry points are used to create and destroy
@@ -119,7 +119,7 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev);
119 example, ethernet cards, modems). In other cases, there may be 119 example, ethernet cards, modems). In other cases, there may be
120 many actual or logical devices (SCSI adapters, memory cards with 120 many actual or logical devices (SCSI adapters, memory cards with
121 multiple partitions). The dev_node_t structures need to be kept 121 multiple partitions). The dev_node_t structures need to be kept
122 in a linked list starting at the 'dev' field of a dev_link_t 122 in a linked list starting at the 'dev' field of a struct pcmcia_device
123 structure. We allocate them in the card's private data structure, 123 structure. We allocate them in the card's private data structure,
124 because they generally shouldn't be allocated dynamically. 124 because they generally shouldn't be allocated dynamically.
125 125
@@ -148,11 +148,10 @@ typedef struct local_info_t {
148 148
149======================================================================*/ 149======================================================================*/
150 150
151static int sedlbauer_attach(struct pcmcia_device *p_dev) 151static int sedlbauer_attach(struct pcmcia_device *link)
152{ 152{
153 local_info_t *local; 153 local_info_t *local;
154 dev_link_t *link = dev_to_instance(p_dev); 154
155
156 DEBUG(0, "sedlbauer_attach()\n"); 155 DEBUG(0, "sedlbauer_attach()\n");
157 156
158 /* Allocate space for private device-specific data */ 157 /* Allocate space for private device-specific data */
@@ -161,7 +160,7 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
161 memset(local, 0, sizeof(local_info_t)); 160 memset(local, 0, sizeof(local_info_t));
162 local->cardnr = -1; 161 local->cardnr = -1;
163 162
164 local->p_dev = p_dev; 163 local->p_dev = link;
165 link->priv = local; 164 link->priv = local;
166 165
167 /* Interrupt setup */ 166 /* Interrupt setup */
@@ -202,10 +201,8 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
202 201
203======================================================================*/ 202======================================================================*/
204 203
205static void sedlbauer_detach(struct pcmcia_device *p_dev) 204static void sedlbauer_detach(struct pcmcia_device *link)
206{ 205{
207 dev_link_t *link = dev_to_instance(p_dev);
208
209 DEBUG(0, "sedlbauer_detach(0x%p)\n", link); 206 DEBUG(0, "sedlbauer_detach(0x%p)\n", link);
210 207
211 if (link->state & DEV_CONFIG) { 208 if (link->state & DEV_CONFIG) {
@@ -227,9 +224,8 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev)
227#define CS_CHECK(fn, ret) \ 224#define CS_CHECK(fn, ret) \
228do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 225do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
229 226
230static void sedlbauer_config(dev_link_t *link) 227static void sedlbauer_config(struct pcmcia_device *link)
231{ 228{
232 client_handle_t handle = link->handle;
233 local_info_t *dev = link->priv; 229 local_info_t *dev = link->priv;
234 tuple_t tuple; 230 tuple_t tuple;
235 cisparse_t parse; 231 cisparse_t parse;
@@ -251,16 +247,16 @@ static void sedlbauer_config(dev_link_t *link)
251 tuple.TupleData = buf; 247 tuple.TupleData = buf;
252 tuple.TupleDataMax = sizeof(buf); 248 tuple.TupleDataMax = sizeof(buf);
253 tuple.TupleOffset = 0; 249 tuple.TupleOffset = 0;
254 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 250 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
255 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 251 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
256 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 252 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
257 link->conf.ConfigBase = parse.config.base; 253 link->conf.ConfigBase = parse.config.base;
258 link->conf.Present = parse.config.rmask[0]; 254 link->conf.Present = parse.config.rmask[0];
259 255
260 /* Configure card */ 256 /* Configure card */
261 link->state |= DEV_CONFIG; 257 link->state |= DEV_CONFIG;
262 258
263 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); 259 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
264 260
265 /* 261 /*
266 In this loop, we scan the CIS for configuration table entries, 262 In this loop, we scan the CIS for configuration table entries,
@@ -275,12 +271,12 @@ static void sedlbauer_config(dev_link_t *link)
275 will only use the CIS to fill in implementation-defined details. 271 will only use the CIS to fill in implementation-defined details.
276 */ 272 */
277 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 273 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
278 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 274 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
279 while (1) { 275 while (1) {
280 cistpl_cftable_entry_t dflt = { 0 }; 276 cistpl_cftable_entry_t dflt = { 0 };
281 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 277 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
282 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 278 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
283 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 279 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
284 goto next_entry; 280 goto next_entry;
285 281
286 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 282 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
@@ -334,13 +330,13 @@ static void sedlbauer_config(dev_link_t *link)
334 link->io.NumPorts2 = io->win[1].len; 330 link->io.NumPorts2 = io->win[1].len;
335 } 331 }
336 /* This reserves IO space but doesn't actually enable it */ 332 /* This reserves IO space but doesn't actually enable it */
337 if (pcmcia_request_io(link->handle, &link->io) != 0) 333 if (pcmcia_request_io(link, &link->io) != 0)
338 goto next_entry; 334 goto next_entry;
339 } 335 }
340 336
341 /* 337 /*
342 Now set up a common memory window, if needed. There is room 338 Now set up a common memory window, if needed. There is room
343 in the dev_link_t structure for one memory window handle, 339 in the struct pcmcia_device structure for one memory window handle,
344 but if the base addresses need to be saved, or if multiple 340 but if the base addresses need to be saved, or if multiple
345 windows are needed, the info should go in the private data 341 windows are needed, the info should go in the private data
346 structure for this device. 342 structure for this device.
@@ -361,7 +357,7 @@ static void sedlbauer_config(dev_link_t *link)
361 req.Size = 0x1000; 357 req.Size = 0x1000;
362*/ 358*/
363 req.AccessSpeed = 0; 359 req.AccessSpeed = 0;
364 if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) 360 if (pcmcia_request_window(&link, &req, &link->win) != 0)
365 goto next_entry; 361 goto next_entry;
366 map.Page = 0; map.CardOffset = mem->win[0].card_addr; 362 map.Page = 0; map.CardOffset = mem->win[0].card_addr;
367 if (pcmcia_map_mem_page(link->win, &map) != 0) 363 if (pcmcia_map_mem_page(link->win, &map) != 0)
@@ -371,7 +367,7 @@ static void sedlbauer_config(dev_link_t *link)
371 break; 367 break;
372 368
373 next_entry: 369 next_entry:
374 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 370 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
375 } 371 }
376 372
377 /* 373 /*
@@ -380,14 +376,14 @@ static void sedlbauer_config(dev_link_t *link)
380 irq structure is initialized. 376 irq structure is initialized.
381 */ 377 */
382 if (link->conf.Attributes & CONF_ENABLE_IRQ) 378 if (link->conf.Attributes & CONF_ENABLE_IRQ)
383 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 379 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
384 380
385 /* 381 /*
386 This actually configures the PCMCIA socket -- setting up 382 This actually configures the PCMCIA socket -- setting up
387 the I/O windows and the interrupt mapping, and putting the 383 the I/O windows and the interrupt mapping, and putting the
388 card and host interface into "Memory and IO" mode. 384 card and host interface into "Memory and IO" mode.
389 */ 385 */
390 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 386 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
391 387
392 /* 388 /*
393 At this point, the dev_node_t structure(s) need to be 389 At this point, the dev_node_t structure(s) need to be
@@ -433,7 +429,7 @@ static void sedlbauer_config(dev_link_t *link)
433 return; 429 return;
434 430
435cs_failed: 431cs_failed:
436 cs_error(link->handle, last_fn, last_ret); 432 cs_error(link, last_fn, last_ret);
437 sedlbauer_release(link); 433 sedlbauer_release(link);
438 434
439} /* sedlbauer_config */ 435} /* sedlbauer_config */
@@ -446,7 +442,7 @@ cs_failed:
446 442
447======================================================================*/ 443======================================================================*/
448 444
449static void sedlbauer_release(dev_link_t *link) 445static void sedlbauer_release(struct pcmcia_device *link)
450{ 446{
451 local_info_t *local = link->priv; 447 local_info_t *local = link->priv;
452 DEBUG(0, "sedlbauer_release(0x%p)\n", link); 448 DEBUG(0, "sedlbauer_release(0x%p)\n", link);
@@ -458,12 +454,11 @@ static void sedlbauer_release(dev_link_t *link)
458 } 454 }
459 } 455 }
460 456
461 pcmcia_disable_device(link->handle); 457 pcmcia_disable_device(link);
462} /* sedlbauer_release */ 458} /* sedlbauer_release */
463 459
464static int sedlbauer_suspend(struct pcmcia_device *p_dev) 460static int sedlbauer_suspend(struct pcmcia_device *link)
465{ 461{
466 dev_link_t *link = dev_to_instance(p_dev);
467 local_info_t *dev = link->priv; 462 local_info_t *dev = link->priv;
468 463
469 dev->stop = 1; 464 dev->stop = 1;
@@ -471,9 +466,8 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev)
471 return 0; 466 return 0;
472} 467}
473 468
474static int sedlbauer_resume(struct pcmcia_device *p_dev) 469static int sedlbauer_resume(struct pcmcia_device *link)
475{ 470{
476 dev_link_t *link = dev_to_instance(p_dev);
477 local_info_t *dev = link->priv; 471 local_info_t *dev = link->priv;
478 472
479 dev->stop = 0; 473 dev->stop = 0;