[v2,03/29] usb: usbtmc: Add ioctls to set/get usb timeout
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2018-07-21 06:20:21
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2018-07-21 06:20:21
On Wed, Jul 18, 2018 at 10:45:36AM +0200, Guido Kiener wrote:
+/*
+ * Set the usb timeout value
+ */
+static int usbtmc_ioctl_set_timeout(struct usbtmc_file_data *file_data,
+ void __user *arg)
+{
+ u32 timeout;
+
+ if (get_user(timeout, (__u32 __user *)arg))
+ return -EFAULT;
+
+ /* Note that timeout = 0 means
+ * MAX_SCHEDULE_TIMEOUT in usb_control_msg
+ */
+ if (timeout < USBTMC_MIN_TIMEOUT)
+ return -EINVAL;No max timeout limit? That feels odd, but ok, it's your api, you might be waiting a long time :) thanks, greg k-h --- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html