public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers
@ 2009-11-16  0:26 Arnd Bergmann
  2009-11-16  0:27 ` [PATCH 07/12] i2cdev: move compat_ioctl handling into driver Arnd Bergmann
  2009-11-16  0:57 ` [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Neil Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Arnd Bergmann @ 2009-11-16  0:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-usb, user-mode-linux-user, Neil Brown, H. Peter Anvin,
	Paul Clements, Andre Noll, Pavel Machek, linux-i2c, Jens Axboe,
	Jan Blunck, Ian Kent, Nick Piggin, user-mode-linux-devel,
	linux-scsi, Kay Sievers, Alon Bar-Lev, Alan Stern,
	KOSAKI Motohiro, Doug Gilbert, David Vrabel, Alexey Dobriyan,
	Arnd Bergmann, Jeff Dike, Oliver Neukum, linux-raid, Tejun

This is the second series of patches on compat_ioctl handling,
moving compat handlers into more drivers. Most of these
patches consist on a part that adds a compat_ioctl method
in one driver and another part removing the respective
section from fs/compat_ioctl.c. The fs/compat_ioctl.c
portion depends on other patches[1], but the driver code can
be applied independently.

If some of you feel responsible for the code I patched, please
look at my changes and if they are ok, either take them into
your tree or give me an Acked-by for them.

I have tested the patches for sg, usbdevfs and autofs, which
was easily done in qemu, but I'm lacking test cases for
most of the other ones.

	Arnd <><

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Alon Bar-Lev <alon.barlev@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andre Noll <maan@systemlinux.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: autofs@linux.kernel.org
Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: David Vrabel <david.vrabel@csr.com>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ian Kent <raven@themaw.net>
Cc: James E.J. Bottomley <James.Bottomley@suse.de>
Cc: Jan Blunck <jblunck@suse.de>
Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-i2c@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-raid@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Oliver Neukum <oliver@neukum.org>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Pavel Machek <pavel@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: Wolfram Sang <w.sang@pengutronix.de>

Arnd Bergmann (12):
  arch/um: handle compat_ioctl in tty line driver
  scsi/sg: move compat_ioctl handling into sg driver
  autofs/autofs4: move compat_ioctl handling into fs
  raw: partly fix compat_ioctl handling on non-x86
  nbd: add compat_ioctl method
  smbfs: do compat_ioctl handling in place
  i2cdev: move compat_ioctl handling into driver
  md: move compat_ioctl handling into md.c
  lp: move compat_ioctl handling into lp.c
  usbdevfs: move compat_ioctl handling to devio.c
  hamradio/mkiss: fix typo in compat_ioctl
  compat_ioctl: remove unused handlers

 arch/um/drivers/line.c          |    6 +
 arch/um/drivers/ssl.c           |    1 +
 arch/um/drivers/stdio_console.c |    1 +
 arch/um/include/shared/line.h   |    2 +
 drivers/block/nbd.c             |    7 +-
 drivers/char/lp.c               |  115 +++++++--
 drivers/char/raw.c              |  157 ++++++++++---
 drivers/i2c/i2c-dev.c           |  117 +++++++++
 drivers/md/md.c                 |   23 ++
 drivers/net/hamradio/mkiss.c    |    2 +-
 drivers/scsi/sg.c               |  182 ++++++++++++++-
 drivers/usb/core/devio.c        |  110 ++++++++-
 fs/autofs/root.c                |   67 +++++-
 fs/autofs4/root.c               |   69 +++++-
 fs/compat_ioctl.c               |  504 +--------------------------------------
 fs/smbfs/dir.c                  |    5 +-
 fs/smbfs/file.c                 |    3 +-
 fs/smbfs/ioctl.c                |   48 ++++-
 fs/smbfs/proto.h                |    3 +-
 include/linux/auto_fs.h         |    1 +
 include/linux/usbdevice_fs.h    |   26 ++
 kernel/trace/blktrace.c         |    1 +
 22 files changed, 856 insertions(+), 594 deletions(-)

[1] http://patchwork.kernel.org/bundle/arnd/compat-ioctl-cleanup/?state=*

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 07/12] i2cdev: move compat_ioctl handling into driver
  2009-11-16  0:26 [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Arnd Bergmann
@ 2009-11-16  0:27 ` Arnd Bergmann
       [not found]   ` <1258331227-1694-8-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
  2009-11-16  0:57 ` [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Neil Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2009-11-16  0:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms), Wolfram Sang, linux-i2c

Doing all the compat_ioctl handling in the i2c driver itself
removes special cases from fs/compat_ioctl.c and makes it possible
to optimize this case better.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-i2c@vger.kernel.org
---
 drivers/i2c/i2c-dev.c |  117 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/compat_ioctl.c     |  119 -------------------------------------------------
 2 files changed, 117 insertions(+), 119 deletions(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 7e13d2d..fde0c9e 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -35,6 +35,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
 #include <linux/smp_lock.h>
+#include <linux/compat.h>
 #include <linux/jiffies.h>
 #include <asm/uaccess.h>
 
@@ -439,6 +440,119 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	return 0;
 }
 
+#ifdef CONFIG_COMPAT
+struct i2c_msg32 {
+	u16 addr;
+	u16 flags;
+	u16 len;
+	compat_caddr_t buf;
+};
+
+struct i2c_rdwr_ioctl_data32 {
+	compat_caddr_t msgs; /* struct i2c_msg __user *msgs */
+	u32 nmsgs;
+};
+
+struct i2c_smbus_ioctl_data32 {
+	u8 read_write;
+	u8 command;
+	u32 size;
+	compat_caddr_t data; /* union i2c_smbus_data *data */
+};
+
+struct i2c_rdwr_aligned {
+	struct i2c_rdwr_ioctl_data cmd;
+	struct i2c_msg msgs[0];
+};
+
+static int compat_i2c_rdwr_ioctl(struct file *filp, unsigned int cmd,
+			struct i2c_rdwr_ioctl_data32    __user *udata)
+{
+	struct i2c_rdwr_aligned		__user *tdata;
+	struct i2c_msg			__user *tmsgs;
+	struct i2c_msg32		__user *umsgs;
+	compat_caddr_t			datap;
+	int				nmsgs, i;
+
+	if (get_user(nmsgs, &udata->nmsgs))
+		return -EFAULT;
+	if (nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
+		return -EINVAL;
+
+	if (get_user(datap, &udata->msgs))
+		return -EFAULT;
+	umsgs = compat_ptr(datap);
+
+	tdata = compat_alloc_user_space(sizeof(*tdata) +
+				      nmsgs * sizeof(struct i2c_msg));
+	tmsgs = &tdata->msgs[0];
+
+	if (put_user(nmsgs, &tdata->cmd.nmsgs) ||
+	    put_user(tmsgs, &tdata->cmd.msgs))
+		return -EFAULT;
+
+	for (i = 0; i < nmsgs; i++) {
+		if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16)))
+			return -EFAULT;
+		if (get_user(datap, &umsgs[i].buf) ||
+		    put_user(compat_ptr(datap), &tmsgs[i].buf))
+			return -EFAULT;
+	}
+	return i2cdev_ioctl(filp, cmd, (unsigned long)tdata);
+}
+
+static int compat_i2c_smbus_ioctl(struct file *filp, unsigned int cmd,
+			struct i2c_smbus_ioctl_data32   __user *udata)
+{
+	struct i2c_smbus_ioctl_data	__user *tdata;
+	compat_caddr_t			datap;
+
+	tdata = compat_alloc_user_space(sizeof(*tdata));
+	if (tdata == NULL)
+		return -ENOMEM;
+	if (!access_ok(VERIFY_WRITE, tdata, sizeof(*tdata)))
+		return -EFAULT;
+
+	if (!access_ok(VERIFY_READ, udata, sizeof(*udata)))
+		return -EFAULT;
+
+	if (__copy_in_user(&tdata->read_write, &udata->read_write, 2 * sizeof(u8)))
+		return -EFAULT;
+	if (__copy_in_user(&tdata->size, &udata->size, 2 * sizeof(u32)))
+		return -EFAULT;
+	if (__get_user(datap, &udata->data) ||
+	    __put_user(compat_ptr(datap), &tdata->data))
+		return -EFAULT;
+
+	return i2cdev_ioctl(filp, cmd, (unsigned long)tdata);
+}
+
+static int compat_i2c_funcs(struct file *filp, unsigned int cmd,
+			compat_ulong_t __user *argp)
+{
+	struct i2c_client *client = filp->private_data;
+	compat_ulong_t funcs;
+	funcs = i2c_get_functionality(client->adapter);
+	return put_user(funcs, argp);
+}
+
+static long i2cdev_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+	void __user *argp = compat_ptr(arg);
+
+	switch (cmd) {
+	case I2C_FUNCS:
+		return compat_i2c_funcs(filp, cmd, argp);
+	case I2C_RDWR:
+		return compat_i2c_rdwr_ioctl(filp, cmd, argp);
+	case I2C_SMBUS:
+		return compat_i2c_smbus_ioctl(filp, cmd, argp);
+	}
+
+	return i2cdev_ioctl(filp, cmd, arg);
+}
+#endif /* CONFIG_COMPAT */
+
 static int i2cdev_open(struct inode *inode, struct file *file)
 {
 	unsigned int minor = iminor(inode);
@@ -501,6 +615,9 @@ static const struct file_operations i2cdev_fops = {
 	.read		= i2cdev_read,
 	.write		= i2cdev_write,
 	.unlocked_ioctl	= i2cdev_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl	= i2cdev_compat_ioctl,
+#endif
 	.open		= i2cdev_open,
 	.release	= i2cdev_release,
 };
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index a762fb1..b419459 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -117,21 +117,6 @@
 #include <asm/fbio.h>
 #endif
 
-static int w_long(unsigned int fd, unsigned int cmd,
-		compat_ulong_t __user *argp)
-{
-	mm_segment_t old_fs = get_fs();
-	int err;
-	unsigned long val;
-
-	set_fs (KERNEL_DS);
-	err = sys_ioctl(fd, cmd, (unsigned long)&val);
-	set_fs (old_fs);
-	if (!err && put_user(val, argp))
-		return -EFAULT;
-	return err;
-}
-
 struct compat_video_event {
 	int32_t		type;
 	compat_time_t	timestamp;
@@ -691,96 +676,6 @@ static int do_usbdevfs_discsignal(unsigned int fd, unsigned int cmd,
         return err;
 }
 
-/*
- * I2C layer ioctls
- */
-
-struct i2c_msg32 {
-	u16 addr;
-	u16 flags;
-	u16 len;
-	compat_caddr_t buf;
-};
-
-struct i2c_rdwr_ioctl_data32 {
-	compat_caddr_t msgs; /* struct i2c_msg __user *msgs */
-	u32 nmsgs;
-};
-
-struct i2c_smbus_ioctl_data32 {
-	u8 read_write;
-	u8 command;
-	u32 size;
-	compat_caddr_t data; /* union i2c_smbus_data *data */
-};
-
-struct i2c_rdwr_aligned {
-	struct i2c_rdwr_ioctl_data cmd;
-	struct i2c_msg msgs[0];
-};
-
-static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd,
-			struct i2c_rdwr_ioctl_data32    __user *udata)
-{
-	struct i2c_rdwr_aligned		__user *tdata;
-	struct i2c_msg			__user *tmsgs;
-	struct i2c_msg32		__user *umsgs;
-	compat_caddr_t			datap;
-	int				nmsgs, i;
-
-	if (get_user(nmsgs, &udata->nmsgs))
-		return -EFAULT;
-	if (nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
-		return -EINVAL;
-
-	if (get_user(datap, &udata->msgs))
-		return -EFAULT;
-	umsgs = compat_ptr(datap);
-
-	tdata = compat_alloc_user_space(sizeof(*tdata) +
-				      nmsgs * sizeof(struct i2c_msg));
-	tmsgs = &tdata->msgs[0];
-
-	if (put_user(nmsgs, &tdata->cmd.nmsgs) ||
-	    put_user(tmsgs, &tdata->cmd.msgs))
-		return -EFAULT;
-
-	for (i = 0; i < nmsgs; i++) {
-		if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16)))
-			return -EFAULT;
-		if (get_user(datap, &umsgs[i].buf) ||
-		    put_user(compat_ptr(datap), &tmsgs[i].buf))
-			return -EFAULT;
-	}
-	return sys_ioctl(fd, cmd, (unsigned long)tdata);
-}
-
-static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd,
-			struct i2c_smbus_ioctl_data32   __user *udata)
-{
-	struct i2c_smbus_ioctl_data	__user *tdata;
-	compat_caddr_t			datap;
-
-	tdata = compat_alloc_user_space(sizeof(*tdata));
-	if (tdata == NULL)
-		return -ENOMEM;
-	if (!access_ok(VERIFY_WRITE, tdata, sizeof(*tdata)))
-		return -EFAULT;
-
-	if (!access_ok(VERIFY_READ, udata, sizeof(*udata)))
-		return -EFAULT;
-
-	if (__copy_in_user(&tdata->read_write, &udata->read_write, 2 * sizeof(u8)))
-		return -EFAULT;
-	if (__copy_in_user(&tdata->size, &udata->size, 2 * sizeof(u32)))
-		return -EFAULT;
-	if (__get_user(datap, &udata->data) ||
-	    __put_user(compat_ptr(datap), &tdata->data))
-		return -EFAULT;
-
-	return sys_ioctl(fd, cmd, (unsigned long)tdata);
-}
-
 #define RTC_IRQP_READ32		_IOR('p', 0x0b, compat_ulong_t)
 #define RTC_IRQP_SET32		_IOW('p', 0x0c, compat_ulong_t)
 #define RTC_EPOCH_READ32	_IOR('p', 0x0d, compat_ulong_t)
@@ -1341,13 +1236,6 @@ COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32)
 COMPATIBLE_IOCTL(USBDEVFS_REAPURB32)
 COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32)
 COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT)
-/* i2c */
-COMPATIBLE_IOCTL(I2C_SLAVE)
-COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
-COMPATIBLE_IOCTL(I2C_TENBIT)
-COMPATIBLE_IOCTL(I2C_PEC)
-COMPATIBLE_IOCTL(I2C_RETRIES)
-COMPATIBLE_IOCTL(I2C_TIMEOUT)
 /* hiddev */
 COMPATIBLE_IOCTL(HIDIOCGVERSION)
 COMPATIBLE_IOCTL(HIDIOCAPPLICATION)
@@ -1533,13 +1421,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd,
 		return do_usbdevfs_bulk(fd, cmd, argp);
 	case USBDEVFS_DISCSIGNAL32:
 		return do_usbdevfs_discsignal(fd, cmd, argp);
-	/* i2c */
-	case I2C_FUNCS:
-		return w_long(fd, cmd, argp);
-	case I2C_RDWR:
-		return do_i2c_rdwr_ioctl(fd, cmd, argp);
-	case I2C_SMBUS:
-		return do_i2c_smbus_ioctl(fd, cmd, argp);
 	/* Not implemented in the native kernel */
 	case RTC_IRQP_READ32:
 	case RTC_IRQP_SET32:
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers
  2009-11-16  0:26 [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Arnd Bergmann
  2009-11-16  0:27 ` [PATCH 07/12] i2cdev: move compat_ioctl handling into driver Arnd Bergmann
@ 2009-11-16  0:57 ` Neil Brown
  2009-11-16  1:02   ` Arnd Bergmann
  1 sibling, 1 reply; 7+ messages in thread
From: Neil Brown @ 2009-11-16  0:57 UTC (permalink / raw)
  Cc: linux-usb, user-mode-linux-user, H. Peter Anvin, Paul Clements,
	Wolfram Sang, Andre Noll, Pavel Machek, linux-i2c, Jens Axboe,
	Jan Blunck, Ian Kent, Nick Piggin, user-mode-linux-devel,
	linux-scsi, Kay Sievers, Alon Bar-Lev, Alan Stern,
	KOSAKI Motohiro, Doug Gilbert, David Vrabel, Alexey Dobriyan,
	Arnd Bergmann, Jeff Dike, Oliver Neukum, linux-raid

On Mon, 16 Nov 2009 00:26:55 +0000
Arnd Bergmann <arnd@arndb.de> wrote:

> This is the second series of patches on compat_ioctl handling,
> moving compat handlers into more drivers. Most of these
> patches consist on a part that adds a compat_ioctl method
> in one driver and another part removing the respective
> section from fs/compat_ioctl.c. The fs/compat_ioctl.c
> portion depends on other patches[1], but the driver code can
> be applied independently.
> 
> If some of you feel responsible for the code I patched, please
> look at my changes and if they are ok, either take them into
> your tree or give me an Acked-by for them.

I would take the md ones into my tree, but I suspect that if
everyone did that we would end up with lots of conflicts in
fs/compat_ioctl.c.

So how about I just take the changes to md.c, and give you an:

   Acked-by: NeilBrown <neilb@suse.de>

for the changes to fs/compat_ioctl.c
??

NeilBrown

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers
  2009-11-16  0:57 ` [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Neil Brown
@ 2009-11-16  1:02   ` Arnd Bergmann
  0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2009-11-16  1:02 UTC (permalink / raw)
  To: Neil Brown
  Cc: linux-usb, user-mode-linux-user, H. Peter Anvin, Paul Clements,
	Wolfram Sang, Andre Noll, Pavel Machek, linux-i2c, Jens Axboe,
	Jan Blunck, Ian Kent, Nick Piggin, linux-scsi, Kay Sievers,
	Alon Bar-Lev, Alan Stern, KOSAKI Motohiro, Doug Gilbert,
	David Vrabel, Alexey Dobriyan, user-mode-linux-devel, Jeff Dike,
	Oliver Neukum, linux-raid, Tejun Heo

On Monday 16 November 2009, Neil Brown wrote:
> I would take the md ones into my tree, but I suspect that if
> everyone did that we would end up with lots of conflicts in
> fs/compat_ioctl.c.
> 
> So how about I just take the changes to md.c, and give you an:
> 
>    Acked-by: NeilBrown <neilb@suse.de>
> 
> for the changes to fs/compat_ioctl.c
> ??

Yes, that is exactly what I was trying to suggest. Thanks,

	Arnd <><

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 07/12] i2cdev: move compat_ioctl handling into driver
       [not found]   ` <1258331227-1694-8-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
@ 2009-12-14 14:23     ` Jean Delvare
       [not found]       ` <20091214152307.5ba3ea4d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Delvare @ 2009-12-14 14:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Ben Dooks (embedded platforms), Wolfram Sang,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Arnd,

On Mon, 16 Nov 2009 00:27:02 +0000, Arnd Bergmann wrote:
> Doing all the compat_ioctl handling in the i2c driver itself
> removes special cases from fs/compat_ioctl.c and makes it possible
> to optimize this case better.
> 
> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Cc: "Jean Delvare (PC drivers, core)" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: "Ben Dooks (embedded platforms)" <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  drivers/i2c/i2c-dev.c |  117 ++++++++++++++++++++++++++++++++++++++++++++++++
>  fs/compat_ioctl.c     |  119 -------------------------------------------------
>  2 files changed, 117 insertions(+), 119 deletions(-)

This patch no longer applies so I can't test it. I do not have any
objection about it though.

I'm also not sure what I am supposed to comment on. As far as I can
see, most of this patch is merely moving code from one file to another,
so there's little point in reviewing that code. Is there any part in
particular which needs my attention?

If you want to test your patch yourself, it is fairly easy using the
i2c-stub driver, which is a software-only i2c bus driver. Install the
i2c-tools package on your system, and then:

# modprobe i2c-stub chip_addr=0x6d
# modprobe i2c-dev
# i2cdetect -l
# i2cbus=$(i2cdetect -l | grep stub | cut -f1 | cut -d- -f2)
# i2cdetect -F $i2cbus
Functionalities implemented by /dev/i2c-x:
I2C                              no
SMBus Quick Command              yes
SMBus Send Byte                  yes
SMBus Receive Byte               yes
SMBus Write Byte                 yes
SMBus Read Byte                  yes
SMBus Write Word                 yes
SMBus Read Word                  yes
SMBus Process Call               no
SMBus Block Write                no
SMBus Block Read                 no
SMBus Block Process Call         no
SMBus PEC                        no
I2C Block Write                  no
I2C Block Read                   no
# i2cset -y $i2cbus 0x6d 0x00 0x42 b
Value 0x42 written, readback matched
# i2cget -y $i2cbus 0x6d 0x00 b
0x42
#

The last 3 commands will generate i2c-dev ioctls.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 07/12] i2cdev: move compat_ioctl handling into driver
       [not found]       ` <20091214152307.5ba3ea4d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2009-12-14 15:31         ` Arnd Bergmann
  2010-06-03 12:31           ` Jean Delvare
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2009-12-14 15:31 UTC (permalink / raw)
  To: Jean Delvare
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Ben Dooks (embedded platforms), Wolfram Sang,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Monday 14 December 2009, Jean Delvare wrote:
> This patch no longer applies so I can't test it. I do not have any
> objection about it though.

