Skip to contentSkip to conversation

i2c: Push ioctl BKL down into the i2c code

PATCH In review Jean Delvare 2 participants 3 messages May 24, 2008 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: Push ioctl BKL down into the i2c code

From: Alan Cox <alan-qBU/[email protected]>

This is part of the effort to get rid of the BKL.

[JD: In fact i2c-dev doesn't need more locking than is already done for the other i2c drivers, so we can simply switch to unlocked_ioctl.]

---
 drivers/i2c/i2c-dev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/i2c-dev.c +3 -3
@@ -366,8 +366,8 @@ static noinline int i2cdev_ioctl_smbus(s
 	return res;
 }
 
-static int i2cdev_ioctl(struct inode *inode, struct file *file,
-		unsigned int cmd, unsigned long arg)
+static long i2cdev_ioctl(struct file *file, unsigned int cmd,
+						unsigned long arg)
 {
 	struct i2c_client *client = (struct i2c_client *)file->private_data;
 	unsigned long funcs;
@@ -487,7 +487,7 @@ static const struct file_operations i2cd
 	.llseek		= no_llseek,
 	.read		= i2cdev_read,
 	.write		= i2cdev_write,
-	.ioctl		= i2cdev_ioctl,
+	.unlocked_ioctl	= i2cdev_ioctl,
 	.open		= i2cdev_open,
 	.release	= i2cdev_release,
 };
Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 6 lines · Jean Delvare

From: Alan Cox <alan-qBU/[email protected]>

This is part of the effort to get rid of the BKL.

[JD: In fact i2c-dev doesn't need more locking than is already done for the other i2c drivers, so we can simply switch to unlocked_ioctl.]

Note that the existing locking code in i2c (which may be correct without the BLK) hasn't really been tested since the BKL was serializing things before they got to the i2c code.

Quoted 39 lines

---

  drivers/i2c/i2c-dev.c |    6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

--- linux-2.6.26-rc3.orig/drivers/i2c/i2c-dev.c 2008-05-04 09:49:48.000000000 +0200
+++ linux-2.6.26-rc3/drivers/i2c/i2c-dev.c 2008-05-24 08:33:29.000000000 +0200
@@ -366,8 +366,8 @@ static noinline int i2cdev_ioctl_smbus(s

        return res;

}

-static int i2cdev_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static long i2cdev_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)

  {
        struct i2c_client *client = (struct i2c_client *)file->private_data;
        unsigned long funcs;
 @@ -487,7 +487,7 @@ static const struct file_operations i2cd
        .llseek         = no_llseek,
        .read           = i2cdev_read,
        .write          = i2cdev_write,

- .ioctl = i2cdev_ioctl,
+ .unlocked_ioctl = i2cdev_ioctl,
.open = i2cdev_open,
.release = i2cdev_release,
};

--
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Signature · 7 lines
Jon Smirl
[email protected]

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): 9e4733910805240750g21130ae9sd01e928edff8eb64-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 11 lines · Jon Smirl
Quoted 6 lines · Jean Delvare

From: Alan Cox <alan-qBU/[email protected]>

This is part of the effort to get rid of the BKL.

[JD: In fact i2c-dev doesn't need more locking than is already done for the other i2c drivers, so we can simply switch to unlocked_ioctl.]

Note that the existing locking code in i2c (which may be correct without the BLK) hasn't really been tested since the BKL was serializing things before they got to the i2c code.

On the i2c-dev side, yes. But all other i2c chip drivers didn't get to take the BKL, so the locking code in i2c (which definitely needs some clean ups, but that's another story) has been tested by these and i2c-dev isn't that different from them. That's why I believe no particular locking is needed for i2c-dev. But of course if someone can think of a reason why i2c-dev is different and needs additional care, please speak up.

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c