aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia
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/char/pcmcia
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/char/pcmcia')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c55
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c53
-rw-r--r--drivers/char/pcmcia/synclink_cs.c46
3 files changed, 69 insertions, 85 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 3e6d6e0bb6ee..79b8ad0e32df 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -67,7 +67,7 @@ static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
67#define T_100MSEC msecs_to_jiffies(100) 67#define T_100MSEC msecs_to_jiffies(100)
68#define T_500MSEC msecs_to_jiffies(500) 68#define T_500MSEC msecs_to_jiffies(500)
69 69
70static void cm4000_release(dev_link_t *link); 70static void cm4000_release(struct pcmcia_device *link);
71 71
72static int major; /* major number we get from the kernel */ 72static int major; /* major number we get from the kernel */
73 73
@@ -149,14 +149,14 @@ struct cm4000_dev {
149#define ZERO_DEV(dev) \ 149#define ZERO_DEV(dev) \
150 memset(&dev->atr_csum,0, \ 150 memset(&dev->atr_csum,0, \
151 sizeof(struct cm4000_dev) - \ 151 sizeof(struct cm4000_dev) - \
152 /*link*/ sizeof(dev_link_t) - \ 152 /*link*/ sizeof(struct pcmcia_device) - \
153 /*node*/ sizeof(dev_node_t) - \ 153 /*node*/ sizeof(dev_node_t) - \
154 /*atr*/ MAX_ATR*sizeof(char) - \ 154 /*atr*/ MAX_ATR*sizeof(char) - \
155 /*rbuf*/ 512*sizeof(char) - \ 155 /*rbuf*/ 512*sizeof(char) - \
156 /*sbuf*/ 512*sizeof(char) - \ 156 /*sbuf*/ 512*sizeof(char) - \
157 /*queue*/ 4*sizeof(wait_queue_head_t)) 157 /*queue*/ 4*sizeof(wait_queue_head_t))
158 158
159static dev_link_t *dev_table[CM4000_MAX_DEV]; 159static struct pcmcia_device *dev_table[CM4000_MAX_DEV];
160static struct class *cmm_class; 160static struct class *cmm_class;
161 161
162/* This table doesn't use spaces after the comma between fields and thus 162/* This table doesn't use spaces after the comma between fields and thus
@@ -1441,7 +1441,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1441{ 1441{
1442 struct cm4000_dev *dev = filp->private_data; 1442 struct cm4000_dev *dev = filp->private_data;
1443 ioaddr_t iobase = dev->p_dev->io.BasePort1; 1443 ioaddr_t iobase = dev->p_dev->io.BasePort1;
1444 dev_link_t *link; 1444 struct pcmcia_device *link;
1445 int size; 1445 int size;
1446 int rc; 1446 int rc;
1447 void __user *argp = (void __user *)arg; 1447 void __user *argp = (void __user *)arg;
@@ -1660,7 +1660,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1660static int cmm_open(struct inode *inode, struct file *filp) 1660static int cmm_open(struct inode *inode, struct file *filp)
1661{ 1661{
1662 struct cm4000_dev *dev; 1662 struct cm4000_dev *dev;
1663 dev_link_t *link; 1663 struct pcmcia_device *link;
1664 int rc, minor = iminor(inode); 1664 int rc, minor = iminor(inode);
1665 1665
1666 if (minor >= CM4000_MAX_DEV) 1666 if (minor >= CM4000_MAX_DEV)
@@ -1709,7 +1709,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
1709static int cmm_close(struct inode *inode, struct file *filp) 1709static int cmm_close(struct inode *inode, struct file *filp)
1710{ 1710{
1711 struct cm4000_dev *dev; 1711 struct cm4000_dev *dev;
1712 dev_link_t *link; 1712 struct pcmcia_device *link;
1713 int minor = iminor(inode); 1713 int minor = iminor(inode);
1714 1714
1715 if (minor >= CM4000_MAX_DEV) 1715 if (minor >= CM4000_MAX_DEV)
@@ -1735,7 +1735,7 @@ static int cmm_close(struct inode *inode, struct file *filp)
1735 return 0; 1735 return 0;
1736} 1736}
1737 1737
1738static void cmm_cm4000_release(dev_link_t * link) 1738static void cmm_cm4000_release(struct pcmcia_device * link)
1739{ 1739{
1740 struct cm4000_dev *dev = link->priv; 1740 struct cm4000_dev *dev = link->priv;
1741 1741
@@ -1759,9 +1759,8 @@ static void cmm_cm4000_release(dev_link_t * link)
1759 1759
1760/*==== Interface to PCMCIA Layer =======================================*/ 1760/*==== Interface to PCMCIA Layer =======================================*/
1761 1761
1762static void cm4000_config(dev_link_t * link, int devno) 1762static void cm4000_config(struct pcmcia_device * link, int devno)
1763{ 1763{
1764 client_handle_t handle = link->handle;
1765 struct cm4000_dev *dev; 1764 struct cm4000_dev *dev;
1766 tuple_t tuple; 1765 tuple_t tuple;
1767 cisparse_t parse; 1766 cisparse_t parse;
@@ -1776,16 +1775,16 @@ static void cm4000_config(dev_link_t * link, int devno)
1776 tuple.TupleDataMax = sizeof(buf); 1775 tuple.TupleDataMax = sizeof(buf);
1777 tuple.TupleOffset = 0; 1776 tuple.TupleOffset = 0;
1778 1777
1779 if ((fail_rc = pcmcia_get_first_tuple(handle, &tuple)) != CS_SUCCESS) { 1778 if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) {
1780 fail_fn = GetFirstTuple; 1779 fail_fn = GetFirstTuple;
1781 goto cs_failed; 1780 goto cs_failed;
1782 } 1781 }
1783 if ((fail_rc = pcmcia_get_tuple_data(handle, &tuple)) != CS_SUCCESS) { 1782 if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) {
1784 fail_fn = GetTupleData; 1783 fail_fn = GetTupleData;
1785 goto cs_failed; 1784 goto cs_failed;
1786 } 1785 }
1787 if ((fail_rc = 1786 if ((fail_rc =
1788 pcmcia_parse_tuple(handle, &tuple, &parse)) != CS_SUCCESS) { 1787 pcmcia_parse_tuple(link, &tuple, &parse)) != CS_SUCCESS) {
1789 fail_fn = ParseTuple; 1788 fail_fn = ParseTuple;
1790 goto cs_failed; 1789 goto cs_failed;
1791 } 1790 }
@@ -1798,13 +1797,13 @@ static void cm4000_config(dev_link_t * link, int devno)
1798 link->io.NumPorts2 = 0; 1797 link->io.NumPorts2 = 0;
1799 link->io.Attributes2 = 0; 1798 link->io.Attributes2 = 0;
1800 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 1799 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
1801 for (rc = pcmcia_get_first_tuple(handle, &tuple); 1800 for (rc = pcmcia_get_first_tuple(link, &tuple);
1802 rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(handle, &tuple)) { 1801 rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(link, &tuple)) {
1803 1802
1804 rc = pcmcia_get_tuple_data(handle, &tuple); 1803 rc = pcmcia_get_tuple_data(link, &tuple);
1805 if (rc != CS_SUCCESS) 1804 if (rc != CS_SUCCESS)
1806 continue; 1805 continue;
1807 rc = pcmcia_parse_tuple(handle, &tuple, &parse); 1806 rc = pcmcia_parse_tuple(link, &tuple, &parse);
1808 if (rc != CS_SUCCESS) 1807 if (rc != CS_SUCCESS)
1809 continue; 1808 continue;
1810 1809
@@ -1824,7 +1823,7 @@ static void cm4000_config(dev_link_t * link, int devno)
1824 link->io.IOAddrLines = parse.cftable_entry.io.flags 1823 link->io.IOAddrLines = parse.cftable_entry.io.flags
1825 & CISTPL_IO_LINES_MASK; 1824 & CISTPL_IO_LINES_MASK;
1826 1825
1827 rc = pcmcia_request_io(handle, &link->io); 1826 rc = pcmcia_request_io(link, &link->io);
1828 if (rc == CS_SUCCESS) 1827 if (rc == CS_SUCCESS)
1829 break; /* we are done */ 1828 break; /* we are done */
1830 } 1829 }
@@ -1834,7 +1833,7 @@ static void cm4000_config(dev_link_t * link, int devno)
1834 link->conf.IntType = 00000002; 1833 link->conf.IntType = 00000002;
1835 1834
1836 if ((fail_rc = 1835 if ((fail_rc =
1837 pcmcia_request_configuration(handle, &link->conf)) != CS_SUCCESS) { 1836 pcmcia_request_configuration(link, &link->conf)) != CS_SUCCESS) {
1838 fail_fn = RequestConfiguration; 1837 fail_fn = RequestConfiguration;
1839 goto cs_release; 1838 goto cs_release;
1840 } 1839 }
@@ -1850,16 +1849,15 @@ static void cm4000_config(dev_link_t * link, int devno)
1850 return; 1849 return;
1851 1850
1852cs_failed: 1851cs_failed:
1853 cs_error(handle, fail_fn, fail_rc); 1852 cs_error(link, fail_fn, fail_rc);
1854cs_release: 1853cs_release:
1855 cm4000_release(link); 1854 cm4000_release(link);
1856 1855
1857 link->state &= ~DEV_CONFIG_PENDING; 1856 link->state &= ~DEV_CONFIG_PENDING;
1858} 1857}
1859 1858
1860static int cm4000_suspend(struct pcmcia_device *p_dev) 1859static int cm4000_suspend(struct pcmcia_device *link)
1861{ 1860{
1862 dev_link_t *link = dev_to_instance(p_dev);
1863 struct cm4000_dev *dev; 1861 struct cm4000_dev *dev;
1864 1862
1865 dev = link->priv; 1863 dev = link->priv;
@@ -1868,9 +1866,8 @@ static int cm4000_suspend(struct pcmcia_device *p_dev)
1868 return 0; 1866 return 0;
1869} 1867}
1870 1868
1871static int cm4000_resume(struct pcmcia_device *p_dev) 1869static int cm4000_resume(struct pcmcia_device *link)
1872{ 1870{
1873 dev_link_t *link = dev_to_instance(p_dev);
1874 struct cm4000_dev *dev; 1871 struct cm4000_dev *dev;
1875 1872
1876 dev = link->priv; 1873 dev = link->priv;
@@ -1880,17 +1877,16 @@ static int cm4000_resume(struct pcmcia_device *p_dev)
1880 return 0; 1877 return 0;
1881} 1878}
1882 1879
1883static void cm4000_release(dev_link_t *link) 1880static void cm4000_release(struct pcmcia_device *link)
1884{ 1881{
1885 cmm_cm4000_release(link->priv); /* delay release until device closed */ 1882 cmm_cm4000_release(link->priv); /* delay release until device closed */
1886 pcmcia_disable_device(link->handle); 1883 pcmcia_disable_device(link);
1887} 1884}
1888 1885
1889static int cm4000_attach(struct pcmcia_device *p_dev) 1886static int cm4000_attach(struct pcmcia_device *link)
1890{ 1887{
1891 struct cm4000_dev *dev; 1888 struct cm4000_dev *dev;
1892 int i; 1889 int i;
1893 dev_link_t *link = dev_to_instance(p_dev);
1894 1890
1895 for (i = 0; i < CM4000_MAX_DEV; i++) 1891 for (i = 0; i < CM4000_MAX_DEV; i++)
1896 if (dev_table[i] == NULL) 1892 if (dev_table[i] == NULL)
@@ -1906,7 +1902,7 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
1906 if (dev == NULL) 1902 if (dev == NULL)
1907 return -ENOMEM; 1903 return -ENOMEM;
1908 1904
1909 dev->p_dev = p_dev; 1905 dev->p_dev = link;
1910 link->priv = dev; 1906 link->priv = dev;
1911 link->conf.IntType = INT_MEMORY_AND_IO; 1907 link->conf.IntType = INT_MEMORY_AND_IO;
1912 dev_table[i] = link; 1908 dev_table[i] = link;
@@ -1925,9 +1921,8 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
1925 return 0; 1921 return 0;
1926} 1922}
1927 1923
1928static void cm4000_detach(struct pcmcia_device *p_dev) 1924static void cm4000_detach(struct pcmcia_device *link)
1929{ 1925{
1930 dev_link_t *link = dev_to_instance(p_dev);
1931 struct cm4000_dev *dev = link->priv; 1926 struct cm4000_dev *dev = link->priv;
1932 int devno; 1927 int devno;
1933 1928
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
68static void reader_release(dev_link_t *link); 68static void reader_release(struct pcmcia_device *link);
69 69
70static int major; 70static int major;
71static struct class *cmx_class; 71static 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
90static dev_link_t *dev_table[CM_MAX_DEV]; 90static 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)
445static int cm4040_open(struct inode *inode, struct file *filp) 445static 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)
478static int cm4040_close(struct inode *inode, struct file *filp) 478static 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
503static void cm4040_reader_release(dev_link_t *link) 503static 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
517static void reader_config(dev_link_t *link, int devno) 517static 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
618cs_failed: 615cs_failed:
619 cs_error(handle, fail_fn, fail_rc); 616 cs_error(link, fail_fn, fail_rc);
620cs_release: 617cs_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
625static void reader_release(dev_link_t *link) 622static 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
631static int reader_attach(struct pcmcia_device *p_dev) 628static 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
674static void reader_detach(struct pcmcia_device *p_dev) 670static 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
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 7b1e055184d1..9bfd90e5d6b7 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
484 484
485/* PCMCIA prototypes */ 485/* PCMCIA prototypes */
486 486
487static void mgslpc_config(dev_link_t *link); 487static void mgslpc_config(struct pcmcia_device *link);
488static void mgslpc_release(u_long arg); 488static void mgslpc_release(u_long arg);
489static void mgslpc_detach(struct pcmcia_device *p_dev); 489static void mgslpc_detach(struct pcmcia_device *p_dev);
490 490
@@ -533,10 +533,9 @@ static void ldisc_receive_buf(struct tty_struct *tty,
533 } 533 }
534} 534}
535 535
536static int mgslpc_attach(struct pcmcia_device *p_dev) 536static int mgslpc_attach(struct pcmcia_device *link)
537{ 537{
538 MGSLPC_INFO *info; 538 MGSLPC_INFO *info;
539 dev_link_t *link = dev_to_instance(p_dev);
540 539
541 if (debug_level >= DEBUG_LEVEL_INFO) 540 if (debug_level >= DEBUG_LEVEL_INFO)
542 printk("mgslpc_attach\n"); 541 printk("mgslpc_attach\n");
@@ -565,10 +564,10 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
565 info->imrb_value = 0xffff; 564 info->imrb_value = 0xffff;
566 info->pim_value = 0xff; 565 info->pim_value = 0xff;
567 566
568 info->p_dev = p_dev; 567 info->p_dev = link;
569 link->priv = info; 568 link->priv = info;
570 569
571 /* Initialize the dev_link_t structure */ 570 /* Initialize the struct pcmcia_device structure */
572 571
573 /* Interrupt setup */ 572 /* Interrupt setup */
574 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 573 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -592,9 +591,8 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
592#define CS_CHECK(fn, ret) \ 591#define CS_CHECK(fn, ret) \
593do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 592do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
594 593
595static void mgslpc_config(dev_link_t *link) 594static void mgslpc_config(struct pcmcia_device *link)
596{ 595{
597 client_handle_t handle = link->handle;
598 MGSLPC_INFO *info = link->priv; 596 MGSLPC_INFO *info = link->priv;
599 tuple_t tuple; 597 tuple_t tuple;
600 cisparse_t parse; 598 cisparse_t parse;
@@ -612,9 +610,9 @@ static void mgslpc_config(dev_link_t *link)
612 tuple.TupleData = buf; 610 tuple.TupleData = buf;
613 tuple.TupleDataMax = sizeof(buf); 611 tuple.TupleDataMax = sizeof(buf);
614 tuple.TupleOffset = 0; 612 tuple.TupleOffset = 0;
615 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 613 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
616 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 614 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
617 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 615 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
618 link->conf.ConfigBase = parse.config.base; 616 link->conf.ConfigBase = parse.config.base;
619 link->conf.Present = parse.config.rmask[0]; 617 link->conf.Present = parse.config.rmask[0];
620 618
@@ -624,11 +622,11 @@ static void mgslpc_config(dev_link_t *link)
624 /* get CIS configuration entry */ 622 /* get CIS configuration entry */
625 623
626 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 624 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
627 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 625 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
628 626
629 cfg = &(parse.cftable_entry); 627 cfg = &(parse.cftable_entry);
630 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 628 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
631 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 629 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
632 630
633 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 631 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
634 if (cfg->index == 0) 632 if (cfg->index == 0)
@@ -649,7 +647,7 @@ static void mgslpc_config(dev_link_t *link)
649 link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 647 link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
650 link->io.BasePort1 = io->win[0].base; 648 link->io.BasePort1 = io->win[0].base;
651 link->io.NumPorts1 = io->win[0].len; 649 link->io.NumPorts1 = io->win[0].len;
652 CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); 650 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
653 } 651 }
654 652
655 link->conf.Attributes = CONF_ENABLE_IRQ; 653 link->conf.Attributes = CONF_ENABLE_IRQ;
@@ -660,9 +658,9 @@ static void mgslpc_config(dev_link_t *link)
660 link->irq.Attributes |= IRQ_HANDLE_PRESENT; 658 link->irq.Attributes |= IRQ_HANDLE_PRESENT;
661 link->irq.Handler = mgslpc_isr; 659 link->irq.Handler = mgslpc_isr;
662 link->irq.Instance = info; 660 link->irq.Instance = info;
663 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 661 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
664 662
665 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 663 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
666 664
667 info->io_base = link->io.BasePort1; 665 info->io_base = link->io.BasePort1;
668 info->irq_level = link->irq.AssignedIRQ; 666 info->irq_level = link->irq.AssignedIRQ;
@@ -685,7 +683,7 @@ static void mgslpc_config(dev_link_t *link)
685 return; 683 return;
686 684
687cs_failed: 685cs_failed:
688 cs_error(link->handle, last_fn, last_ret); 686 cs_error(link, last_fn, last_ret);
689 mgslpc_release((u_long)link); 687 mgslpc_release((u_long)link);
690} 688}
691 689
@@ -695,18 +693,16 @@ cs_failed:
695 */ 693 */
696static void mgslpc_release(u_long arg) 694static void mgslpc_release(u_long arg)
697{ 695{
698 dev_link_t *link = (dev_link_t *)arg; 696 struct pcmcia_device *link = (struct pcmcia_device *)arg;
699 697
700 if (debug_level >= DEBUG_LEVEL_INFO) 698 if (debug_level >= DEBUG_LEVEL_INFO)
701 printk("mgslpc_release(0x%p)\n", link); 699 printk("mgslpc_release(0x%p)\n", link);
702 700
703 pcmcia_disable_device(link->handle); 701 pcmcia_disable_device(link);
704} 702}
705 703
706static void mgslpc_detach(struct pcmcia_device *p_dev) 704static void mgslpc_detach(struct pcmcia_device *link)
707{ 705{
708 dev_link_t *link = dev_to_instance(p_dev);
709
710 if (debug_level >= DEBUG_LEVEL_INFO) 706 if (debug_level >= DEBUG_LEVEL_INFO)
711 printk("mgslpc_detach(0x%p)\n", link); 707 printk("mgslpc_detach(0x%p)\n", link);
712 708
@@ -718,9 +714,8 @@ static void mgslpc_detach(struct pcmcia_device *p_dev)
718 mgslpc_remove_device((MGSLPC_INFO *)link->priv); 714 mgslpc_remove_device((MGSLPC_INFO *)link->priv);
719} 715}
720 716
721static int mgslpc_suspend(struct pcmcia_device *dev) 717static int mgslpc_suspend(struct pcmcia_device *link)
722{ 718{
723 dev_link_t *link = dev_to_instance(dev);
724 MGSLPC_INFO *info = link->priv; 719 MGSLPC_INFO *info = link->priv;
725 720
726 info->stop = 1; 721 info->stop = 1;
@@ -728,9 +723,8 @@ static int mgslpc_suspend(struct pcmcia_device *dev)
728 return 0; 723 return 0;
729} 724}
730 725
731static int mgslpc_resume(struct pcmcia_device *dev) 726static int mgslpc_resume(struct pcmcia_device *link)
732{ 727{
733 dev_link_t *link = dev_to_instance(dev);
734 MGSLPC_INFO *info = link->priv; 728 MGSLPC_INFO *info = link->priv;
735 729
736 info->stop = 0; 730 info->stop = 0;