[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 9 Sep 2013 12:12:42 +0100
From: Mark Brown <broonie@...nel.org>
To: Wei Ni <wni@...dia.com>
Cc: khali@...ux-fr.org, linux@...ck-us.net, swarren@...dotorg.org,
lm-sensors@...sensors.org, linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] hwmon: (lm90) Add power control
On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:
> + reg = devm_regulator_get_optional(dev, "vcc");
> + if (!IS_ERR(reg)) {
> + err = regulator_enable(reg);
> + if (err < 0) {
> + dev_err(&client->dev,
> + "Failed to enable regulator: %d\n", err);
> + return err;
> + }
> + msleep(25);
> + } else {
> + if (PTR_ERR(reg) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> + }
This doesn't look good, it is going to ignore actual errors - I *really*
doubt that vcc is optional, it looks like it's the main power supply for
the device. You should use normal regulator_get(), _optional() is for
supplies which could physically not be provided in a system (eg, if the
device can generate them internally if required).
Also do you really need 25ms after power on?
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists