Re: [PATCH v2 09/29] usb: usbtmc: Add ioctl for vendor specific write

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

 



On Wed, Jul 18, 2018 at 10:45:42AM +0200, Guido Kiener wrote:
> The new ioctl USBTMC_IOCTL_WRITE sends a generic message to bulk OUT.
> This ioctl is used for vendor specific or asynchronous I/O as well.
> 
> The message is split into chunks of 4k (page size).
> Message size is aligned to 32 bit boundaries.
> 
> With flag USBTMC_FLAG_ASYNC the ioctl is non blocking.
> With flag USBTMC_FLAG_APPEND additional urbs are queued and
> out_status/out_transfer_size is not reset. EPOLLOUT | EPOLLWRNORM
> is signaled when all submitted urbs are completed.
> 
> Flush flying urbs when file handle is closed or device is
> suspended or reset.
> 
> Signed-off-by: Guido Kiener <guido.kiener@xxxxxxxxxxxxxxxxx>
> Reviewed-by: Steve Bayless <steve_bayless@xxxxxxxxxxxx>
> ---
>  drivers/usb/class/usbtmc.c   | 416 ++++++++++++++++++++++++++++++++++-
>  include/uapi/linux/usb/tmc.h |  14 ++
>  2 files changed, 428 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
> index 846599dd0c84..c46280f53f39 100644
> --- a/drivers/usb/class/usbtmc.c
> +++ b/drivers/usb/class/usbtmc.c
> @@ -37,6 +37,8 @@
>  /* Default USB timeout (in milliseconds) */
>  #define USBTMC_TIMEOUT		5000
>  
> +/* Max number of urbs used in write transfers */
> +#define MAX_URBS_IN_FLIGHT	16
>  /* I/O buffer size used in generic read/write functions */
>  #define USBTMC_BUFSIZE		(4096)
>  
> @@ -125,9 +127,19 @@ struct usbtmc_file_data {
>  	u32            timeout;
>  	u8             srq_byte;
>  	atomic_t       srq_asserted;
> +
>  	u8             eom_val;
>  	u8             term_char;
>  	bool           term_char_enabled;
> +
> +	spinlock_t     err_lock; /* lock for errors */
> +
> +	struct usb_anchor submitted;
> +
> +	/* data for generic_write */
> +	struct semaphore limit_write_sem;
> +	u32 out_transfer_size;
> +	int out_status;
>  };
>  
>  #ifdef CONFIG_COMPAT
> @@ -137,12 +149,21 @@ struct compat_usbtmc_ctrlrequest {
>  	compat_uptr_t data;
>  } __packed;
>  
> +struct compat_usbtmc_message {
> +	__u32 transfer_size;
> +	__u32 transferred;
> +	__u32 flags;
> +	compat_uptr_t message;
> +} __packed;

Same here, no need for this at all.

I've stopped reviewing in the series here.  I've applied the first 6
patches in the series, please rework the remaining ones to not have any
compatibility ioctls needed and resend.  Or you can restructure what you
already have and resend everything without the new ioctls so I can
review/take them if you need more time to redo the ioctls stuff.

thanks,

greg k-h
--
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