linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usb: gadget: f_fs: Add compat_ioctl to ep0
@ 2018-04-09 18:20 Jerry Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Jerry Zhang @ 2018-04-09 18:20 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Michal Nazarewicz
  Cc: linux-usb, Jerry Zhang

Functionfs ep0 ioctls can be handled in the
same way as a normal ioctl. Underlying gadget
ioctls are passed to the underlying gadget's
compat_ioctl.

Signed-off-by: Jerry Zhang <zhangjerry@google.com>
---
 drivers/usb/gadget/function/f_fs.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 34d80cc2b667..ef349bdde001 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -641,6 +641,23 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
 	return ret;
 }
 
+#ifdef CONFIG_COMPAT
+static long ffs_ep0_compat_ioctl(struct file *file, unsigned code, unsigned long value)
+{
+	long ret;
+
+	if (code == FUNCTIONFS_INTERFACE_REVMAP) {
+		ret = ffs_ep0_ioctl(file, code, value);
+	} else if (gadget && gadget->ops->compat_ioctl) {
+		ret = gadget->ops->compat_ioctl(gadget, code, value);
+	} else {
+		ret = -ENOTTY;
+	}
+
+	return ret;
+}
+#endif
+
 static __poll_t ffs_ep0_poll(struct file *file, poll_table *wait)
 {
 	struct ffs_data *ffs = file->private_data;
@@ -691,6 +708,9 @@ static const struct file_operations ffs_ep0_operations = {
 	.release =	ffs_ep0_release,
 	.unlocked_ioctl =	ffs_ep0_ioctl,
 	.poll =		ffs_ep0_poll,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = ffs_ep0_compat_ioctl,
+#endif
 };
 
 

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

* usb: gadget: f_fs: Add compat_ioctl to ep0
@ 2018-04-10  1:11 kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-04-10  1:11 UTC (permalink / raw)
  To: Jerry Zhang
  Cc: kbuild-all, Felipe Balbi, Greg Kroah-Hartman, Michal Nazarewicz,
	linux-usb

Hi Jerry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on balbi-usb/next]
[also build test ERROR on v4.16 next-20180409]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jerry-Zhang/usb-gadget-f_fs-Add-compat_ioctl-to-ep0/20180410-060430
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: x86_64-randconfig-s3-04100757 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_fs.c: In function 'ffs_ep0_compat_ioctl':
>> drivers/usb/gadget/function/f_fs.c:651:13: error: 'gadget' undeclared (first use in this function); did you mean 'dget'?
     } else if (gadget && gadget->ops->compat_ioctl) {
                ^~~~~~
                dget
   drivers/usb/gadget/function/f_fs.c:651:13: note: each undeclared identifier is reported only once for each function it appears in

vim +651 drivers/usb/gadget/function/f_fs.c

   643	
   644	#ifdef CONFIG_COMPAT
   645	static long ffs_ep0_compat_ioctl(struct file *file, unsigned code, unsigned long value)
   646	{
   647		long ret;
   648	
   649		if (code == FUNCTIONFS_INTERFACE_REVMAP) {
   650			ret = ffs_ep0_ioctl(file, code, value);
 > 651		} else if (gadget && gadget->ops->compat_ioctl) {
   652			ret = gadget->ops->compat_ioctl(gadget, code, value);
   653		} else {
   654			ret = -ENOTTY;
   655		}
   656	
   657		return ret;
   658	}
   659	#endif
   660
---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

* usb: gadget: f_fs: Add compat_ioctl to ep0
@ 2018-04-10  1:56 kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-04-10  1:56 UTC (permalink / raw)
  To: Jerry Zhang
  Cc: kbuild-all, Felipe Balbi, Greg Kroah-Hartman, Michal Nazarewicz,
	linux-usb

Hi Jerry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on balbi-usb/next]
[also build test ERROR on v4.16 next-20180409]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jerry-Zhang/usb-gadget-f_fs-Add-compat_ioctl-to-ep0/20180410-060430
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: x86_64-randconfig-x017-201814 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_fs.c: In function 'ffs_ep0_compat_ioctl':
>> drivers/usb/gadget/function/f_fs.c:651:13: error: 'gadget' undeclared (first use in this function); did you mean 'bdget'?
     } else if (gadget && gadget->ops->compat_ioctl) {
                ^~~~~~
                bdget
   drivers/usb/gadget/function/f_fs.c:651:13: note: each undeclared identifier is reported only once for each function it appears in

vim +651 drivers/usb/gadget/function/f_fs.c

   643	
   644	#ifdef CONFIG_COMPAT
   645	static long ffs_ep0_compat_ioctl(struct file *file, unsigned code, unsigned long value)
   646	{
   647		long ret;
   648	
   649		if (code == FUNCTIONFS_INTERFACE_REVMAP) {
   650			ret = ffs_ep0_ioctl(file, code, value);
 > 651		} else if (gadget && gadget->ops->compat_ioctl) {
   652			ret = gadget->ops->compat_ioctl(gadget, code, value);
   653		} else {
   654			ret = -ENOTTY;
   655		}
   656	
   657		return ret;
   658	}
   659	#endif
   660
---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

end of thread, other threads:[~2018-04-10  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-09 18:20 usb: gadget: f_fs: Add compat_ioctl to ep0 Jerry Zhang
  -- strict thread matches above, loose matches on Subject: below --
2018-04-10  1:11 kbuild test robot
2018-04-10  1:56 kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).