lkml.org 
[lkml]   [2020]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 10/10] usb: chipidea: tegra: Add USB_TEGRA_PHY module to driver's dependencies
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

\
 
 \ /
  Last update: 2020-01-04 12:02    [W:0.098 / U:1.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site