aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/cm4000_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:09:29 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:33 -0500
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/char/pcmcia/cm4000_cs.c
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
[PATCH] pcmcia: use bitfield instead of p_state and state
Instead of the two status values struct pcmcia_device->p_state and state, use descriptive bitfields. Most value-checking in drivers was invalid, as the core now only calls the ->remove() (a.k.a. detach) function in case the attachement _and_ configuration was successful. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/char/pcmcia/cm4000_cs.c')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 22dce9d47b2b..16e105d8d70c 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -971,7 +971,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count,
971 if (count == 0) /* according to manpage */ 971 if (count == 0) /* according to manpage */
972 return 0; 972 return 0;
973 973
974 if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */ 974 if (!pcmcia_dev_present(dev->p_dev) || /* device removed */
975 test_bit(IS_CMM_ABSENT, &dev->flags)) 975 test_bit(IS_CMM_ABSENT, &dev->flags))
976 return -ENODEV; 976 return -ENODEV;
977 977
@@ -1108,7 +1108,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
1108 1108
1109 sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0; 1109 sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0;
1110 1110
1111 if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */ 1111 if (!pcmcia_dev_present(dev->p_dev) || /* device removed */
1112 test_bit(IS_CMM_ABSENT, &dev->flags)) 1112 test_bit(IS_CMM_ABSENT, &dev->flags))
1113 return -ENODEV; 1113 return -ENODEV;
1114 1114
@@ -1789,7 +1789,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
1789 goto cs_failed; 1789 goto cs_failed;
1790 } 1790 }
1791 1791
1792 link->state |= DEV_CONFIG;
1793 link->conf.ConfigBase = parse.config.base; 1792 link->conf.ConfigBase = parse.config.base;
1794 link->conf.Present = parse.config.rmask[0]; 1793 link->conf.Present = parse.config.rmask[0];
1795 1794
@@ -1844,7 +1843,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
1844 dev->node.minor = devno; 1843 dev->node.minor = devno;
1845 dev->node.next = NULL; 1844 dev->node.next = NULL;
1846 link->dev_node = &dev->node; 1845 link->dev_node = &dev->node;
1847 link->state &= ~DEV_CONFIG_PENDING;
1848 1846
1849 return 0; 1847 return 0;
1850 1848
@@ -1852,8 +1850,6 @@ cs_failed:
1852 cs_error(link, fail_fn, fail_rc); 1850 cs_error(link, fail_fn, fail_rc);
1853cs_release: 1851cs_release:
1854 cm4000_release(link); 1852 cm4000_release(link);
1855
1856 link->state &= ~DEV_CONFIG_PENDING;
1857 return -ENODEV; 1853 return -ENODEV;
1858} 1854}
1859 1855
@@ -1913,7 +1909,6 @@ static int cm4000_probe(struct pcmcia_device *link)
1913 init_waitqueue_head(&dev->atrq); 1909 init_waitqueue_head(&dev->atrq);
1914 init_waitqueue_head(&dev->readq); 1910 init_waitqueue_head(&dev->readq);
1915 1911
1916 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1917 ret = cm4000_config(link, i); 1912 ret = cm4000_config(link, i);
1918 if (ret) 1913 if (ret)
1919 return ret; 1914 return ret;
@@ -1936,11 +1931,9 @@ static void cm4000_detach(struct pcmcia_device *link)
1936 if (devno == CM4000_MAX_DEV) 1931 if (devno == CM4000_MAX_DEV)
1937 return; 1932 return;
1938 1933
1939 link->state &= ~DEV_PRESENT;
1940 stop_monitor(dev); 1934 stop_monitor(dev);
1941 1935
1942 if (link->state & DEV_CONFIG) 1936 cm4000_release(link);
1943 cm4000_release(link);
1944 1937
1945 dev_table[devno] = NULL; 1938 dev_table[devno] = NULL;
1946 kfree(dev); 1939 kfree(dev);