[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ve=D1d5wFZgNseP=wGpteEkZHnmAi7j9ykKC+u_NrR5xw@mail.gmail.com>
Date: Tue, 10 Aug 2021 15:49:52 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Mugilraj Dhavachelvan <dmugil2000@...il.com>
Cc: "Bogdan, Dragos" <Dragos.Bogdan@...log.com>,
Darius <Darius.Berghe@...log.com>,
Rob Herring <robh+dt@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Guenter Roeck <linux@...ck-us.net>,
Chris Packham <chris.packham@...iedtelesis.co.nz>,
Slawomir Stepien <sst@...zta.fm>,
Krzysztof Kozlowski <krzk@...nel.org>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110
On Mon, Aug 9, 2021 at 10:59 AM Mugilraj Dhavachelvan
<dmugil2000@...il.com> wrote:
>
> The AD5110/AD5112/AD5114 provide a nonvolatile solution
> for 128-/64-/32-position adjustment applications, offering
> guaranteed low resistor tolerance errors of ±8% and up to
> ±6 mA current density.
...
> +/*
> + * Analog Devices AD5110 digital potentiometer driver
> + *
> + * Copyright (C) 2021 Mugilraj Dhavachelvan <dmugil2000@...il.com>
> + *
> + * Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5110_5112_5114.pdf
> + *
Redundant blank line.
> + */
...
> +#define WIPER_RESISTANCE 70
Missed prefix?
...
> +static const struct iio_chan_spec ad5110_channels[] = {
> + {
> + .type = IIO_RESISTANCE,
> + .output = 1,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_OFFSET) |
> + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_ENABLE),
> + }
+ comma.
> +};
...
> + ret = i2c_master_send_dmasafe(data->client, data->buf, sizeof(data->buf));
> + if (ret != sizeof(data->buf)) {
> + ret = -EIO;
Shadowed error code when ret < 0.
> + goto error;
> + }
...
> + ret = i2c_master_send_dmasafe(data->client, data->buf, sizeof(data->buf));
> + if (ret != sizeof(data->buf))
> + ret = -EIO;
Ditto.
> + mutex_unlock(&data->lock);
> +
> + return ret < 0 ? ret : 0;
> +}
...
> + data->tol = data->cfg->kohms * (val & GENMASK(6, 0)) * 10 / 8;
> + if (!(val & BIT(7)))
> + data->tol *= -1;
Shouldn't you simple use corresponding sign_extend*()?
...
> + ret = ad5110_write(data, AD5110_EEPROM_WR, 0);
> + if (ret) {
> + dev_err(&data->client->dev, "RDAC to EEPROM write failed\n");
> + return ret;
> + }
> + msleep(20);
Each long sleeps like this must be explained.
...
> +static IIO_DEVICE_ATTR(store_eeprom, 0644,
> + ad5110_eeprom_read,
> + ad5110_eeprom_write, 0);
IIO_DEVICE_ATTR_RW() ?
...
> +static struct attribute *ad5110_attributes[] = {
> + &iio_dev_attr_store_eeprom.dev_attr.attr,
> + NULL,
No comma for a terminator line.
> +};
...
> + data->cfg = device_get_match_data(dev);
> + if (!data->cfg)
> + data->cfg = &ad5110_cfg[i2c_match_id(ad5110_id, client)->driver_data];
Not sure this is not a dead code since you are using ->probe_new().
...
> +static struct i2c_driver ad5110_driver = {
> + .driver = {
> + .name = "ad5110",
> + .of_match_table = ad5110_of_match,
> + },
> + .probe_new = ad5110_probe,
> + .id_table = ad5110_id,
> +};
> +
Redundant blank line.
> +module_i2c_driver(ad5110_driver);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists