Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/09/2013 04:12 AM, Mark Brown wrote:
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).

Then he'll have to make sure that all devicetree files in the system contain references
to this regulator.

Also do you really need 25ms after power on?

I had not noticed, but I recommend to reject the patch because of it. If we add 25ms delay to each driver,
booting the system will take as long as booting windows. If enabling the regulator needs time,
the regulator subsystem should do it.

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux