From b1f2ac07636aadee5cb077fc7e830908b00fcaae Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 27 Apr 2010 20:15:07 +0200 Subject: Staging: push down BKL into ioctl functions Signed-off-by: Arnd Bergmann Cc: Frederic Weisbecker Signed-off-by: Greg Kroah-Hartman --- drivers/staging/crystalhd/crystalhd_lnx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers/staging/crystalhd') diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c index 58fd91af0912..6090a1d59549 100644 --- a/drivers/staging/crystalhd/crystalhd_lnx.c +++ b/drivers/staging/crystalhd/crystalhd_lnx.c @@ -16,6 +16,7 @@ ***************************************************************************/ #include +#include #include #include "crystalhd_lnx.h" @@ -261,12 +262,12 @@ static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua, } /* API interfaces */ -static int chd_dec_ioctl(struct inode *in, struct file *fd, - unsigned int cmd, unsigned long ua) +static long chd_dec_ioctl(struct file *fd, unsigned int cmd, unsigned long ua) { struct crystalhd_adp *adp = chd_get_adp(); crystalhd_cmd_proc cproc; struct crystalhd_user *uc; + int ret; if (!adp || !fd) { BCMLOG_ERR("Invalid adp\n"); @@ -279,13 +280,17 @@ static int chd_dec_ioctl(struct inode *in, struct file *fd, return -ENODATA; } + lock_kernel(); cproc = crystalhd_get_cmd_proc(&adp->cmds, cmd, uc); if (!cproc) { BCMLOG_ERR("Unhandled command: %d\n", cmd); + unlock_kernel(); return -EINVAL; } - return chd_dec_api_cmd(adp, ua, uc->uid, cmd, cproc); + ret = chd_dec_api_cmd(adp, ua, uc->uid, cmd, cproc); + unlock_kernel(); + return ret; } static int chd_dec_open(struct inode *in, struct file *fd) @@ -345,7 +350,7 @@ static int chd_dec_close(struct inode *in, struct file *fd) static const struct file_operations chd_dec_fops = { .owner = THIS_MODULE, - .ioctl = chd_dec_ioctl, + .unlocked_ioctl = chd_dec_ioctl, .open = chd_dec_open, .release = chd_dec_close, }; -- cgit v1.2.3