drivers: Push down BKL into various drivers
[safe/jmp/linux-2.6] / drivers / char / ipmi / ipmi_devintf.c
index 65545de..d8ec92a 100644 (file)
@@ -228,8 +228,7 @@ static int handle_send_req(ipmi_user_t     user,
        return rv;
 }
 
-static int ipmi_ioctl(struct inode  *inode,
-                     struct file   *file,
+static int ipmi_ioctl(struct file   *file,
                      unsigned int  cmd,
                      unsigned long data)
 {
@@ -630,6 +629,23 @@ static int ipmi_ioctl(struct inode  *inode,
        return rv;
 }
 
+/*
+ * Note: it doesn't make sense to take the BKL here but
+ *       not in compat_ipmi_ioctl. -arnd
+ */
+static long ipmi_unlocked_ioctl(struct file   *file,
+                               unsigned int  cmd,
+                               unsigned long data)
+{
+       int ret;
+
+       lock_kernel();
+       ret = ipmi_ioctl(file, cmd, data);
+       unlock_kernel();
+
+       return ret;
+}
+
 #ifdef CONFIG_COMPAT
 
 /*
@@ -802,7 +818,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
                if (copy_to_user(precv64, &recv64, sizeof(recv64)))
                        return -EFAULT;
 
-               rc = ipmi_ioctl(filep->f_path.dentry->d_inode, filep,
+               rc = ipmi_ioctl(filep,
                                ((cmd == COMPAT_IPMICTL_RECEIVE_MSG)
                                 ? IPMICTL_RECEIVE_MSG
                                 : IPMICTL_RECEIVE_MSG_TRUNC),
@@ -819,14 +835,14 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
                return rc;
        }
        default:
-               return ipmi_ioctl(filep->f_path.dentry->d_inode, filep, cmd, arg);
+               return ipmi_ioctl(filep, cmd, arg);
        }
 }
 #endif
 
 static const struct file_operations ipmi_fops = {
        .owner          = THIS_MODULE,
-       .ioctl          = ipmi_ioctl,
+       .unlocked_ioctl = ipmi_unlocked_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl   = compat_ipmi_ioctl,
 #endif