diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
commit | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch) | |
tree | 5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/serial/serial_cs.c | |
parent | fd238232cd0ff4840ae6946bb338502154096d88 (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/serial/serial_cs.c')
-rw-r--r-- | drivers/serial/serial_cs.c | 111 |
1 files changed, 51 insertions, 60 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 6bcde2c7b159..1fe8cafebe38 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -113,7 +113,7 @@ struct serial_cfg_mem { | |||
113 | }; | 113 | }; |
114 | 114 | ||
115 | 115 | ||
116 | static void serial_config(dev_link_t * link); | 116 | static void serial_config(struct pcmcia_device * link); |
117 | 117 | ||
118 | 118 | ||
119 | /*====================================================================== | 119 | /*====================================================================== |
@@ -123,7 +123,7 @@ static void serial_config(dev_link_t * link); | |||
123 | 123 | ||
124 | ======================================================================*/ | 124 | ======================================================================*/ |
125 | 125 | ||
126 | static void serial_remove(dev_link_t *link) | 126 | static void serial_remove(struct pcmcia_device *link) |
127 | { | 127 | { |
128 | struct serial_info *info = link->priv; | 128 | struct serial_info *info = link->priv; |
129 | int i; | 129 | int i; |
@@ -142,16 +142,14 @@ static void serial_remove(dev_link_t *link) | |||
142 | info->p_dev->dev_node = NULL; | 142 | info->p_dev->dev_node = NULL; |
143 | 143 | ||
144 | if (!info->slave) | 144 | if (!info->slave) |
145 | pcmcia_disable_device(link->handle); | 145 | pcmcia_disable_device(link); |
146 | 146 | ||
147 | info->p_dev->state &= ~DEV_CONFIG; | 147 | info->p_dev->state &= ~DEV_CONFIG; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | static int serial_suspend(struct pcmcia_device *dev) | 151 | static int serial_suspend(struct pcmcia_device *link) |
152 | { | 152 | { |
153 | dev_link_t *link = dev_to_instance(dev); | ||
154 | |||
155 | if (link->state & DEV_CONFIG) { | 153 | if (link->state & DEV_CONFIG) { |
156 | struct serial_info *info = link->priv; | 154 | struct serial_info *info = link->priv; |
157 | int i; | 155 | int i; |
@@ -166,10 +164,8 @@ static int serial_suspend(struct pcmcia_device *dev) | |||
166 | return 0; | 164 | return 0; |
167 | } | 165 | } |
168 | 166 | ||
169 | static int serial_resume(struct pcmcia_device *dev) | 167 | static int serial_resume(struct pcmcia_device *link) |
170 | { | 168 | { |
171 | dev_link_t *link = dev_to_instance(dev); | ||
172 | |||
173 | if (DEV_OK(link)) { | 169 | if (DEV_OK(link)) { |
174 | struct serial_info *info = link->priv; | 170 | struct serial_info *info = link->priv; |
175 | int i; | 171 | int i; |
@@ -189,10 +185,9 @@ static int serial_resume(struct pcmcia_device *dev) | |||
189 | 185 | ||
190 | ======================================================================*/ | 186 | ======================================================================*/ |
191 | 187 | ||
192 | static int serial_probe(struct pcmcia_device *p_dev) | 188 | static int serial_probe(struct pcmcia_device *link) |
193 | { | 189 | { |
194 | struct serial_info *info; | 190 | struct serial_info *info; |
195 | dev_link_t *link = dev_to_instance(p_dev); | ||
196 | 191 | ||
197 | DEBUG(0, "serial_attach()\n"); | 192 | DEBUG(0, "serial_attach()\n"); |
198 | 193 | ||
@@ -201,7 +196,7 @@ static int serial_probe(struct pcmcia_device *p_dev) | |||
201 | if (!info) | 196 | if (!info) |
202 | return -ENOMEM; | 197 | return -ENOMEM; |
203 | memset(info, 0, sizeof (*info)); | 198 | memset(info, 0, sizeof (*info)); |
204 | info->p_dev = p_dev; | 199 | info->p_dev = link; |
205 | link->priv = info; | 200 | link->priv = info; |
206 | 201 | ||
207 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 202 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
@@ -230,9 +225,8 @@ static int serial_probe(struct pcmcia_device *p_dev) | |||
230 | 225 | ||
231 | ======================================================================*/ | 226 | ======================================================================*/ |
232 | 227 | ||
233 | static void serial_detach(struct pcmcia_device *p_dev) | 228 | static void serial_detach(struct pcmcia_device *link) |
234 | { | 229 | { |
235 | dev_link_t *link = dev_to_instance(p_dev); | ||
236 | struct serial_info *info = link->priv; | 230 | struct serial_info *info = link->priv; |
237 | 231 | ||
238 | DEBUG(0, "serial_detach(0x%p)\n", link); | 232 | DEBUG(0, "serial_detach(0x%p)\n", link); |
@@ -253,7 +247,7 @@ static void serial_detach(struct pcmcia_device *p_dev) | |||
253 | 247 | ||
254 | /*====================================================================*/ | 248 | /*====================================================================*/ |
255 | 249 | ||
256 | static int setup_serial(client_handle_t handle, struct serial_info * info, | 250 | static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, |
257 | kio_addr_t iobase, int irq) | 251 | kio_addr_t iobase, int irq) |
258 | { | 252 | { |
259 | struct uart_port port; | 253 | struct uart_port port; |
@@ -288,7 +282,7 @@ static int setup_serial(client_handle_t handle, struct serial_info * info, | |||
288 | /*====================================================================*/ | 282 | /*====================================================================*/ |
289 | 283 | ||
290 | static int | 284 | static int |
291 | first_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | 285 | first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) |
292 | { | 286 | { |
293 | int i; | 287 | int i; |
294 | i = pcmcia_get_first_tuple(handle, tuple); | 288 | i = pcmcia_get_first_tuple(handle, tuple); |
@@ -301,7 +295,7 @@ first_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | |||
301 | } | 295 | } |
302 | 296 | ||
303 | static int | 297 | static int |
304 | next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | 298 | next_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) |
305 | { | 299 | { |
306 | int i; | 300 | int i; |
307 | i = pcmcia_get_next_tuple(handle, tuple); | 301 | i = pcmcia_get_next_tuple(handle, tuple); |
@@ -315,11 +309,10 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | |||
315 | 309 | ||
316 | /*====================================================================*/ | 310 | /*====================================================================*/ |
317 | 311 | ||
318 | static int simple_config(dev_link_t *link) | 312 | static int simple_config(struct pcmcia_device *link) |
319 | { | 313 | { |
320 | static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 314 | static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
321 | static const int size_table[2] = { 8, 16 }; | 315 | static const int size_table[2] = { 8, 16 }; |
322 | client_handle_t handle = link->handle; | ||
323 | struct serial_info *info = link->priv; | 316 | struct serial_info *info = link->priv; |
324 | struct serial_cfg_mem *cfg_mem; | 317 | struct serial_cfg_mem *cfg_mem; |
325 | tuple_t *tuple; | 318 | tuple_t *tuple; |
@@ -340,7 +333,7 @@ static int simple_config(dev_link_t *link) | |||
340 | buf = cfg_mem->buf; | 333 | buf = cfg_mem->buf; |
341 | 334 | ||
342 | /* If the card is already configured, look up the port and irq */ | 335 | /* If the card is already configured, look up the port and irq */ |
343 | i = pcmcia_get_configuration_info(handle, &config); | 336 | i = pcmcia_get_configuration_info(link, &config); |
344 | if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { | 337 | if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { |
345 | kio_addr_t port = 0; | 338 | kio_addr_t port = 0; |
346 | if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { | 339 | if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { |
@@ -353,7 +346,7 @@ static int simple_config(dev_link_t *link) | |||
353 | } | 346 | } |
354 | if (info->slave) { | 347 | if (info->slave) { |
355 | kfree(cfg_mem); | 348 | kfree(cfg_mem); |
356 | return setup_serial(handle, info, port, config.AssignedIRQ); | 349 | return setup_serial(link, info, port, config.AssignedIRQ); |
357 | } | 350 | } |
358 | } | 351 | } |
359 | 352 | ||
@@ -366,7 +359,7 @@ static int simple_config(dev_link_t *link) | |||
366 | /* Two tries: without IO aliases, then with aliases */ | 359 | /* Two tries: without IO aliases, then with aliases */ |
367 | for (s = 0; s < 2; s++) { | 360 | for (s = 0; s < 2; s++) { |
368 | for (try = 0; try < 2; try++) { | 361 | for (try = 0; try < 2; try++) { |
369 | i = first_tuple(handle, tuple, parse); | 362 | i = first_tuple(link, tuple, parse); |
370 | while (i != CS_NO_MORE_ITEMS) { | 363 | while (i != CS_NO_MORE_ITEMS) { |
371 | if (i != CS_SUCCESS) | 364 | if (i != CS_SUCCESS) |
372 | goto next_entry; | 365 | goto next_entry; |
@@ -379,19 +372,19 @@ static int simple_config(dev_link_t *link) | |||
379 | link->io.BasePort1 = cf->io.win[0].base; | 372 | link->io.BasePort1 = cf->io.win[0].base; |
380 | link->io.IOAddrLines = (try == 0) ? | 373 | link->io.IOAddrLines = (try == 0) ? |
381 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | 374 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; |
382 | i = pcmcia_request_io(link->handle, &link->io); | 375 | i = pcmcia_request_io(link, &link->io); |
383 | if (i == CS_SUCCESS) | 376 | if (i == CS_SUCCESS) |
384 | goto found_port; | 377 | goto found_port; |
385 | } | 378 | } |
386 | next_entry: | 379 | next_entry: |
387 | i = next_tuple(handle, tuple, parse); | 380 | i = next_tuple(link, tuple, parse); |
388 | } | 381 | } |
389 | } | 382 | } |
390 | } | 383 | } |
391 | /* Second pass: try to find an entry that isn't picky about | 384 | /* Second pass: try to find an entry that isn't picky about |
392 | its base address, then try to grab any standard serial port | 385 | its base address, then try to grab any standard serial port |
393 | address, and finally try to get any free port. */ | 386 | address, and finally try to get any free port. */ |
394 | i = first_tuple(handle, tuple, parse); | 387 | i = first_tuple(link, tuple, parse); |
395 | while (i != CS_NO_MORE_ITEMS) { | 388 | while (i != CS_NO_MORE_ITEMS) { |
396 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && | 389 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && |
397 | ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 390 | ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
@@ -399,43 +392,42 @@ next_entry: | |||
399 | for (j = 0; j < 5; j++) { | 392 | for (j = 0; j < 5; j++) { |
400 | link->io.BasePort1 = base[j]; | 393 | link->io.BasePort1 = base[j]; |
401 | link->io.IOAddrLines = base[j] ? 16 : 3; | 394 | link->io.IOAddrLines = base[j] ? 16 : 3; |
402 | i = pcmcia_request_io(link->handle, &link->io); | 395 | i = pcmcia_request_io(link, &link->io); |
403 | if (i == CS_SUCCESS) | 396 | if (i == CS_SUCCESS) |
404 | goto found_port; | 397 | goto found_port; |
405 | } | 398 | } |
406 | } | 399 | } |
407 | i = next_tuple(handle, tuple, parse); | 400 | i = next_tuple(link, tuple, parse); |
408 | } | 401 | } |
409 | 402 | ||
410 | found_port: | 403 | found_port: |
411 | if (i != CS_SUCCESS) { | 404 | if (i != CS_SUCCESS) { |
412 | printk(KERN_NOTICE | 405 | printk(KERN_NOTICE |
413 | "serial_cs: no usable port range found, giving up\n"); | 406 | "serial_cs: no usable port range found, giving up\n"); |
414 | cs_error(link->handle, RequestIO, i); | 407 | cs_error(link, RequestIO, i); |
415 | kfree(cfg_mem); | 408 | kfree(cfg_mem); |
416 | return -1; | 409 | return -1; |
417 | } | 410 | } |
418 | 411 | ||
419 | i = pcmcia_request_irq(link->handle, &link->irq); | 412 | i = pcmcia_request_irq(link, &link->irq); |
420 | if (i != CS_SUCCESS) { | 413 | if (i != CS_SUCCESS) { |
421 | cs_error(link->handle, RequestIRQ, i); | 414 | cs_error(link, RequestIRQ, i); |
422 | link->irq.AssignedIRQ = 0; | 415 | link->irq.AssignedIRQ = 0; |
423 | } | 416 | } |
424 | if (info->multi && (info->manfid == MANFID_3COM)) | 417 | if (info->multi && (info->manfid == MANFID_3COM)) |
425 | link->conf.ConfigIndex &= ~(0x08); | 418 | link->conf.ConfigIndex &= ~(0x08); |
426 | i = pcmcia_request_configuration(link->handle, &link->conf); | 419 | i = pcmcia_request_configuration(link, &link->conf); |
427 | if (i != CS_SUCCESS) { | 420 | if (i != CS_SUCCESS) { |
428 | cs_error(link->handle, RequestConfiguration, i); | 421 | cs_error(link, RequestConfiguration, i); |
429 | kfree(cfg_mem); | 422 | kfree(cfg_mem); |
430 | return -1; | 423 | return -1; |
431 | } | 424 | } |
432 | kfree(cfg_mem); | 425 | kfree(cfg_mem); |
433 | return setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); | 426 | return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
434 | } | 427 | } |
435 | 428 | ||
436 | static int multi_config(dev_link_t * link) | 429 | static int multi_config(struct pcmcia_device * link) |
437 | { | 430 | { |
438 | client_handle_t handle = link->handle; | ||
439 | struct serial_info *info = link->priv; | 431 | struct serial_info *info = link->priv; |
440 | struct serial_cfg_mem *cfg_mem; | 432 | struct serial_cfg_mem *cfg_mem; |
441 | tuple_t *tuple; | 433 | tuple_t *tuple; |
@@ -460,7 +452,7 @@ static int multi_config(dev_link_t * link) | |||
460 | 452 | ||
461 | /* First, look for a generic full-sized window */ | 453 | /* First, look for a generic full-sized window */ |
462 | link->io.NumPorts1 = info->multi * 8; | 454 | link->io.NumPorts1 = info->multi * 8; |
463 | i = first_tuple(handle, tuple, parse); | 455 | i = first_tuple(link, tuple, parse); |
464 | while (i != CS_NO_MORE_ITEMS) { | 456 | while (i != CS_NO_MORE_ITEMS) { |
465 | /* The quad port cards have bad CIS's, so just look for a | 457 | /* The quad port cards have bad CIS's, so just look for a |
466 | window larger than 8 ports and assume it will be right */ | 458 | window larger than 8 ports and assume it will be right */ |
@@ -470,19 +462,19 @@ static int multi_config(dev_link_t * link) | |||
470 | link->io.BasePort1 = cf->io.win[0].base; | 462 | link->io.BasePort1 = cf->io.win[0].base; |
471 | link->io.IOAddrLines = | 463 | link->io.IOAddrLines = |
472 | cf->io.flags & CISTPL_IO_LINES_MASK; | 464 | cf->io.flags & CISTPL_IO_LINES_MASK; |
473 | i = pcmcia_request_io(link->handle, &link->io); | 465 | i = pcmcia_request_io(link, &link->io); |
474 | base2 = link->io.BasePort1 + 8; | 466 | base2 = link->io.BasePort1 + 8; |
475 | if (i == CS_SUCCESS) | 467 | if (i == CS_SUCCESS) |
476 | break; | 468 | break; |
477 | } | 469 | } |
478 | i = next_tuple(handle, tuple, parse); | 470 | i = next_tuple(link, tuple, parse); |
479 | } | 471 | } |
480 | 472 | ||
481 | /* If that didn't work, look for two windows */ | 473 | /* If that didn't work, look for two windows */ |
482 | if (i != CS_SUCCESS) { | 474 | if (i != CS_SUCCESS) { |
483 | link->io.NumPorts1 = link->io.NumPorts2 = 8; | 475 | link->io.NumPorts1 = link->io.NumPorts2 = 8; |
484 | info->multi = 2; | 476 | info->multi = 2; |
485 | i = first_tuple(handle, tuple, parse); | 477 | i = first_tuple(link, tuple, parse); |
486 | while (i != CS_NO_MORE_ITEMS) { | 478 | while (i != CS_NO_MORE_ITEMS) { |
487 | if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) { | 479 | if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) { |
488 | link->conf.ConfigIndex = cf->index; | 480 | link->conf.ConfigIndex = cf->index; |
@@ -490,26 +482,26 @@ static int multi_config(dev_link_t * link) | |||
490 | link->io.BasePort2 = cf->io.win[1].base; | 482 | link->io.BasePort2 = cf->io.win[1].base; |
491 | link->io.IOAddrLines = | 483 | link->io.IOAddrLines = |
492 | cf->io.flags & CISTPL_IO_LINES_MASK; | 484 | cf->io.flags & CISTPL_IO_LINES_MASK; |
493 | i = pcmcia_request_io(link->handle, &link->io); | 485 | i = pcmcia_request_io(link, &link->io); |
494 | base2 = link->io.BasePort2; | 486 | base2 = link->io.BasePort2; |
495 | if (i == CS_SUCCESS) | 487 | if (i == CS_SUCCESS) |
496 | break; | 488 | break; |
497 | } | 489 | } |
498 | i = next_tuple(handle, tuple, parse); | 490 | i = next_tuple(link, tuple, parse); |
499 | } | 491 | } |
500 | } | 492 | } |
501 | 493 | ||
502 | if (i != CS_SUCCESS) { | 494 | if (i != CS_SUCCESS) { |
503 | cs_error(link->handle, RequestIO, i); | 495 | cs_error(link, RequestIO, i); |
504 | rc = -1; | 496 | rc = -1; |
505 | goto free_cfg_mem; | 497 | goto free_cfg_mem; |
506 | } | 498 | } |
507 | 499 | ||
508 | i = pcmcia_request_irq(link->handle, &link->irq); | 500 | i = pcmcia_request_irq(link, &link->irq); |
509 | if (i != CS_SUCCESS) { | 501 | if (i != CS_SUCCESS) { |
510 | printk(KERN_NOTICE | 502 | printk(KERN_NOTICE |
511 | "serial_cs: no usable port range found, giving up\n"); | 503 | "serial_cs: no usable port range found, giving up\n"); |
512 | cs_error(link->handle, RequestIRQ, i); | 504 | cs_error(link, RequestIRQ, i); |
513 | link->irq.AssignedIRQ = 0; | 505 | link->irq.AssignedIRQ = 0; |
514 | } | 506 | } |
515 | /* Socket Dual IO: this enables irq's for second port */ | 507 | /* Socket Dual IO: this enables irq's for second port */ |
@@ -517,9 +509,9 @@ static int multi_config(dev_link_t * link) | |||
517 | link->conf.Present |= PRESENT_EXT_STATUS; | 509 | link->conf.Present |= PRESENT_EXT_STATUS; |
518 | link->conf.ExtStatus = ESR_REQ_ATTN_ENA; | 510 | link->conf.ExtStatus = ESR_REQ_ATTN_ENA; |
519 | } | 511 | } |
520 | i = pcmcia_request_configuration(link->handle, &link->conf); | 512 | i = pcmcia_request_configuration(link, &link->conf); |
521 | if (i != CS_SUCCESS) { | 513 | if (i != CS_SUCCESS) { |
522 | cs_error(link->handle, RequestConfiguration, i); | 514 | cs_error(link, RequestConfiguration, i); |
523 | rc = -1; | 515 | rc = -1; |
524 | goto free_cfg_mem; | 516 | goto free_cfg_mem; |
525 | } | 517 | } |
@@ -528,24 +520,24 @@ static int multi_config(dev_link_t * link) | |||
528 | 8 registers are for the UART, the others are extra registers */ | 520 | 8 registers are for the UART, the others are extra registers */ |
529 | if (info->manfid == MANFID_OXSEMI) { | 521 | if (info->manfid == MANFID_OXSEMI) { |
530 | if (cf->index == 1 || cf->index == 3) { | 522 | if (cf->index == 1 || cf->index == 3) { |
531 | setup_serial(handle, info, base2, link->irq.AssignedIRQ); | 523 | setup_serial(link, info, base2, link->irq.AssignedIRQ); |
532 | outb(12, link->io.BasePort1 + 1); | 524 | outb(12, link->io.BasePort1 + 1); |
533 | } else { | 525 | } else { |
534 | setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); | 526 | setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
535 | outb(12, base2 + 1); | 527 | outb(12, base2 + 1); |
536 | } | 528 | } |
537 | rc = 0; | 529 | rc = 0; |
538 | goto free_cfg_mem; | 530 | goto free_cfg_mem; |
539 | } | 531 | } |
540 | 532 | ||
541 | setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); | 533 | setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
542 | /* The Nokia cards are not really multiport cards */ | 534 | /* The Nokia cards are not really multiport cards */ |
543 | if (info->manfid == MANFID_NOKIA) { | 535 | if (info->manfid == MANFID_NOKIA) { |
544 | rc = 0; | 536 | rc = 0; |
545 | goto free_cfg_mem; | 537 | goto free_cfg_mem; |
546 | } | 538 | } |
547 | for (i = 0; i < info->multi - 1; i++) | 539 | for (i = 0; i < info->multi - 1; i++) |
548 | setup_serial(handle, info, base2 + (8 * i), | 540 | setup_serial(link, info, base2 + (8 * i), |
549 | link->irq.AssignedIRQ); | 541 | link->irq.AssignedIRQ); |
550 | rc = 0; | 542 | rc = 0; |
551 | free_cfg_mem: | 543 | free_cfg_mem: |
@@ -561,9 +553,8 @@ free_cfg_mem: | |||
561 | 553 | ||
562 | ======================================================================*/ | 554 | ======================================================================*/ |
563 | 555 | ||
564 | void serial_config(dev_link_t * link) | 556 | void serial_config(struct pcmcia_device * link) |
565 | { | 557 | { |
566 | client_handle_t handle = link->handle; | ||
567 | struct serial_info *info = link->priv; | 558 | struct serial_info *info = link->priv; |
568 | struct serial_cfg_mem *cfg_mem; | 559 | struct serial_cfg_mem *cfg_mem; |
569 | tuple_t *tuple; | 560 | tuple_t *tuple; |
@@ -589,7 +580,7 @@ void serial_config(dev_link_t * link) | |||
589 | tuple->Attributes = 0; | 580 | tuple->Attributes = 0; |
590 | /* Get configuration register information */ | 581 | /* Get configuration register information */ |
591 | tuple->DesiredTuple = CISTPL_CONFIG; | 582 | tuple->DesiredTuple = CISTPL_CONFIG; |
592 | last_ret = first_tuple(handle, tuple, parse); | 583 | last_ret = first_tuple(link, tuple, parse); |
593 | if (last_ret != CS_SUCCESS) { | 584 | if (last_ret != CS_SUCCESS) { |
594 | last_fn = ParseTuple; | 585 | last_fn = ParseTuple; |
595 | goto cs_failed; | 586 | goto cs_failed; |
@@ -603,11 +594,11 @@ void serial_config(dev_link_t * link) | |||
603 | /* Is this a compliant multifunction card? */ | 594 | /* Is this a compliant multifunction card? */ |
604 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 595 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
605 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | 596 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; |
606 | info->multi = (first_tuple(handle, tuple, parse) == CS_SUCCESS); | 597 | info->multi = (first_tuple(link, tuple, parse) == CS_SUCCESS); |
607 | 598 | ||
608 | /* Is this a multiport card? */ | 599 | /* Is this a multiport card? */ |
609 | tuple->DesiredTuple = CISTPL_MANFID; | 600 | tuple->DesiredTuple = CISTPL_MANFID; |
610 | if (first_tuple(handle, tuple, parse) == CS_SUCCESS) { | 601 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
611 | info->manfid = parse->manfid.manf; | 602 | info->manfid = parse->manfid.manf; |
612 | for (i = 0; i < MULTI_COUNT; i++) | 603 | for (i = 0; i < MULTI_COUNT; i++) |
613 | if ((info->manfid == multi_id[i].manfid) && | 604 | if ((info->manfid == multi_id[i].manfid) && |
@@ -621,11 +612,11 @@ void serial_config(dev_link_t * link) | |||
621 | multifunction cards that ask for appropriate IO port ranges */ | 612 | multifunction cards that ask for appropriate IO port ranges */ |
622 | tuple->DesiredTuple = CISTPL_FUNCID; | 613 | tuple->DesiredTuple = CISTPL_FUNCID; |
623 | if ((info->multi == 0) && | 614 | if ((info->multi == 0) && |
624 | ((first_tuple(handle, tuple, parse) != CS_SUCCESS) || | 615 | ((first_tuple(link, tuple, parse) != CS_SUCCESS) || |
625 | (parse->funcid.func == CISTPL_FUNCID_MULTI) || | 616 | (parse->funcid.func == CISTPL_FUNCID_MULTI) || |
626 | (parse->funcid.func == CISTPL_FUNCID_SERIAL))) { | 617 | (parse->funcid.func == CISTPL_FUNCID_SERIAL))) { |
627 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 618 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; |
628 | if (first_tuple(handle, tuple, parse) == CS_SUCCESS) { | 619 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
629 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | 620 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) |
630 | info->multi = cf->io.win[0].len >> 3; | 621 | info->multi = cf->io.win[0].len >> 3; |
631 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && | 622 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && |
@@ -644,14 +635,14 @@ void serial_config(dev_link_t * link) | |||
644 | 635 | ||
645 | if (info->manfid == MANFID_IBM) { | 636 | if (info->manfid == MANFID_IBM) { |
646 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; | 637 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; |
647 | last_ret = pcmcia_access_configuration_register(link->handle, ®); | 638 | last_ret = pcmcia_access_configuration_register(link, ®); |
648 | if (last_ret) { | 639 | if (last_ret) { |
649 | last_fn = AccessConfigurationRegister; | 640 | last_fn = AccessConfigurationRegister; |
650 | goto cs_failed; | 641 | goto cs_failed; |
651 | } | 642 | } |
652 | reg.Action = CS_WRITE; | 643 | reg.Action = CS_WRITE; |
653 | reg.Value = reg.Value | 1; | 644 | reg.Value = reg.Value | 1; |
654 | last_ret = pcmcia_access_configuration_register(link->handle, ®); | 645 | last_ret = pcmcia_access_configuration_register(link, ®); |
655 | if (last_ret) { | 646 | if (last_ret) { |
656 | last_fn = AccessConfigurationRegister; | 647 | last_fn = AccessConfigurationRegister; |
657 | goto cs_failed; | 648 | goto cs_failed; |
@@ -664,7 +655,7 @@ void serial_config(dev_link_t * link) | |||
664 | return; | 655 | return; |
665 | 656 | ||
666 | cs_failed: | 657 | cs_failed: |
667 | cs_error(link->handle, last_fn, last_ret); | 658 | cs_error(link, last_fn, last_ret); |
668 | failed: | 659 | failed: |
669 | serial_remove(link); | 660 | serial_remove(link); |
670 | link->state &= ~DEV_CONFIG_PENDING; | 661 | link->state &= ~DEV_CONFIG_PENDING; |