Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp721823pxb; Thu, 21 Oct 2021 08:15:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRWDHHf0kqGzLBAWSLWWcwI9lZV/VrUqmrBMr18wS9jfV03Y/UliBFg2de7uS0CStRrlOt X-Received: by 2002:a17:90b:4a0f:: with SMTP id kk15mr7433536pjb.34.1634829356129; Thu, 21 Oct 2021 08:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634829356; cv=none; d=google.com; s=arc-20160816; b=pj4VHhkTd6CrFNgDrxQXMyzuh7LI/iLhvaAZAZO0gDB2MIyN+f5wg6gEeS0yRnKzCF ujN8ERdpZU+qOG1jQm6KuPHTFklIW+eSf4gLx8N9vuFOe83M7Gq6Lz9OPvr2YsfCgrxv tQL3X9LjpZFrtXnQZgVlH1pajpy7h72Q+EcaXjcBs7/m5RAdDTZnglFG89V74dZ7iSWw WdqJbCYRvCnZ+GPBoFhtKQ1Vy3JjKkK36TZFyyVxMTnj7l4ChaeM/h7dHkxn9BLd2Qgb 3dMS/arsjnvA2v7QRIz9AaQdLTD8aTXtrXjLdBSwNkXmjeWCl/H2CfcRAjbYhjr72PZi 7uWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=nx6J82iwLypVQbEB9okPevw4EBN3ww0zHtJfRXK3GQQ=; b=YQrdvQhjYWV6PI4Re2UkMNrEImwUlfYrb0rfa8RoW1K5OejnLCGQtuu7pmuBCE+8DU vAeHyXmmGbUA8jxVnierWtQSbkgDLMZUIuqO0Tj6mAevz9CTjqzBf8vcuM1a6yV1ldD/ HPKJfZoP0ERb/byJvzePPBw6/hvHCCGwh81/5z7iQV74NN8mTPk2E0Rbyp/RykFrMA7h wmtBsHuttEcQuI44TYLdm2KywEwAjfFN4YERhlqhYINacm3B7aakyh7IA0pP9N9zfVr2 TgGX6WWlWMkBpdtccIRA4XJ+2o1XaXScOnlnFXR8sO3jiMfKH19uCA0YH+32S0ouHoEO sgQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si8750164pgh.611.2021.10.21.08.15.43; Thu, 21 Oct 2021 08:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232186AbhJUPQQ (ORCPT + 99 others); Thu, 21 Oct 2021 11:16:16 -0400 Received: from netrider.rowland.org ([192.131.102.5]:47165 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S232249AbhJUPPo (ORCPT ); Thu, 21 Oct 2021 11:15:44 -0400 Received: (qmail 1161564 invoked by uid 1000); 21 Oct 2021 11:13:27 -0400 Date: Thu, 21 Oct 2021 11:13:27 -0400 From: Alan Stern To: Cai Huoqing Cc: Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: gadget: mass_storage: Make use of the helper macro kthread_run() Message-ID: <20211021151327.GA1161262@rowland.harvard.edu> References: <20211021084359.2607-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211021084359.2607-1-caihuoqing@baidu.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 04:43:58PM +0800, Cai Huoqing wrote: > Repalce kthread_create/wake_up_process() with kthread_run() > to simplify the code. > > Signed-off-by: Cai Huoqing > --- > drivers/usb/gadget/function/f_mass_storage.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c > index 3cabf7692ee1..1e3cab5d635c 100644 > --- a/drivers/usb/gadget/function/f_mass_storage.c > +++ b/drivers/usb/gadget/function/f_mass_storage.c > @@ -2962,7 +2962,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) > if (!common->thread_task) { > common->state = FSG_STATE_NORMAL; > common->thread_task = > - kthread_create(fsg_main_thread, common, "file-storage"); > + kthread_run(fsg_main_thread, common, "file-storage"); > if (IS_ERR(common->thread_task)) { > ret = PTR_ERR(common->thread_task); > common->thread_task = NULL; > @@ -2971,7 +2971,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) > } > DBG(common, "I/O thread pid: %d\n", > task_pid_nr(common->thread_task)); > - wake_up_process(common->thread_task); > } We better not apply this patch for the same reason as the other one: It's probably not a good idea for the fsg_main_thread task to start running before common->thread_task has been assigned. Alan Stern