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/char/pcmcia/cm4040_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/char/pcmcia/cm4040_cs.c')
-rw-r--r-- | drivers/char/pcmcia/cm4040_cs.c | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 97e32e7f84dc..8334226e103c 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -65,7 +65,7 @@ static char *version = | |||
65 | /* how often to poll for fifo status change */ | 65 | /* how often to poll for fifo status change */ |
66 | #define POLL_PERIOD msecs_to_jiffies(10) | 66 | #define POLL_PERIOD msecs_to_jiffies(10) |
67 | 67 | ||
68 | static void reader_release(dev_link_t *link); | 68 | static void reader_release(struct pcmcia_device *link); |
69 | 69 | ||
70 | static int major; | 70 | static int major; |
71 | static struct class *cmx_class; | 71 | static struct class *cmx_class; |
@@ -87,7 +87,7 @@ struct reader_dev { | |||
87 | struct timer_list poll_timer; | 87 | struct timer_list poll_timer; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static dev_link_t *dev_table[CM_MAX_DEV]; | 90 | static struct pcmcia_device *dev_table[CM_MAX_DEV]; |
91 | 91 | ||
92 | #ifndef PCMCIA_DEBUG | 92 | #ifndef PCMCIA_DEBUG |
93 | #define xoutb outb | 93 | #define xoutb outb |
@@ -445,7 +445,7 @@ static unsigned int cm4040_poll(struct file *filp, poll_table *wait) | |||
445 | static int cm4040_open(struct inode *inode, struct file *filp) | 445 | static int cm4040_open(struct inode *inode, struct file *filp) |
446 | { | 446 | { |
447 | struct reader_dev *dev; | 447 | struct reader_dev *dev; |
448 | dev_link_t *link; | 448 | struct pcmcia_device *link; |
449 | int minor = iminor(inode); | 449 | int minor = iminor(inode); |
450 | 450 | ||
451 | if (minor >= CM_MAX_DEV) | 451 | if (minor >= CM_MAX_DEV) |
@@ -478,7 +478,7 @@ static int cm4040_open(struct inode *inode, struct file *filp) | |||
478 | static int cm4040_close(struct inode *inode, struct file *filp) | 478 | static int cm4040_close(struct inode *inode, struct file *filp) |
479 | { | 479 | { |
480 | struct reader_dev *dev = filp->private_data; | 480 | struct reader_dev *dev = filp->private_data; |
481 | dev_link_t *link; | 481 | struct pcmcia_device *link; |
482 | int minor = iminor(inode); | 482 | int minor = iminor(inode); |
483 | 483 | ||
484 | DEBUGP(2, dev, "-> cm4040_close(maj/min=%d.%d)\n", imajor(inode), | 484 | DEBUGP(2, dev, "-> cm4040_close(maj/min=%d.%d)\n", imajor(inode), |
@@ -500,7 +500,7 @@ static int cm4040_close(struct inode *inode, struct file *filp) | |||
500 | return 0; | 500 | return 0; |
501 | } | 501 | } |
502 | 502 | ||
503 | static void cm4040_reader_release(dev_link_t *link) | 503 | static void cm4040_reader_release(struct pcmcia_device *link) |
504 | { | 504 | { |
505 | struct reader_dev *dev = link->priv; | 505 | struct reader_dev *dev = link->priv; |
506 | 506 | ||
@@ -514,9 +514,8 @@ static void cm4040_reader_release(dev_link_t *link) | |||
514 | return; | 514 | return; |
515 | } | 515 | } |
516 | 516 | ||
517 | static void reader_config(dev_link_t *link, int devno) | 517 | static void reader_config(struct pcmcia_device *link, int devno) |
518 | { | 518 | { |
519 | client_handle_t handle; | ||
520 | struct reader_dev *dev; | 519 | struct reader_dev *dev; |
521 | tuple_t tuple; | 520 | tuple_t tuple; |
522 | cisparse_t parse; | 521 | cisparse_t parse; |
@@ -524,23 +523,21 @@ static void reader_config(dev_link_t *link, int devno) | |||
524 | int fail_fn, fail_rc; | 523 | int fail_fn, fail_rc; |
525 | int rc; | 524 | int rc; |
526 | 525 | ||
527 | handle = link->handle; | ||
528 | |||
529 | tuple.DesiredTuple = CISTPL_CONFIG; | 526 | tuple.DesiredTuple = CISTPL_CONFIG; |
530 | tuple.Attributes = 0; | 527 | tuple.Attributes = 0; |
531 | tuple.TupleData = buf; | 528 | tuple.TupleData = buf; |
532 | tuple.TupleDataMax = sizeof(buf); | 529 | tuple.TupleDataMax = sizeof(buf); |
533 | tuple.TupleOffset = 0; | 530 | tuple.TupleOffset = 0; |
534 | 531 | ||
535 | if ((fail_rc = pcmcia_get_first_tuple(handle, &tuple)) != CS_SUCCESS) { | 532 | if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) { |
536 | fail_fn = GetFirstTuple; | 533 | fail_fn = GetFirstTuple; |
537 | goto cs_failed; | 534 | goto cs_failed; |
538 | } | 535 | } |
539 | if ((fail_rc = pcmcia_get_tuple_data(handle, &tuple)) != CS_SUCCESS) { | 536 | if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) { |
540 | fail_fn = GetTupleData; | 537 | fail_fn = GetTupleData; |
541 | goto cs_failed; | 538 | goto cs_failed; |
542 | } | 539 | } |
543 | if ((fail_rc = pcmcia_parse_tuple(handle, &tuple, &parse)) | 540 | if ((fail_rc = pcmcia_parse_tuple(link, &tuple, &parse)) |
544 | != CS_SUCCESS) { | 541 | != CS_SUCCESS) { |
545 | fail_fn = ParseTuple; | 542 | fail_fn = ParseTuple; |
546 | goto cs_failed; | 543 | goto cs_failed; |
@@ -554,13 +551,13 @@ static void reader_config(dev_link_t *link, int devno) | |||
554 | link->io.NumPorts2 = 0; | 551 | link->io.NumPorts2 = 0; |
555 | link->io.Attributes2 = 0; | 552 | link->io.Attributes2 = 0; |
556 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 553 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
557 | for (rc = pcmcia_get_first_tuple(handle, &tuple); | 554 | for (rc = pcmcia_get_first_tuple(link, &tuple); |
558 | rc == CS_SUCCESS; | 555 | rc == CS_SUCCESS; |
559 | rc = pcmcia_get_next_tuple(handle, &tuple)) { | 556 | rc = pcmcia_get_next_tuple(link, &tuple)) { |
560 | rc = pcmcia_get_tuple_data(handle, &tuple); | 557 | rc = pcmcia_get_tuple_data(link, &tuple); |
561 | if (rc != CS_SUCCESS) | 558 | if (rc != CS_SUCCESS) |
562 | continue; | 559 | continue; |
563 | rc = pcmcia_parse_tuple(handle, &tuple, &parse); | 560 | rc = pcmcia_parse_tuple(link, &tuple, &parse); |
564 | if (rc != CS_SUCCESS) | 561 | if (rc != CS_SUCCESS) |
565 | continue; | 562 | continue; |
566 | 563 | ||
@@ -578,13 +575,13 @@ static void reader_config(dev_link_t *link, int devno) | |||
578 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 575 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
579 | link->io.IOAddrLines = parse.cftable_entry.io.flags | 576 | link->io.IOAddrLines = parse.cftable_entry.io.flags |
580 | & CISTPL_IO_LINES_MASK; | 577 | & CISTPL_IO_LINES_MASK; |
581 | rc = pcmcia_request_io(handle, &link->io); | 578 | rc = pcmcia_request_io(link, &link->io); |
582 | 579 | ||
583 | dev_printk(KERN_INFO, &handle_to_dev(handle), "foo"); | 580 | dev_printk(KERN_INFO, &handle_to_dev(link), "foo"); |
584 | if (rc == CS_SUCCESS) | 581 | if (rc == CS_SUCCESS) |
585 | break; | 582 | break; |
586 | else | 583 | else |
587 | dev_printk(KERN_INFO, &handle_to_dev(handle), | 584 | dev_printk(KERN_INFO, &handle_to_dev(link), |
588 | "pcmcia_request_io failed 0x%x\n", rc); | 585 | "pcmcia_request_io failed 0x%x\n", rc); |
589 | } | 586 | } |
590 | if (rc != CS_SUCCESS) | 587 | if (rc != CS_SUCCESS) |
@@ -592,10 +589,10 @@ static void reader_config(dev_link_t *link, int devno) | |||
592 | 589 | ||
593 | link->conf.IntType = 00000002; | 590 | link->conf.IntType = 00000002; |
594 | 591 | ||
595 | if ((fail_rc = pcmcia_request_configuration(handle,&link->conf)) | 592 | if ((fail_rc = pcmcia_request_configuration(link,&link->conf)) |
596 | !=CS_SUCCESS) { | 593 | !=CS_SUCCESS) { |
597 | fail_fn = RequestConfiguration; | 594 | fail_fn = RequestConfiguration; |
598 | dev_printk(KERN_INFO, &handle_to_dev(handle), | 595 | dev_printk(KERN_INFO, &handle_to_dev(link), |
599 | "pcmcia_request_configuration failed 0x%x\n", | 596 | "pcmcia_request_configuration failed 0x%x\n", |
600 | fail_rc); | 597 | fail_rc); |
601 | goto cs_release; | 598 | goto cs_release; |
@@ -616,23 +613,22 @@ static void reader_config(dev_link_t *link, int devno) | |||
616 | return; | 613 | return; |
617 | 614 | ||
618 | cs_failed: | 615 | cs_failed: |
619 | cs_error(handle, fail_fn, fail_rc); | 616 | cs_error(link, fail_fn, fail_rc); |
620 | cs_release: | 617 | cs_release: |
621 | reader_release(link); | 618 | reader_release(link); |
622 | link->state &= ~DEV_CONFIG_PENDING; | 619 | link->state &= ~DEV_CONFIG_PENDING; |
623 | } | 620 | } |
624 | 621 | ||
625 | static void reader_release(dev_link_t *link) | 622 | static void reader_release(struct pcmcia_device *link) |
626 | { | 623 | { |
627 | cm4040_reader_release(link->priv); | 624 | cm4040_reader_release(link->priv); |
628 | pcmcia_disable_device(link->handle); | 625 | pcmcia_disable_device(link); |
629 | } | 626 | } |
630 | 627 | ||
631 | static int reader_attach(struct pcmcia_device *p_dev) | 628 | static int reader_attach(struct pcmcia_device *link) |
632 | { | 629 | { |
633 | struct reader_dev *dev; | 630 | struct reader_dev *dev; |
634 | int i; | 631 | int i; |
635 | dev_link_t *link = dev_to_instance(p_dev); | ||
636 | 632 | ||
637 | for (i = 0; i < CM_MAX_DEV; i++) { | 633 | for (i = 0; i < CM_MAX_DEV; i++) { |
638 | if (dev_table[i] == NULL) | 634 | if (dev_table[i] == NULL) |
@@ -650,7 +646,7 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
650 | dev->buffer_status = 0; | 646 | dev->buffer_status = 0; |
651 | 647 | ||
652 | link->priv = dev; | 648 | link->priv = dev; |
653 | dev->p_dev = p_dev; | 649 | dev->p_dev = link; |
654 | 650 | ||
655 | link->conf.IntType = INT_MEMORY_AND_IO; | 651 | link->conf.IntType = INT_MEMORY_AND_IO; |
656 | dev_table[i] = link; | 652 | dev_table[i] = link; |
@@ -671,9 +667,8 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
671 | return 0; | 667 | return 0; |
672 | } | 668 | } |
673 | 669 | ||
674 | static void reader_detach(struct pcmcia_device *p_dev) | 670 | static void reader_detach(struct pcmcia_device *link) |
675 | { | 671 | { |
676 | dev_link_t *link = dev_to_instance(p_dev); | ||
677 | struct reader_dev *dev = link->priv; | 672 | struct reader_dev *dev = link->priv; |
678 | int devno; | 673 | int devno; |
679 | 674 | ||