Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1936424rwr; Fri, 21 Apr 2023 01:36:33 -0700 (PDT) X-Google-Smtp-Source: AKy350YRUf3+seRJBPokg2b1AhoSjSaZt7UOUV6cNkS9iRNwvMxW9x/7idUK0nv4eK3HZN2e7OZV X-Received: by 2002:a17:90a:d90d:b0:247:a53e:97a1 with SMTP id c13-20020a17090ad90d00b00247a53e97a1mr4342778pjv.28.1682066192802; Fri, 21 Apr 2023 01:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682066192; cv=none; d=google.com; s=arc-20160816; b=gKEjvtzXsX3Uo7w9jYgfFnKDBJ5UrWrUIRFK6QgiVqbNCGV6L16ySEw90h8uKfP7Gg 0Mvuykyf7MSOh3esEq2lqLAOtqPs59svynuDUHD/Q39+N7zxSMUPwcBSOlOdYTnAswWd 6a0dj14Bflx9QTW4z639ds3MfKmpasHSQV6I/EVrXjVVhIZ1v3/oCVb0IcLVycipZW+m HZWhzXfXkhEQ0m/103vZ4gyhTp9Rq7R6gL1PbjQMLJxWjb+CI/z+NSkIBPbd3XHJCA3n hR1KplYWT41S+gUJqsDqRCI4Cr2xXpIdRTftbb17SHTq6YbiFRZzHknNXHezAiYqWnzo u/jQ== 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=lM5x+ZwURzuqyCUj/KqOJq6UpewmbT3mIwor/RazkQ4=; b=ACWjb/dJiM2QD9mYQ1AnH3XQbUrQqZ80wgbM8SXXg3kDYoandPfI0/K5DUK5Des4Py KlIMXpyXqa0SIAV+s5TLNRCZ81LiDA4ElLFsqtwkeKXW9A6kzvDFG6WptGhj+EiBtN2B 3E5An5/GBHg12oTYn+7GJY3q9bCNfJG4GnpkJ9pnZB6wwczOTDSxtIzIoq3f5rObD3nj kr7nj3ykrQNuyADzk5N3hqLWUK5IoThMAPOn4EK3nv6sRZ+8tETTth1vtvSIGjO13vY/ IECMrEcTl8QvXIpZ6/s+N9H+epstQ5zyDbHrS9mkCgWH9XYBxvHw7m3A3jLviF0HJhrU cuIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E77q5lP+; 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 w17-20020a17090a8a1100b0023f2e6a146bsi6590063pjn.41.2023.04.21.01.36.18; Fri, 21 Apr 2023 01:36:32 -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=E77q5lP+; 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 S231553AbjDUIVl (ORCPT + 99 others); Fri, 21 Apr 2023 04:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231485AbjDUIVi (ORCPT ); Fri, 21 Apr 2023 04:21:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C0B55B2; Fri, 21 Apr 2023 01:21:12 -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 CCB1D64EC4; Fri, 21 Apr 2023 08:21:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90346C4339B; Fri, 21 Apr 2023 08:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1682065271; bh=H0Vn9+rqm4T+2n7QD2ANiByQbTsDCUR61d3OOzbyGvM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E77q5lP+IE+OR9wtlOc+yCwlWZVvjbY/xeo1zAeoWVKzwecOO95KaB+JHc2NDXwOv WTCZdrz1iMsEKAU2Bg9u3JGas3Z4Xv7HMTmIIeX0UYKlQtMAdyr+NWg4K8GEPsXIAm HA+LRQAz/2LQZdFKBhcp+41okiXSJhqL/d78NXkI= Date: Fri, 21 Apr 2023 10:21:08 +0200 From: Greg Kroah-Hartman To: Stanley Chang Cc: Alan Stern , Douglas Anderson , Vincent Mailhol , Bhuvanesh Surachari , Mathias Nyman , Flavio Suligoi , Ray Chi , Michael Grzeschik , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] usb: phy: add usb phy notify port status API Message-ID: References: <20230421080333.18681-1-stanley_chang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230421080333.18681-1-stanley_chang@realtek.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Fri, Apr 21, 2023 at 04:03:31PM +0800, Stanley Chang wrote: > In Realtek SoC, the parameter of usb phy is designed to can dynamic > tuning base on port status. Therefore, add a notify callback of phy > driver when usb port status change. > > Signed-off-by: Stanley Chang > --- > drivers/usb/core/hub.c | 13 +++++++++++++ > include/linux/usb/phy.h | 14 ++++++++++++++ > 2 files changed, 27 insertions(+) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 97a0f8faea6e..b4fbbeae1927 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -614,6 +614,19 @@ static int hub_ext_port_status(struct usb_hub *hub, int port1, int type, > ret = 0; > } > mutex_unlock(&hub->status_mutex); > + > + if (!ret) { > + struct usb_device *hdev = hub->hdev; > + > + if (hdev && !hdev->parent) { How can you have a device without a parent? And why does it matter? And how could hdev be NULL? And if it can change to be NULL, what prevents it from changing right after you checked for it? thanks, greg k-h