USB: Push BKL on open down into the drivers

Straightforward push into the drivers to allow
auditing individual drivers separately

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
这个提交包含在:
Oliver Neukum
2010-01-13 15:33:15 +01:00
提交者 Greg Kroah-Hartman
父节点 f9de332ebf
当前提交 86266452f8
修改 20 个文件,包含 99 行新增15 行删除

查看文件

@@ -2416,21 +2416,28 @@ sisusb_open(struct inode *inode, struct file *file)
struct usb_interface *interface;
int subminor = iminor(inode);
if (!(interface = usb_find_interface(&sisusb_driver, subminor)))
lock_kernel();
if (!(interface = usb_find_interface(&sisusb_driver, subminor))) {
unlock_kernel();
return -ENODEV;
}
if (!(sisusb = usb_get_intfdata(interface)))
if (!(sisusb = usb_get_intfdata(interface))) {
unlock_kernel();
return -ENODEV;
}
mutex_lock(&sisusb->lock);
if (!sisusb->present || !sisusb->ready) {
mutex_unlock(&sisusb->lock);
unlock_kernel();
return -ENODEV;
}
if (sisusb->isopen) {
mutex_unlock(&sisusb->lock);
unlock_kernel();
return -EBUSY;
}
@@ -2439,11 +2446,13 @@ sisusb_open(struct inode *inode, struct file *file)
if (sisusb_init_gfxdevice(sisusb, 0)) {
mutex_unlock(&sisusb->lock);
dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n");
unlock_kernel();
return -EIO;
}
} else {
mutex_unlock(&sisusb->lock);
dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n");
unlock_kernel();
return -EIO;
}
}
@@ -2456,6 +2465,7 @@ sisusb_open(struct inode *inode, struct file *file)
file->private_data = sisusb;
mutex_unlock(&sisusb->lock);
unlock_kernel();
return 0;
}