All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2] usb: gadget: f_fs: Add compat_ioctl to ep0
@ 2018-04-10  1:38 Jerry Zhang
  0 siblings, 0 replies; only message in thread
From: Jerry Zhang @ 2018-04-10  1:38 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. Don't handle
underlying gadget ioctls since we don't know
whether they work with compat.

Signed-off-by: Jerry Zhang <zhangjerry@google.com>
---
 v2 - fixed error, realized gadget_ops doesn't have compat_ioctl

 drivers/usb/gadget/function/f_fs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 34d80cc2b667..8c6ed79f451d 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -641,6 +641,21 @@ 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 {
+		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 +706,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] only message in thread

only message in thread, other threads:[~2018-04-10  1:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10  1:38 [v2] usb: gadget: f_fs: Add compat_ioctl to ep0 Jerry Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.