Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19508297ybl; Sat, 4 Jan 2020 03:02:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzqDwtpgMxPQVkzesxmbZk161qRbeAgLYER9BSVKNpcNsBRkCMw/ajip/+SAtAlYCIoPQS8 X-Received: by 2002:a9d:7501:: with SMTP id r1mr102478997otk.196.1578135767155; Sat, 04 Jan 2020 03:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578135767; cv=none; d=google.com; s=arc-20160816; b=hSlm2XE5PNjvVuyglSQYIhRVhF+sX1D6zvh7KKWx61KxA5NuMCZMKMOVhEBAI22Smq mMWoLkBMq4EJF4nRZ0YbBBGN9Kuj7ghr1cKylvXtDzPMImOGYMdD6UGjoI9Mhs+/v0Uw OF5wnidUBLyXVv2fGaOn6kV3BB/BccHt2+Gl/hOrAGPFC0PY/BM/sfejY4cpFfc57/OX x0OnORds/v6QNn81g2nGq1LQ75mSoxO/bnkYVFTVlBydyeAvwhpt43+6OC+mHMq5Mp7z kuUaRiEFzR8pepP/sfrKdQ/xrLqFy4Oab37i0tsrGwfKDplTEYQbIdG2WG1OqEe/WVzJ rFrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RlgTkzKUfvy0N4A59gwpFTVOIP+ZPapLH1TF/ZYdAS4=; b=NmSFWH9N/ie3V/2iObT3n5KmvjcQWrYyHsgqR/hB6OofcLc4SKcLag3HJC5hs4BbAg FLLKfKiPAyXN4lLwqPkgWM53pu+tnH7dHJC30bw8sdXSFJv5svmHN52NSMC0SsgpSLA3 lqZUaIA+/vhrcXPPTm214rKWQXX/0/IEEflRZNRt+89EeZ2C2cySyCLJGLun87A70bVN tp6BKn3QjN7A1MZ3kmyolpaS09iyxvh+O/Rg7One/lmc1eaUWpWYtPDqdBBCJVCysjGC i8vDq/SuLW5JoDHuCJZZ3fjuFGZG1TnTDp7P3MzNSrPx+zM8G6MrgvSUJj1i4XPZIdaV 5B9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=NKUtbawH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11si14040295oic.185.2020.01.04.03.02.34; Sat, 04 Jan 2020 03:02:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=NKUtbawH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725900AbgADLBo (ORCPT + 99 others); Sat, 4 Jan 2020 06:01:44 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:19219 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbgADLBo (ORCPT ); Sat, 4 Jan 2020 06:01:44 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 47qf3S2vK3zGW; Sat, 4 Jan 2020 12:01:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1578135700; bh=rXfcRJa4A/lkYBTFv2idoKsWCS41HUXIWEbLbIxwenU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NKUtbawHoRDqBwLg1awp/+fO4B2sAG1SUzpVQqdcbTIGzxzqfbHxxahfKNM+x5iFo VTgx6OxvMBwo5zI4UK4LwmIFO4kI4+GYN1l+yRMakYFFRezxj3wvUaLr78tk2tET7v QrXMHdUD3gZUjcZSE4LS10RDJMfJWtJvYZrANDCCf+m21ZZGIRakWe/axO1/uChGgD OPdm42AWetjZjy/88I01UQZ2eIqhaM5KbA2RnzPUmNCfUpdwOfxrW+i0tTJTFGoomi W3a4gcKzJe5CSb6kevZtuP+MW3SzvTJ4NegklhmYNB8zWpBg2SxO3pVf8AwL57eYAg S+XtMp7De2seg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.101.4 at mail Date: Sat, 4 Jan 2020 12:01:38 +0100 From: =?iso-8859-2?Q?Micha=B3_Miros=B3aw?= To: Dmitry Osipenko Cc: Peter Chen , Rob Herring , Greg Kroah-Hartman , Thierry Reding , Jonathan Hunter , Felipe Balbi , "devicetree@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 10/10] usb: chipidea: tegra: Add USB_TEGRA_PHY module to driver's dependencies Message-ID: <20200104110138.GA7849@qmqm.qmqm.pl> References: <20191220015238.9228-1-digetx@gmail.com> <20191220015238.9228-11-digetx@gmail.com> <20191220035650.GC19921@b29397-desktop> <20191223213234.GA28786@qmqm.qmqm.pl> <7174833f-8325-7fb4-d190-78ba4bed0cbb@gmail.com> <20191230210259.GD24135@qmqm.qmqm.pl> <20200103072536.GA14228@qmqm.qmqm.pl> <51ecc509-e277-591d-3db5-fc9d46eee326@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <51ecc509-e277-591d-3db5-fc9d46eee326@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 04, 2020 at 02:19:01AM +0300, Dmitry Osipenko wrote: > 03.01.2020 10:25, Michał Mirosław пишет: > > On Thu, Jan 02, 2020 at 06:17:47PM +0300, Dmitry Osipenko wrote: > >> 31.12.2019 00:02, Michał Mirosław пишет: > >>> On Tue, Dec 24, 2019 at 07:21:05AM +0300, Dmitry Osipenko wrote: > >>>> 24.12.2019 00:32, Michał Mirosław пишет: > >>>>> On Fri, Dec 20, 2019 at 07:31:08AM +0300, Dmitry Osipenko wrote: > >>>>>> 20.12.2019 06:56, Peter Chen пишет: > >>>>>>> On 19-12-20 04:52:38, Dmitry Osipenko wrote: > >>>>> [...] > >>>>>>>> --- a/drivers/usb/chipidea/ci_hdrc_tegra.c > >>>>>>>> +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c > >>>>>>>> @@ -53,6 +53,12 @@ static int tegra_udc_probe(struct platform_device *pdev) > >>>>>>>> struct tegra_udc *udc; > >>>>>>>> int err; > >>>>>>>> > >>>>>>>> + if (IS_MODULE(CONFIG_USB_TEGRA_PHY)) { > >>>>>>>> + err = request_module("phy_tegra_usb"); > >>>>>>>> + if (err) > >>>>>>>> + return err; > >>>>>>>> + } > >>>>>>>> + > >>>>>>> > >>>>>>> Why you do this dependency, if this controller driver can't > >>>>>>> get USB PHY, it should return error. What's the return value > >>>>>>> after calling below: > >>>>>>> > >>>>>>> udc->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); > >>>>>> > >>>>>> It returns -EPROBE_DEFER when phy_tegra_usb isn't loaded. > >>>>> > >>>>> How are other driver modules autoloaded? Isn't there an appropriate > >>>>> MODALIAS or MODULE_DEVICE_TABLE in there? > >>>> > >>>> Hello Michał, > >>>> > >>>> The phy_tegra_usb module is fine by itself, it's getting autoloaded. > >>>> > >>>> The problem is that ci_hdrc_tegra module depends on the phy_tegra_usb > >>>> module and thus the PHY module should be loaded before the CI module, > >>>> otherwise CI driver fails with the EPROBE_DEFER. > >>> > >>> Why, then, is CI driver not being probed again after PHY driver loads? > >>> EPROBE_DEFER is what should cause driver core to re-probe a device after > >>> other devices appear (PHY in this case). > >> > >> CI driver is getting re-probed just fine if PHY's driver module is > >> loaded manually after loading the CI's module. This patch removes this > >> necessity to manually load PHY's module. > >> > >> This is just a minor convenience change that brings the CI's driver > >> loading behaviour on par with the behaviour of loading Tegra's EHCI > >> driver module. > > > > I fully understand the goal, but what I'm missing is that why this > > doesn't work out of the box? If the PHY module is autoloaded, and so is > > CI driver, and (as I understand) the driver's probe() correctly returns > > EPROBE_DEFER when PHY is not probed yet, then I guess that means bug > > somewhere else and the patch just covers it up. > > It works out of the box, but it also could work a bit better in a case > of manually reloading modules. Perhaps it should be possible to derive > module dependencies from the Kconfig dependencies, apparently kernel > doesn't support it yet or maybe there is some reason why it can't be done. Kconfig change I'm ok with as it simplifies kernel configuration. The request_module() is something I would advise against, because if I do manual module loading, I usually don't want modules loaded automatically. Best Regards, Michał Mirosław