aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-04-26 18:24:05 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-05-16 23:27:41 -0400
commit55929332c92e5d34d65a8f784604c92677ea3e15 (patch)
tree555e922d470336d07ace32bb564ac5358379a3c4 /drivers/char/ipmi
parent703c631ebbcadcfd861d01e697fdda7c388fec9a (diff)
drivers: Push down BKL into various drivers
These are the last remaining device drivers using the ->ioctl file operation in the drivers directory (except from v4l drivers). [fweisbec: drop i8k pushdown as it has been done from procfs pushdown branch already] Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c26
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c17
2 files changed, 36 insertions, 7 deletions
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 65545de3dbf4..d8ec92a38980 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -228,8 +228,7 @@ static int handle_send_req(ipmi_user_t user,
228 return rv; 228 return rv;
229} 229}
230 230
231static int ipmi_ioctl(struct inode *inode, 231static int ipmi_ioctl(struct file *file,
232 struct file *file,
233 unsigned int cmd, 232 unsigned int cmd,
234 unsigned long data) 233 unsigned long data)
235{ 234{
@@ -630,6 +629,23 @@ static int ipmi_ioctl(struct inode *inode,
630 return rv; 629 return rv;
631} 630}
632 631
632/*
633 * Note: it doesn't make sense to take the BKL here but
634 * not in compat_ipmi_ioctl. -arnd
635 */
636static long ipmi_unlocked_ioctl(struct file *file,
637 unsigned int cmd,
638 unsigned long data)
639{
640 int ret;
641
642 lock_kernel();
643 ret = ipmi_ioctl(file, cmd, data);
644 unlock_kernel();
645
646 return ret;
647}
648
633#ifdef CONFIG_COMPAT 649#ifdef CONFIG_COMPAT
634 650
635/* 651/*
@@ -802,7 +818,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
802 if (copy_to_user(precv64, &recv64, sizeof(recv64))) 818 if (copy_to_user(precv64, &recv64, sizeof(recv64)))
803 return -EFAULT; 819 return -EFAULT;
804 820
805 rc = ipmi_ioctl(filep->f_path.dentry->d_inode, filep, 821 rc = ipmi_ioctl(filep,
806 ((cmd == COMPAT_IPMICTL_RECEIVE_MSG) 822 ((cmd == COMPAT_IPMICTL_RECEIVE_MSG)
807 ? IPMICTL_RECEIVE_MSG 823 ? IPMICTL_RECEIVE_MSG
808 : IPMICTL_RECEIVE_MSG_TRUNC), 824 : IPMICTL_RECEIVE_MSG_TRUNC),
@@ -819,14 +835,14 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
819 return rc; 835 return rc;
820 } 836 }
821 default: 837 default:
822 return ipmi_ioctl(filep->f_path.dentry->d_inode, filep, cmd, arg); 838 return ipmi_ioctl(filep, cmd, arg);
823 } 839 }
824} 840}
825#endif 841#endif
826 842
827static const struct file_operations ipmi_fops = { 843static const struct file_operations ipmi_fops = {
828 .owner = THIS_MODULE, 844 .owner = THIS_MODULE,
829 .ioctl = ipmi_ioctl, 845 .unlocked_ioctl = ipmi_unlocked_ioctl,
830#ifdef CONFIG_COMPAT 846#ifdef CONFIG_COMPAT
831 .compat_ioctl = compat_ipmi_ioctl, 847 .compat_ioctl = compat_ipmi_ioctl,
832#endif 848#endif
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index a4d57e31f713..82bcdb262a3a 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -659,7 +659,7 @@ static struct watchdog_info ident = {
659 .identity = "IPMI" 659 .identity = "IPMI"
660}; 660};
661 661
662static int ipmi_ioctl(struct inode *inode, struct file *file, 662static int ipmi_ioctl(struct file *file,
663 unsigned int cmd, unsigned long arg) 663 unsigned int cmd, unsigned long arg)
664{ 664{
665 void __user *argp = (void __user *)arg; 665 void __user *argp = (void __user *)arg;
@@ -730,6 +730,19 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
730 } 730 }
731} 731}
732 732
733static long ipmi_unlocked_ioctl(struct file *file,
734 unsigned int cmd,
735 unsigned long arg)
736{
737 int ret;
738
739 lock_kernel();
740 ret = ipmi_ioctl(file, cmd, arg);
741 unlock_kernel();
742
743 return ret;
744}
745
733static ssize_t ipmi_write(struct file *file, 746static ssize_t ipmi_write(struct file *file,
734 const char __user *buf, 747 const char __user *buf,
735 size_t len, 748 size_t len,
@@ -880,7 +893,7 @@ static const struct file_operations ipmi_wdog_fops = {
880 .read = ipmi_read, 893 .read = ipmi_read,
881 .poll = ipmi_poll, 894 .poll = ipmi_poll,
882 .write = ipmi_write, 895 .write = ipmi_write,
883 .ioctl = ipmi_ioctl, 896 .unlocked_ioctl = ipmi_unlocked_ioctl,
884 .open = ipmi_open, 897 .open = ipmi_open,
885 .release = ipmi_close, 898 .release = ipmi_close,
886 .fasync = ipmi_fasync, 899 .fasync = ipmi_fasync,