diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 16:42:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 16:42:14 -0400 |
commit | 2bea2e4abf2fe8bc7384103aeaad91089109cfba (patch) | |
tree | 3f7cf9712fa8998213bf2f7ed97b40e65946cd92 /drivers | |
parent | a0bfb673dca8a2b4324fe11e678ec6d6a9ad67e0 (diff) | |
parent | 0d4a7bc12ffecd3ba41dd94179cc5b272b71ce8a (diff) |
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6:
UIO: BKL removal
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/uio/uio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 5dccf057a7dd..f9b4647255aa 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -47,6 +47,9 @@ static struct uio_class { | |||
47 | struct class *class; | 47 | struct class *class; |
48 | } *uio_class; | 48 | } *uio_class; |
49 | 49 | ||
50 | /* Protect idr accesses */ | ||
51 | static DEFINE_MUTEX(minor_lock); | ||
52 | |||
50 | /* | 53 | /* |
51 | * attributes | 54 | * attributes |
52 | */ | 55 | */ |
@@ -239,7 +242,6 @@ static void uio_dev_del_attributes(struct uio_device *idev) | |||
239 | 242 | ||
240 | static int uio_get_minor(struct uio_device *idev) | 243 | static int uio_get_minor(struct uio_device *idev) |
241 | { | 244 | { |
242 | static DEFINE_MUTEX(minor_lock); | ||
243 | int retval = -ENOMEM; | 245 | int retval = -ENOMEM; |
244 | int id; | 246 | int id; |
245 | 247 | ||
@@ -261,7 +263,9 @@ exit: | |||
261 | 263 | ||
262 | static void uio_free_minor(struct uio_device *idev) | 264 | static void uio_free_minor(struct uio_device *idev) |
263 | { | 265 | { |
266 | mutex_lock(&minor_lock); | ||
264 | idr_remove(&uio_idr, idev->minor); | 267 | idr_remove(&uio_idr, idev->minor); |
268 | mutex_unlock(&minor_lock); | ||
265 | } | 269 | } |
266 | 270 | ||
267 | /** | 271 | /** |
@@ -305,8 +309,9 @@ static int uio_open(struct inode *inode, struct file *filep) | |||
305 | struct uio_listener *listener; | 309 | struct uio_listener *listener; |
306 | int ret = 0; | 310 | int ret = 0; |
307 | 311 | ||
308 | lock_kernel(); | 312 | mutex_lock(&minor_lock); |
309 | idev = idr_find(&uio_idr, iminor(inode)); | 313 | idev = idr_find(&uio_idr, iminor(inode)); |
314 | mutex_unlock(&minor_lock); | ||
310 | if (!idev) { | 315 | if (!idev) { |
311 | ret = -ENODEV; | 316 | ret = -ENODEV; |
312 | goto out; | 317 | goto out; |
@@ -332,18 +337,15 @@ static int uio_open(struct inode *inode, struct file *filep) | |||
332 | if (ret) | 337 | if (ret) |
333 | goto err_infoopen; | 338 | goto err_infoopen; |
334 | } | 339 | } |
335 | unlock_kernel(); | ||
336 | return 0; | 340 | return 0; |
337 | 341 | ||
338 | err_infoopen: | 342 | err_infoopen: |
339 | |||
340 | kfree(listener); | 343 | kfree(listener); |
341 | err_alloc_listener: | ||
342 | 344 | ||
345 | err_alloc_listener: | ||
343 | module_put(idev->owner); | 346 | module_put(idev->owner); |
344 | 347 | ||
345 | out: | 348 | out: |
346 | unlock_kernel(); | ||
347 | return ret; | 349 | return ret; |
348 | } | 350 | } |
349 | 351 | ||