Skip to contentSkip to conversation

hci_vhci: Elimiate BKL from ioctl handling

PATCH In review Alan Cox 3 participants 3 messages May 22, 2008 Bluetooth drivers

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 hci_vhci: Elimiate BKL from ioctl handling

Switch to unlocked_ioctl and fix the return value to be -ENOTTY as it should be.

drivers/bluetooth/hci_vhci.c +3 -4
index 0638730..41002ef 100644
@@ -245,10 +245,9 @@ static unsigned int vhci_poll(struct file *file, poll_table *wait)
 	return POLLOUT | POLLWRNORM;
 }
 
-static int vhci_ioctl(struct inode *inode, struct file *file,
-					unsigned int cmd, unsigned long arg)
+static long vhci_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	return -EINVAL;
+	return -ENOTTY;
 }
 
 static int vhci_open(struct inode *inode, struct file *file)
@@ -332,7 +331,7 @@ static const struct file_operations vhci_fops = {
 	.read		= vhci_read,
 	.write		= vhci_write,
 	.poll		= vhci_poll,
-	.ioctl		= vhci_ioctl,
+	.unlocked_ioctl	= vhci_ioctl,
 	.open		= vhci_open,
 	.release	= vhci_release,
 	.fasync		= vhci_fasync,
#1 lore raw
Quoted 24 lines · Alan Cox

Switch to unlocked_ioctl and fix the return value to be -ENOTTY as it should be.

drivers/bluetooth/hci_vhci.c +2 -3
index 0638730..41002ef 100644
@@ -245,10 +245,9 @@ static unsigned int vhci_poll(struct file *file, poll_table *wait)
 	return POLLOUT | POLLWRNORM;
 }
 
-static int vhci_ioctl(struct inode *inode, struct file *file,
-					unsigned int cmd, unsigned long arg)
+static long vhci_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	return -EINVAL;
+	return -ENOTTY;
 }
 
 static int vhci_open(struct inode *inode, struct file *file)

drivers/bluetooth/hci_vhci.c static const struct file_operations vhci_fops = { · line 337

Quoted 8 lines
drivers/bluetooth/hci_vhci.c +1 -1
@@ -332,7 +331,7 @@ static const struct file_operations vhci_fops = {
 	.read		= vhci_read,
 	.write		= vhci_write,
 	.poll		= vhci_poll,
-	.ioctl		= vhci_ioctl,
+	.unlocked_ioctl	= vhci_ioctl,
 	.open		= vhci_open,
 	.release	= vhci_release,
 	.fasync		= vhci_fasync,

Ack.

CC'ing Marcel.

Max