The patch is part of a longer series of patches moving code out
of fs/compat_ioctl.c. If you want to test it, you can just apply the
half adding it to i2c-dev.c and that version will be used.

That part has gained a trivial conflict against an #include cleanup.

> I'm also not sure what I am supposed to comment on. As far as I can
> see, most of this patch is merely moving code from one file to another,
> so there's little point in reviewing that code. Is there any part in
> particular which needs my attention?

No, nothing particular. I was just running the whole series by the
maintainers (or the closest approximation of that) in order to
collect Acked-by and/or have people include the patches in their
trees, especially the ones that I didn't have a test case for.
The patches I got an Ack for were merged now, and I'll repost
the rest after -rc1 to prepare them for the next merge window.

A good way to avoid conflicts would be if you take the i2c-dev.c
parts into a tree of yours and let me follow up with removing the
code from fs/compat_ioctl.c once your tree is merged.

If everyone does that, I can just remove half of fs/compat_ioctl.c
at once.

> If you want to test your patch yourself, it is fairly easy using the
> i2c-stub driver, which is a software-only i2c bus driver. Install the
> i2c-tools package on your system, and then:
> 
> # modprobe i2c-stub chip_addr=0x6d
> # modprobe i2c-dev
> # i2cdetect -l
> # i2cbus=$(i2cdetect -l | grep stub | cut -f1 | cut -d- -f2)
> # i2cdetect -F $i2cbus
> Functionalities implemented by /dev/i2c-x:
> I2C                              no
> SMBus Quick Command              yes
> SMBus Send Byte                  yes
> SMBus Receive Byte               yes
> SMBus Write Byte                 yes
> SMBus Read Byte                  yes
> SMBus Write Word                 yes
> SMBus Read Word                  yes
> SMBus Process Call               no
> SMBus Block Write                no
> SMBus Block Read                 no
> SMBus Block Process Call         no
> SMBus PEC                        no
> I2C Block Write                  no
> I2C Block Read                   no
> # i2cset -y $i2cbus 0x6d 0x00 0x42 b
> Value 0x42 written, readback matched
> # i2cget -y $i2cbus 0x6d 0x00 b
> 0x42
> #
> 
> The last 3 commands will generate i2c-dev ioctls.

