aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/cm4000_cs.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-06-19 16:34:41 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-06-24 09:33:44 -0400
commit8b5332f6994e34f2b400b25975760da709bbaa63 (patch)
tree2ad1bee9616a0be92a54f4c7c747674f6a72b9de /drivers/char/pcmcia/cm4000_cs.c
parent4aeba0134f1e54cfd881e118b039ab6ed8b99126 (diff)
pcmcia: cm40x0 cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net> 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.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 933a7dd8f86..59ca35156d8 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1652,16 +1652,22 @@ static int cmm_open(struct inode *inode, struct file *filp)
1652 struct cm4000_dev *dev; 1652 struct cm4000_dev *dev;
1653 struct pcmcia_device *link; 1653 struct pcmcia_device *link;
1654 int minor = iminor(inode); 1654 int minor = iminor(inode);
1655 int ret;
1655 1656
1656 if (minor >= CM4000_MAX_DEV) 1657 if (minor >= CM4000_MAX_DEV)
1657 return -ENODEV; 1658 return -ENODEV;
1658 1659
1660 lock_kernel();
1659 link = dev_table[minor]; 1661 link = dev_table[minor];
1660 if (link == NULL || !pcmcia_dev_present(link)) 1662 if (link == NULL || !pcmcia_dev_present(link)) {
1661 return -ENODEV; 1663 ret = -ENODEV;
1664 goto out;
1665 }
1662 1666
1663 if (link->open) 1667 if (link->open) {
1664 return -EBUSY; 1668 ret = -EBUSY;
1669 goto out;
1670 }
1665 1671
1666 dev = link->priv; 1672 dev = link->priv;
1667 filp->private_data = dev; 1673 filp->private_data = dev;
@@ -1681,8 +1687,10 @@ static int cmm_open(struct inode *inode, struct file *filp)
1681 * vaild = block until valid (or card 1687 * vaild = block until valid (or card
1682 * inserted) 1688 * inserted)
1683 */ 1689 */
1684 if (filp->f_flags & O_NONBLOCK) 1690 if (filp->f_flags & O_NONBLOCK) {
1685 return -EAGAIN; 1691 ret = -EAGAIN;
1692 goto out;
1693 }
1686 1694
1687 dev->mdelay = T_50MSEC; 1695 dev->mdelay = T_50MSEC;
1688 1696
@@ -1692,7 +1700,10 @@ static int cmm_open(struct inode *inode, struct file *filp)
1692 link->open = 1; /* only one open per device */ 1700 link->open = 1; /* only one open per device */
1693 1701
1694 DEBUGP(2, dev, "<- cmm_open\n"); 1702 DEBUGP(2, dev, "<- cmm_open\n");
1695 return nonseekable_open(inode, filp); 1703 ret = nonseekable_open(inode, filp);
1704out:
1705 unlock_kernel();
1706 return ret;
1696} 1707}
1697 1708
1698static int cmm_close(struct inode *inode, struct file *filp) 1709static int cmm_close(struct inode *inode, struct file *filp)