From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB6C6C4320E for ; Thu, 26 Aug 2021 11:15:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90B2B6109F for ; Thu, 26 Aug 2021 11:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242103AbhHZLPy (ORCPT ); Thu, 26 Aug 2021 07:15:54 -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