On 2 September 2016 at 15:40, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote: > Hi, > > Thanks for the patch. > > On 09/02/2016 03:27 PM, Crt Mori wrote: >> This patch is inspired by a comment of Jonathan Cameron on patch of >> Linus Walleij commit aeb55fff3891834e07a3144159a7298a19696af8 ("iio: st_sensors: fetch and enable regulators unconditionally"). >> >> The explanation for this change is same as in that patch: >> "Supplies are *not* optional (optional means that the supply is >> optional in the electrical sense, not the software sense) so we need to >> get the and enable them at all times. > > Some supplies are optional. I.e. the part is able to operate (potentially > with limited functionality) even if the optional external supply has not > been connected to the pin. > > E.g. many converters have a built-in voltage reference but are able to > optionally accept an external reference. The driver needs to know if the > external reference is not connected or not to be able to allow or disallow > applications to switch the part into external reference mode. This is the > case for the ad7266 and ad5761 drivers and using regulator_get_optional() is > correct here. > > Same seems to be true for the ads8688 and the fsl-imx-gcq, judging by how > their code is structured. > > - Lars OK, so the voltage reference part can have optional regulator, but if it is supply voltage then it cannot. What about the IS_ERR_OR_NULL() check? Is that suitable for the optional regulators as well? -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html