Re: [PATCH v6 5/5] usb: gadget: add trace event of configfs write attributes operation

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

 



On Thu, Apr 07, 2022 at 09:27:45AM +0800, Linyu Yuan wrote:
> Add API trace_usb_configfs_write_attr() to trace user change gadget or
> function attributes.

Why?  Again, userspace is doing this already, why do we need to trace
what it is doing back to userspace again?

> Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
> ---
> v2: no change
> v3: add API in trace.c
> v4: fix memory leak
> v5: no change
> v6: fix checkpatch warning
> 
>  drivers/usb/gadget/configfs.c                  | 24 ++++++++++++++++++++++++
>  drivers/usb/gadget/function/f_acm.c            |  1 +
>  drivers/usb/gadget/function/f_hid.c            |  4 ++++
>  drivers/usb/gadget/function/f_loopback.c       |  4 ++++
>  drivers/usb/gadget/function/f_mass_storage.c   | 16 ++++++++++++++++
>  drivers/usb/gadget/function/f_midi.c           |  6 ++++++
>  drivers/usb/gadget/function/f_printer.c        |  4 ++++
>  drivers/usb/gadget/function/f_serial.c         |  1 +
>  drivers/usb/gadget/function/f_sourcesink.c     | 16 ++++++++++++++++
>  drivers/usb/gadget/function/f_uac1.c           |  6 ++++++
>  drivers/usb/gadget/function/f_uac1_legacy.c    |  4 ++++
>  drivers/usb/gadget/function/f_uac2.c           |  8 ++++++++
>  drivers/usb/gadget/function/u_ether_configfs.h | 10 ++++++++++
>  drivers/usb/gadget/function/uvc_configfs.c     | 18 ++++++++++++++++++
>  drivers/usb/gadget/trace.c                     | 26 ++++++++++++++++++++++++++
>  include/linux/usb/composite.h                  |  3 +++
>  include/linux/usb/gadget_configfs.h            |  2 ++
>  17 files changed, 153 insertions(+)
> 
> diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
> index a304d29..a9ea331 100644
> --- a/drivers/usb/gadget/configfs.c
> +++ b/drivers/usb/gadget/configfs.c
> @@ -146,6 +146,8 @@ static ssize_t gadget_dev_desc_##_name##_store(struct config_item *item, \
>  {							\
>  	u8 val;						\
>  	int ret;					\
> +							\
> +	trace_usb_configfs_write_attr(item, #_name, page);	\
>  	ret = kstrtou8(page, 0, &val);			\
>  	if (ret)					\
>  		return ret;				\
> @@ -159,6 +161,8 @@ static ssize_t gadget_dev_desc_##_name##_store(struct config_item *item, \
>  {							\
>  	u16 val;					\
>  	int ret;					\
> +							\
> +	trace_usb_configfs_write_attr(item, #_name, page);	\
>  	ret = kstrtou16(page, 0, &val);			\
>  	if (ret)					\
>  		return ret;				\
> @@ -198,6 +202,8 @@ static ssize_t gadget_dev_desc_bcdDevice_store(struct config_item *item,
>  	u16 bcdDevice;
>  	int ret;
>  
> +	trace_usb_configfs_write_attr(item, "bcdDevice", page);

Where did "bcdDevice" come from?  Shouldn't this all just come from
configfs instead of having to add it to each individual function?

And again, why?

thanks,

greg k-h



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

  Powered by Linux