lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] iio: adc: ad7291: convert to device tree
From
Date
On 3/17/20 2:56 PM, Michael Auchter wrote:
> There are no in-tree users of the platform data for this driver, so
> remove it and convert the driver to use device tree instead.
>
> Signed-off-by: Michael Auchter <michael.auchter@ni.com>

Hi,

Thanks for the patch, looks good for the most part. One comment inline.

>
> diff --git a/drivers/iio/adc/ad7291.c b/drivers/iio/adc/ad7291.c
> index b2b137fed246..536e31862309 100644
> --- a/drivers/iio/adc/ad7291.c
> +++ b/drivers/iio/adc/ad7291.c
> @@ -495,8 +482,19 @@ static int ad7291_probe(struct i2c_client *client,
> AD7291_T_SENSE_MASK | /* Tsense always enabled */
> AD7291_ALERT_POLARITY; /* set irq polarity low level */
>
> - if (pdata && pdata->use_external_ref)
> + chip->reg = devm_regulator_get_optional(&client->dev, "vref");
> + if (IS_ERR(chip->reg)) {
> + if (PTR_ERR(chip->reg) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;

We should only continue if the error is ENODEV, which means that no
regulator was specified. Any other error means it was specified but
there was an issue requesting it. See for example ad7266.c

> +
> + chip->reg = NULL;
> + } else {
> + ret = regulator_enable(chip->reg);
> + if (ret)
> + return ret;
> +
> chip->command |= AD7291_EXT_REF;
> + }

\
 
 \ /
  Last update: 2020-03-17 15:18    [W:0.116 / U:1.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site