Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp332570pxb; Thu, 26 Aug 2021 04:22:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1moKJdINacRkI0/eDaNrZ8q0wPz4XXHfx2CWg8Sl+KrlPXDnfJYkCGh3pzO4sdw/OE/FG X-Received: by 2002:a05:6402:1bd1:: with SMTP id ch17mr3653903edb.99.1629976960440; Thu, 26 Aug 2021 04:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629976960; cv=none; d=google.com; s=arc-20160816; b=V84UfxP2NgqoiNjlwLJLJoQpjq8PTc/nzlZ6zzlreEZQVWcoT2GaD4rQ8tbRpXXRR7 YnuFDgmQlxs3H/aEL47dAegshEPRQsZr78BRxKcjIqgeHCpXstmQHC363h6wmFQc55+9 5beilFrHhs2SwmNFGmv6kxhuaMNXdZotwnQQc6tizVsm6wU4X+KSAVpCjYTN+0nl/Dq/ e2wRjL8W4DkP3RxvAu3UshEb5ouslBJOhUrAGRV491hhMbMRpQumaJ+l4X0Ho3MkMy6w r6BluNcq3ADlG5cJCMccVkTMMVY7Ku5cmfdP7nh7xGj9qyJpQE9rRP4e6SDw+ZOnHBHr XZOQ== 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=K6mtQZriXFi2LA47oIMwPDQxviPkhU7JvmpZnbjgTF8=; b=J0CoUUYHvsF9MMzR60SMogovw6CuBny4J9qoolgu817jpowFX8fExHRwfwwbTmR9TP y+obP/j24/ihra2WdpNbeFlzDTSirAYJiWrz7gU6R17R51yVhUuXa7VGusghcbykKuzP 8WG1+w1mVhqIvSWE241gBX/lZxvkOZ5L48DZf/A/Tswua03Kw5/W8IapUZ0vHRy7f8Cp U2zKxezYdgoF4RpMiR4G8aXiFgwNQjpVRJsodTlIrXQkZg4TbyDqRN8XUjzKy42XjDdq 9WmRSCVeGn+P78dWCOOSXl9zdSZuuPwWC43QFLNyQSn5VsyKxbF6DcayaWGI1HOpNgoy Fjjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mL4+d1KR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si2570329edv.523.2021.08.26.04.21.57; Thu, 26 Aug 2021 04:22:40 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mL4+d1KR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242082AbhHZLPx (ORCPT + 99 others); Thu, 26 Aug 2021 07:15:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241883AbhHZLPu (ORCPT ); Thu, 26 Aug 2021 07:15:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 48A9F60F25; Thu, 26 Aug 2021 11:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629976503; bh=l34iZ6OiUVG6vmzegiT/WRNXQh5qJnN85muDTV61VIo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mL4+d1KRYd2xWMSSSMk4xdPCFBT/uF9nD3GvQfOqlpQqJYS6cGPpyaq17NNebjsm1 UYCPQYdr6c0pNbCubO8BIZLsbUjJ9cKJJgyRBqh1nhHrI3SzETz4YPd0dKbBufBnnI +CTvXRD1WRnu6S/dT1F3cUnX7TpW9ARJsONXBxPE= Date: Thu, 26 Aug 2021 13:14:57 +0200 From: Greg Kroah-Hartman To: Kishon Vijay Abraham I Cc: Mathias Nyman , Alan Stern , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, chris.chiu@canonical.com Subject: Re: [RFC PATCH 1/5] usb: core: hcd: Modularize HCD stop configuration in usb_stop_hcd() Message-ID: References: <20210824105302.25382-1-kishon@ti.com> <20210824105302.25382-2-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 24, 2021 at 08:48:45PM +0530, Kishon Vijay Abraham I wrote: > Hi Greg, > > On 24/08/21 6:36 pm, Greg Kroah-Hartman wrote: > > On Tue, Aug 24, 2021 at 04:22:58PM +0530, Kishon Vijay Abraham I wrote: > >> No functional change. Since configuration to stop HCD is invoked from > >> multiple places, group all of them in usb_stop_hcd(). > >> > >> Signed-off-by: Kishon Vijay Abraham I > >> --- > >> drivers/usb/core/hcd.c | 42 +++++++++++++++++++++++++----------------- > >> 1 file changed, 25 insertions(+), 17 deletions(-) > >> > >> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c > >> index 0f8b7c93310e..c036ba5311b3 100644 > >> --- a/drivers/usb/core/hcd.c > >> +++ b/drivers/usb/core/hcd.c > >> @@ -2760,6 +2760,29 @@ static void usb_put_invalidate_rhdev(struct usb_hcd *hcd) > >> usb_put_dev(rhdev); > >> } > >> > >> +/** > >> + * usb_stop_hcd - Halt the HCD > >> + * @hcd: the usb_hcd that has to be halted > >> + * > >> + * Stop the timer and invoke ->stop() callback on the HCD > >> + */ > >> +static void usb_stop_hcd(struct usb_hcd *hcd) > >> +{ > >> + if (!hcd) > >> + return; > > > > That's impossible to hit, so no need to check for it, right? > > Patch 3 of this series adds support for registering roothub of shared > HCD. So after that patch there can be a case where shared_hcd is NULL. > The other option would be to check for non-null value in hcd and then > invoke usb_stop_hcd(). Then add the check when you need it please. thanks, greg k-h