lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200904143848.535d4c13@coco.lan>
Date:   Fri, 4 Sep 2020 14:38:48 +0200
From:   Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To:     Mark Brown <broonie@...nel.org>
Cc:     linuxarm@...wei.com, mauro.chehab@...wei.com,
        John Stultz <john.stultz@...aro.org>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC 09/10] misc: hisi_hikey_usb: add support for Hikey 970

Em Fri, 4 Sep 2020 13:23:03 +0100
Mark Brown <broonie@...nel.org> escreveu:

> On Fri, Sep 04, 2020 at 12:23:31PM +0200, Mauro Carvalho Chehab wrote:
> 
> > +	regulator = devm_regulator_get_optional(&pdev->dev, "hub-vdd");
> > +	if (IS_ERR(regulator)) {
> > +		if (PTR_ERR(regulator) == -EPROBE_DEFER) {
> > +			dev_info(&pdev->dev,
> > +				 "waiting for hub-vdd-supply to be probed\n");
> > +			return PTR_ERR(regulator);
> > +		}
> > +
> > +		/* let it fall back to regulator dummy */
> > +		regulator = devm_regulator_get(&pdev->dev, "hub-vdd");
> > +		if (IS_ERR(regulator)) {
> > +			dev_err(&pdev->dev,
> > +				"get hub-vdd-supply failed with error %ld\n",
> > +				PTR_ERR(regulator));
> > +			return PTR_ERR(regulator);
> > +		}
> > +	}  
> 
> This seems weird - if the supply is non-optional why is the code trying
> with devm_regulator_get_optional()?  Just use normal get directly.

That's meant to avoid problems with EPROBE_DEFER.

See, Hikey 970 need to initialize 4 drivers for the regulators:
SPMI core, SPMI bus controller, MFD and regulator. This can take
some time. So, a first call to *regulator_get() may return
EPROBE_DEFER, specially if both regulator drivers and USB HUB
are builtin.

I ended doing the same as some other DRM drivers do (like adv7535).


> > +	ret = regulator_set_voltage(regulator, 3300000, 3300000);
> > +	if (ret)
> > +		dev_err(&pdev->dev, "set hub-vdd-supply voltage failed\n");  
> 
> Unless the device is actively managing the voltage at runtime it should
> just let the voltage be set by machine constraints, most of the time
> this will do nothing.  This only sets the voltage in this one place.

Ok, I'll drop this.

> > +	hub_reset_en_gpio = of_get_named_gpio(pdev->dev.of_node,
> > +					      "hub_reset_en_gpio", 0);
> > +	if (!gpio_is_valid(hub_reset_en_gpio)) {
> > +		dev_err(&pdev->dev, "Failed to get a valid reset gpio\n");
> > +		return -ENODEV;
> > +	}  
> 
> Why not just use devm_gpio_request() which already asks for the GPIO by
> name?

Makes sense.

Thanks,
Mauro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