[PATCH] usb: gadget: f_fs: Add compat_ioctl to ep0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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
 };
 
 
-- 
2.17.0.484.g0c8726318c-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux