aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/cm4000_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/pcmcia/cm4000_cs.c')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 3e6d6e0bb6e..79b8ad0e32d 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