Ok, I'll try that, thanks!

	Arnd <><

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 07/12] i2cdev: move compat_ioctl handling into driver
  2009-12-14 15:31         ` Arnd Bergmann
@ 2010-06-03 12:31           ` Jean Delvare
  0 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2010-06-03 12:31 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, Ben Dooks (embedded platforms), Wolfram Sang,
	linux-i2c

Hi Arnd,

On Mon, 14 Dec 2009 16:31:45 +0100, Arnd Bergmann wrote:
> On Monday 14 December 2009, Jean Delvare wrote:
> > This patch no longer applies so I can't test it. I do not have any
> > objection about it though.
> 
> The patch is part of a longer series of patches moving code out
> of fs/compat_ioctl.c. If you want to test it, you can just apply the
> half adding it to i2c-dev.c and that version will be used.
> 
> That part has gained a trivial conflict against an #include cleanup.

It was long ago, there are even more conflicts now.

> > I'm also not sure what I am supposed to comment on. As far as I can
> > see, most of this patch is merely moving code from one file to another,
> > so there's little point in reviewing that code. Is there any part in
> > particular which needs my attention?
> 
> No, nothing particular. I was just running the whole series by the
> maintainers (or the closest approximation of that) in order to
> collect Acked-by and/or have people include the patches in their
> trees, especially the ones that I didn't have a test case for.
> The patches I got an Ack for were merged now, and I'll repost
> the rest after -rc1 to prepare them for the next merge window.
> 
> A good way to avoid conflicts would be if you take the i2c-dev.c
> parts into a tree of yours and let me follow up with removing the
> code from fs/compat_ioctl.c once your tree is merged.
> 
> If everyone does that, I can just remove half of fs/compat_ioctl.c
> at once.
> 
> > If you want to test your patch yourself, it is fairly easy using the
> > i2c-stub driver, which is a software-only i2c bus driver. Install the
> > i2c-tools package on your system, and then:
> > 
> > # modprobe i2c-stub chip_addr=0x6d
> > # modprobe i2c-dev
> > # i2cdetect -l
> > # i2cbus=$(i2cdetect -l | grep stub | cut -f1 | cut -d- -f2)
> > # i2cdetect -F $i2cbus
> > Functionalities implemented by /dev/i2c-x:
> > I2C                              no
> > SMBus Quick Command              yes
> > SMBus Send Byte                  yes
> > SMBus Receive Byte               yes
> > SMBus Write Byte                 yes
> > SMBus Read Byte                  yes
> > SMBus Write Word                 yes
> > SMBus Read Word                  yes
> > SMBus Process Call               no
> > SMBus Block Write                no
> > SMBus Block Read                 no
> > SMBus Block Process Call         no
> > SMBus PEC                        no
> > I2C Block Write                  no
> > I2C Block Read                   no
> > # i2cset -y $i2cbus 0x6d 0x00 0x42 b
> > Value 0x42 written, readback matched
> > # i2cget -y $i2cbus 0x6d 0x00 b
> > 0x42
> > #
> > 
> > The last 3 commands will generate i2c-dev ioctls.
> 
> Ok, I'll try that, thanks!

Were you able to perform your tests? What's the status of your patch? I
can't do much without a patch which at least applies and builds.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-03 12:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16  0:26 [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Arnd Bergmann
2009-11-16  0:27 ` [PATCH 07/12] i2cdev: move compat_ioctl handling into driver Arnd Bergmann
     [not found]   ` <1258331227-1694-8-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2009-12-14 14:23     ` Jean Delvare
     [not found]       ` <20091214152307.5ba3ea4d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-12-14 15:31         ` Arnd Bergmann
2010-06-03 12:31           ` Jean Delvare
2009-11-16  0:57 ` [uml-user] [PATCH 00/12] move compat_ioctl handling into drivers Neil Brown
2009-11-16  1:02   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox