Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1135581rdh; Fri, 27 Oct 2023 05:57:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVOADPc7nT6WHcRso+YtSTTWCT24swiMWow1C/uotr6TWBzmzcAn11y+FLGKj6/qHYekZq X-Received: by 2002:a05:6102:208c:b0:457:dac4:2af8 with SMTP id h12-20020a056102208c00b00457dac42af8mr2606872vsr.2.1698411473202; Fri, 27 Oct 2023 05:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698411473; cv=none; d=google.com; s=arc-20160816; b=OuqZXuGtJK8imALw7W4cmJo2vWGyuBiaTHx4Ef10cyJkDVPHJCjuF/mh5m/rsmw0Xw HAvrrgCNsL5yzTmmE1b7fiZhQXKnyRdpzL6TGzEUf4CSOR0geSyWLPpFqVr+vJhE+ShY 1FIz09r6t4MV1iFEMIbnup2AnThqKswc7S9dWgL/scRU1/ZAl4W4aZJ/En7duILSxAHE HyviSpXx7UoNm2YBGSsdBGS76reCl/PlKwfZEm7EdI4u4sq8L3bBBP7Ra7iIUbIANgXd hXNiC8dZWF5ARNLIzxr5egstDoBpRu6sywFe+NBnBFz6Oyoy7LZ187nZDft+cjQiGdSM kGbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=XungyqzZgTTsMwXK0eoduabGH8c+CtcoVh0X8JqAB/8=; fh=Sd/SyJZd88c6J86lzA9TIEP5jk+6v5bxaS8j/Lnla+k=; b=g+d/akxf0qwR0YTiLwAOM9IDToayStMv6yoWGkmINm1JCVlYrDOvYaJf1cqJpBaEqE k3bHu/im+uZAnttLuTplIl8lejPjlEntDTx89RhIheuzpMJnkHOA2WVlLeXK2FitQNCj dksVqKaAaSmMIR+okZsqOC81wKkuMeaWF1FARfnagOfCGnv5iOLvt2yXbv5fPArlIC8S iswvf4fQqL2oDwVFa+c/lB1NVnXsw9o6MhJz3FR1YZoks85iA52fRXDBKp2AcnBzdpyY hJMBE7B3dC9y3kssiI5sr8sNgAdGwhjLbFVJmbZPpmOwodwA56l6S/5z2jJvBznBkZcP jx5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=dPZFmJR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id e127-20020a251e85000000b00d7c7e32bc53si2051254ybe.641.2023.10.27.05.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 05:57:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=dPZFmJR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B986380BC809; Fri, 27 Oct 2023 05:57:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345658AbjJ0M5k (ORCPT + 99 others); Fri, 27 Oct 2023 08:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345839AbjJ0M5k (ORCPT ); Fri, 27 Oct 2023 08:57:40 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 095B3D40; Fri, 27 Oct 2023 05:57:37 -0700 (PDT) Received: from [192.168.0.43] (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AFFBB74A; Fri, 27 Oct 2023 14:57:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698411443; bh=8VrJNrWOa95xV2Iroh66gI/oAAPtNl5Fu9bL0m3Jo8o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dPZFmJR1cugE8JK3jycpJofPTHSnvh9ytyUDFCxFopqBebaDq+4hexzWiXyvJwEFW zySwarcyihwxcpDrkOIPpZ6Go5dp/L1l/JYbxilaZreg1xXEhwMZuvVGCrB2UnG5LN iL+yFTCyJj54RXtU3p/ULeFx3x8Yj/IM9kqXI0HY= Message-ID: <8532c020-013b-48a4-9a72-1a583ca945d1@ideasonboard.com> Date: Fri, 27 Oct 2023 13:57:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 3/4] usb: gadget: uvc: move video disable logic to its own function Content-Language: en-US To: Avichal Rakesh , gregkh@linuxfoundation.org, laurent.pinchart@ideasonboard.com Cc: etalvala@google.com, jchowdhary@google.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, m.grzeschik@pengutronix.de References: <20231019185319.2714000-1-arakesh@google.com> <20231024183605.908253-1-arakesh@google.com> <20231024183605.908253-3-arakesh@google.com> From: Dan Scally Autocrypt: addr=dan.scally@ideasonboard.com; keydata= xsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW B31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove eIjYvqurAaro91jrRVrS1gB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BQkFo5qAAhsMAAoJEJIkLofy/hjEXPcQAMIPNqiWiz/HKu9W4QIf1OMUpKn3YkVIj3p3gvfM Res4fGX94Ji599uLNrPoxKyaytC4R6BTxVriTJjWK8mbo9jZIRM4vkwkZZ2bu98EweSucxbp vjESsvMXGgxniqV/RQ/3T7LABYRoIUutARYq58p5HwSP0frF0fdFHYdTa2g7MYZl1ur2JzOC FHRpGadlNzKDE3fEdoMobxHB3Lm6FDml5GyBAA8+dQYVI0oDwJ3gpZPZ0J5Vx9RbqXe8RDuR du90hvCJkq7/tzSQ0GeD3BwXb9/R/A4dVXhaDd91Q1qQXidI+2jwhx8iqiYxbT+DoAUkQRQy xBtoCM1CxH7u45URUgD//fxYr3D4B1SlonA6vdaEdHZOGwECnDpTxecENMbz/Bx7qfrmd901 D+N9SjIwrbVhhSyUXYnSUb8F+9g2RDY42Sk7GcYxIeON4VzKqWM7hpkXZ47pkK0YodO+dRKM yMcoUWrTK0Uz6UzUGKoJVbxmSW/EJLEGoI5p3NWxWtScEVv8mO49gqQdrRIOheZycDmHnItt 9Qjv00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1 u1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC In-Reply-To: <20231024183605.908253-3-arakesh@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 27 Oct 2023 05:57:50 -0700 (PDT) Hi Avichal On 24/10/2023 19:36, Avichal Rakesh wrote: > This patch refactors the video disable logic in uvcg_video_enable > into its own separate function 'uvcg_video_disable'. In that case, can we just replace any calls to uvcg_video_enable(video, 0) with calls to uvcg_video_disable() directly and drop the enable argument from uvcg_video_enable()? > Suggested-by: Michael Grzeschik > Signed-off-by: Avichal Rakesh > --- > v6: Introduced this patch to make the next one easier to review > v6 -> v7: Add Suggested-by > v7 -> v8: No change. Getting back in review queue > > drivers/usb/gadget/function/uvc_video.c | 37 +++++++++++++++---------- > 1 file changed, 23 insertions(+), 14 deletions(-) > > diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c > index c180866c8e34..80b8eaea2d39 100644 > --- a/drivers/usb/gadget/function/uvc_video.c > +++ b/drivers/usb/gadget/function/uvc_video.c > @@ -493,13 +493,33 @@ static void uvcg_video_pump(struct work_struct *work) > return; > } > > +/* > + * Disable video stream > + */ > +static int > +uvcg_video_disable(struct uvc_video *video) > +{ > + struct uvc_request *ureq; > + > + cancel_work_sync(&video->pump); > + uvcg_queue_cancel(&video->queue, 0); > + > + list_for_each_entry(ureq, &video->ureqs, list) { > + if (ureq->req) > + usb_ep_dequeue(video->ep, ureq->req); > + } > + > + uvc_video_free_requests(video); > + uvcg_queue_enable(&video->queue, 0); > + return 0; > +} > + > /* > * Enable or disable the video stream. > */ > int uvcg_video_enable(struct uvc_video *video, int enable) > { > int ret; > - struct uvc_request *ureq; > > if (video->ep == NULL) { > uvcg_info(&video->uvc->func, > @@ -507,19 +527,8 @@ int uvcg_video_enable(struct uvc_video *video, int enable) > return -ENODEV; > } > > - if (!enable) { > - cancel_work_sync(&video->pump); > - uvcg_queue_cancel(&video->queue, 0); > - > - list_for_each_entry(ureq, &video->ureqs, list) { > - if (ureq->req) > - usb_ep_dequeue(video->ep, ureq->req); > - } > - > - uvc_video_free_requests(video); > - uvcg_queue_enable(&video->queue, 0); > - return 0; > - } > + if (!enable) > + return uvcg_video_disable(video); > > if ((ret = uvcg_queue_enable(&video->queue, 1)) < 0) > return ret; > -- > 2.42.0.758.gaed0368e0e-goog