mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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
This commit is contained in:
commit
2bea2e4abf
1 changed files with 8 additions and 6 deletions
|
@ -47,6 +47,9 @@ static struct uio_class {
|
||||||
struct class *class;
|
struct class *class;
|
||||||
} *uio_class;
|
} *uio_class;
|
||||||
|
|
||||||
|
/* Protect idr accesses */
|
||||||
|
static DEFINE_MUTEX(minor_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* attributes
|
* attributes
|
||||||
*/
|
*/
|
||||||
|
@ -239,7 +242,6 @@ static void uio_dev_del_attributes(struct uio_device *idev)
|
||||||
|
|
||||||
static int uio_get_minor(struct uio_device *idev)
|
static int uio_get_minor(struct uio_device *idev)
|
||||||
{
|
{
|
||||||
static DEFINE_MUTEX(minor_lock);
|
|
||||||
int retval = -ENOMEM;
|
int retval = -ENOMEM;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
|
@ -261,7 +263,9 @@ exit:
|
||||||
|
|
||||||
static void uio_free_minor(struct uio_device *idev)
|
static void uio_free_minor(struct uio_device *idev)
|
||||||
{
|
{
|
||||||
|
mutex_lock(&minor_lock);
|
||||||
idr_remove(&uio_idr, idev->minor);
|
idr_remove(&uio_idr, idev->minor);
|
||||||
|
mutex_unlock(&minor_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -305,8 +309,9 @@ static int uio_open(struct inode *inode, struct file *filep)
|
||||||
struct uio_listener *listener;
|
struct uio_listener *listener;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lock_kernel();
|
mutex_lock(&minor_lock);
|
||||||
idev = idr_find(&uio_idr, iminor(inode));
|
idev = idr_find(&uio_idr, iminor(inode));
|
||||||
|
mutex_unlock(&minor_lock);
|
||||||
if (!idev) {
|
if (!idev) {
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -332,18 +337,15 @@ static int uio_open(struct inode *inode, struct file *filep)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_infoopen;
|
goto err_infoopen;
|
||||||
}
|
}
|
||||||
unlock_kernel();
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_infoopen:
|
err_infoopen:
|
||||||
|
|
||||||
kfree(listener);
|
kfree(listener);
|
||||||
err_alloc_listener:
|
|
||||||
|
|
||||||
|
err_alloc_listener:
|
||||||
module_put(idev->owner);
|
module_put(idev->owner);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
unlock_kernel();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue