Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4261238rwr; Mon, 8 May 2023 05:29:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Lh9e1RPFuN7IIYdN5xlJmDhZaEYEgQnHXNV96gQ8XrdmdGY5Yzh8GBFvpw+iqxJ3ALncV X-Received: by 2002:a17:902:d2d1:b0:1a5:2377:c7e7 with SMTP id n17-20020a170902d2d100b001a52377c7e7mr12938904plc.44.1683548977172; Mon, 08 May 2023 05:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683548977; cv=none; d=google.com; s=arc-20160816; b=pyMMikwYkre7YVwhEKcZ1H8hI2BtHDfmMJjWrE+5wP5+sscFbFfZ2XfgQrkvHpHxpP d8hfrpZ0jHSNbNN416VazkLtwqNWPz8bT4Zu1qNTwO3TpYr7n340VLK5FfZcefW3Z/q9 NfOH/6JPobaW1c4A68dWKSQIjO8RuwAvqby9Q5X7fAtn5BNced8b6HjgR/sLwerEXUth tfne857eKLdyvNH3HAqeRyhsw1bPHXsHDr+CKg0JA4gBfzy3AUCq9ztw2GXLsm/zD1kT Fku40iQXkVkEEnQPuWgsfhPzehXhwLgAwnkjgYfuHcliEvo42GNMBPD11mY4fr3m5W3P Zk6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9wUGsCMzcqM/Ysd0s5GXesnPBpj0zrC9mtVjh/fVizI=; b=RLZW606SraMdBggj5zi5FLyTK9ILz21/ZsW/U72qYLlxSDk2FrqxhmJtbdc2NMhbIC U2tyLoFJyTgGOtRgOkH2WYl5Iu0p265Gy8ycQRssGfH2wWz9fR038p1oe7jmrffcBdgk WDTQZsfo4tOoW6/lME6a5k4SFcNW0tGgzKpRUIv+EPDl+o9kPnKv7ME1mwjHuzGcYQ59 fdYA9No93heTPZ7BAyAajKFyDaN+r0wdbVKrRF36qVwrkm8lsCKWpW4rU/fgUmyDqVKa vPVK7BE7hB2MqXB132BoiDNvlWEmizb2T5XXxpVh2LKe/ZaBuvTpeouOCXQRuaDGLEr+ vyuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SuLyFmnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a170902900900b001aafc97feb0si7723611plp.174.2023.05.08.05.29.22; Mon, 08 May 2023 05:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SuLyFmnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233758AbjEHMOZ (ORCPT + 99 others); Mon, 8 May 2023 08:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232700AbjEHMOX (ORCPT ); Mon, 8 May 2023 08:14:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E502037C4C; Mon, 8 May 2023 05:14:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A4C8615DB; Mon, 8 May 2023 12:14:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6775DC433D2; Mon, 8 May 2023 12:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683548061; bh=s0zYPiwZHS3OcIOtGvMLCWYR3x28j1/vGt0bpuO02PQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SuLyFmnRPQ8HSTYXu5AEsp6Wn/XI0ma1kVo03Q2oUu5rViW7vpjzFgMROC6KfpkWx xpmMeiH6AoSvPF9m3iMbvxaIBcIRZdluEruwSt7zYdONg8UeKo2FMGPIZD99W+CDWT StIYIPqp9Q+Z4iFKaEG4J8lxlI7rNvBx8N2paQl0= Date: Mon, 8 May 2023 14:14:18 +0200 From: Greg Kroah-Hartman To: AKASH KUMAR Cc: Thinh Nguyen , Jing Leng , Pratham =?iso-8859-1?Q?Pratap=A0?= , Jack Pham , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: gadget: f_uac2: uevent changes for uac2 Message-ID: <2023050801-handshake-refusing-0367@gregkh> References: <20230508120535.31472-1-quic_akakum@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230508120535.31472-1-quic_akakum@quicinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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