All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: AKASH KUMAR <quic_akakum@quicinc.com>
Cc: "Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
	"Jing Leng" <jleng@ambarella.com>,
	"Pratham Pratap " <quic_ppratap@quicinc.com>,
	"Jack Pham" <quic_jackp@quicinc.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_uac2: uevent changes for uac2
Date: Mon, 8 May 2023 14:14:18 +0200	[thread overview]
Message-ID: <2023050801-handshake-refusing-0367@gregkh> (raw)
In-Reply-To: <20230508120535.31472-1-quic_akakum@quicinc.com>

On Mon, May 08, 2023 at 05:35:35PM +0530, AKASH KUMAR wrote:
> Adding uvent from usb audio gadget driver for

What is a "uvent"?

> uac2 playback/capture events, which userspace reads
> and later reads sysfs entry to know if playback
> or capture has stopped or started by host
> application.

Please use your full 72 columns please.

> 
> /config/usb_gadget/g1/functions/uac2.0 # cat c_status
> 1  --> capture started
> 0  --> capture stopped
> /config/usb_gadget/g1/functions/uac2.0 # cat p_status
> 1 --> playback started
> 0 --> playback stopped

You need to document these new files in Documentation/ABI/ right?

> 
> Signed-off-by: AKASH KUMAR <quic_akakum@quicinc.com>

No need to UPPER CASE your name :)

> ---
>  drivers/usb/gadget/function/f_uac2.c | 57 ++++++++++++++++++++++++++++
>  drivers/usb/gadget/function/u_uac2.h |  7 ++++
>  2 files changed, 64 insertions(+)
> 
> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
> index 0219cd79493a..d0a5fa6b49b8 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -1423,6 +1423,8 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
>  	struct usb_gadget *gadget = cdev->gadget;
>  	struct device *dev = &gadget->dev;
>  	int ret = 0;
> +	struct f_uac2_opts *audio_opts =
> +		container_of(fn->fi, struct f_uac2_opts, func_inst);
>  
>  	/* No i/f has more than 2 alt settings */
>  	if (alt > 1) {
> @@ -1454,6 +1456,7 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
>  			ret = u_audio_start_capture(&uac2->g_audio);
>  		else
>  			u_audio_stop_capture(&uac2->g_audio);
> +		audio_opts->c_status = alt;
>  	} else if (intf == uac2->as_in_intf) {
>  		uac2->as_in_alt = alt;
>  
> @@ -1461,10 +1464,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
>  			ret = u_audio_start_playback(&uac2->g_audio);
>  		else
>  			u_audio_stop_playback(&uac2->g_audio);
> +		audio_opts->p_status = alt;
>  	} else {
>  		dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
>  		return -EINVAL;
>  	}
> +#ifdef CONFIG_USB_CONFIGFS_UEVENT
> +	schedule_work(&audio_opts->work);
> +#endif

Why the #ifdef?  Please never do that in .c files if at all possible.

>  
>  	return ret;
>  }
> @@ -1493,9 +1500,17 @@ static void
>  afunc_disable(struct usb_function *fn)
>  {
>  	struct f_uac2 *uac2 = func_to_uac2(fn);
> +	struct f_uac2_opts *audio_opts =
> +		container_of(fn->fi, struct f_uac2_opts, func_inst);
>  
>  	uac2->as_in_alt = 0;
>  	uac2->as_out_alt = 0;
> +	audio_opts->p_status = 0;//alt;
> +	audio_opts->c_status = 0; //alt;
> +
> +#ifdef CONFIG_USB_CONFIGFS_UEVENT
> +	schedule_work(&audio_opts->work);
> +#endif

Same here and elsewhere in this patch.

thanks,

greg k-h

  reply	other threads:[~2023-05-08 12:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 12:05 [PATCH] usb: gadget: f_uac2: uevent changes for uac2 AKASH KUMAR
2023-05-08 12:14 ` Greg Kroah-Hartman [this message]
2023-05-08 15:16   ` AKASH KUMAR

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2023050801-handshake-refusing-0367@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=jleng@ambarella.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_akakum@quicinc.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_ppratap@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.