diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:48:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:48:31 -0400 |
commit | d1794f2c5b5817eb79ccc5e00701ca748d1b073a (patch) | |
tree | 5a4c98e694e88a8c82f342d0cc9edb2a4cbbef36 /drivers/pcmcia/pcmcia_ioctl.c | |
parent | a41eebab7537890409ea9dfe0fcda9b5fbdb090d (diff) | |
parent | 2fceef397f9880b212a74c418290ce69e7ac00eb (diff) |
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits)
IB/umad: BKL is not needed for ib_umad_open()
IB/uverbs: BKL is not needed for ib_uverbs_open()
bf561-coreb: BKL unneeded for open()
Call fasync() functions without the BKL
snd/PCM: fasync BKL pushdown
ipmi: fasync BKL pushdown
ecryptfs: fasync BKL pushdown
Bluetooth VHCI: fasync BKL pushdown
tty_io: fasync BKL pushdown
tun: fasync BKL pushdown
i2o: fasync BKL pushdown
mpt: fasync BKL pushdown
Remove BKL from remote_llseek v2
Make FAT users happier by not deadlocking
x86-mce: BKL pushdown
vmwatchdog: BKL pushdown
vmcp: BKL pushdown
via-pmu: BKL pushdown
uml-random: BKL pushdown
uml-mmapper: BKL pushdown
...
Diffstat (limited to 'drivers/pcmcia/pcmcia_ioctl.c')
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index afd00e7bbbef..419f97fc9a62 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
28 | #include <linux/poll.h> | 28 | #include <linux/poll.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/smp_lock.h> | ||
30 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
31 | 32 | ||
32 | #include <pcmcia/cs_types.h> | 33 | #include <pcmcia/cs_types.h> |
@@ -545,20 +546,27 @@ static int ds_open(struct inode *inode, struct file *file) | |||
545 | struct pcmcia_socket *s; | 546 | struct pcmcia_socket *s; |
546 | user_info_t *user; | 547 | user_info_t *user; |
547 | static int warning_printed = 0; | 548 | static int warning_printed = 0; |
549 | int ret = 0; | ||
548 | 550 | ||
549 | ds_dbg(0, "ds_open(socket %d)\n", i); | 551 | ds_dbg(0, "ds_open(socket %d)\n", i); |
550 | 552 | ||
553 | lock_kernel(); | ||
551 | s = pcmcia_get_socket_by_nr(i); | 554 | s = pcmcia_get_socket_by_nr(i); |
552 | if (!s) | 555 | if (!s) { |
553 | return -ENODEV; | 556 | ret = -ENODEV; |
557 | goto out; | ||
558 | } | ||
554 | s = pcmcia_get_socket(s); | 559 | s = pcmcia_get_socket(s); |
555 | if (!s) | 560 | if (!s) { |
556 | return -ENODEV; | 561 | ret = -ENODEV; |
562 | goto out; | ||
563 | } | ||
557 | 564 | ||
558 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { | 565 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { |
559 | if (s->pcmcia_state.busy) { | 566 | if (s->pcmcia_state.busy) { |
560 | pcmcia_put_socket(s); | 567 | pcmcia_put_socket(s); |
561 | return -EBUSY; | 568 | ret = -EBUSY; |
569 | goto out; | ||
562 | } | 570 | } |
563 | else | 571 | else |
564 | s->pcmcia_state.busy = 1; | 572 | s->pcmcia_state.busy = 1; |
@@ -567,7 +575,8 @@ static int ds_open(struct inode *inode, struct file *file) | |||
567 | user = kmalloc(sizeof(user_info_t), GFP_KERNEL); | 575 | user = kmalloc(sizeof(user_info_t), GFP_KERNEL); |
568 | if (!user) { | 576 | if (!user) { |
569 | pcmcia_put_socket(s); | 577 | pcmcia_put_socket(s); |
570 | return -ENOMEM; | 578 | ret = -ENOMEM; |
579 | goto out; | ||
571 | } | 580 | } |
572 | user->event_tail = user->event_head = 0; | 581 | user->event_tail = user->event_head = 0; |
573 | user->next = s->user; | 582 | user->next = s->user; |
@@ -589,7 +598,9 @@ static int ds_open(struct inode *inode, struct file *file) | |||
589 | 598 | ||
590 | if (s->pcmcia_state.present) | 599 | if (s->pcmcia_state.present) |
591 | queue_event(user, CS_EVENT_CARD_INSERTION); | 600 | queue_event(user, CS_EVENT_CARD_INSERTION); |
592 | return 0; | 601 | out: |
602 | unlock_kernel(); | ||
603 | return ret; | ||
593 | } /* ds_open */ | 604 | } /* ds_open */ |
594 | 605 | ||
595 | /*====================================================================*/ | 606 | /*====================================================================*/ |