devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Bogdan, Dragos" <Dragos.Bogdan@analog.com>,
	Darius <Darius.Berghe@analog.com>,
	Rob Herring <robh+dt@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Slawomir Stepien <sst@poczta.fm>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110
Date: Wed, 11 Aug 2021 11:15:58 +0530	[thread overview]
Message-ID: <20210811054558.GA3826@mugil-Nitro-AN515-52> (raw)
In-Reply-To: <CAHp75Ve=D1d5wFZgNseP=wGpteEkZHnmAi7j9ykKC+u_NrR5xw@mail.gmail.com>

On Tue, Aug 10, 2021 at 03:49:52PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 9, 2021 at 10:59 AM Mugilraj Dhavachelvan
> <dmugil2000@gmail.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@gmail.com>
> > + *
> > + * Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5110_5112_5114.pdf
> 
> > + *
> 
> Redundant blank line.
> 
fixed in v3
> > + */
> 
> ...
> 
> > +#define WIPER_RESISTANCE       70
> 
> Missed prefix?
> 
fixed in v3
> ...
> 
> > +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.
> 
fixed in v3
> > +};
> 
> ...
> 
> > +       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.
> 
fixed in v3
> > +               goto error;
> > +       }
> 
> ...
> 
> > +       ret = i2c_master_send_dmasafe(data->client, data->buf, sizeof(data->buf));
> > +       if (ret != sizeof(data->buf))
> > +               ret = -EIO;
> 
> Ditto.
> 
fixed in v3
> > +       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*()?
> 
I'm not able see any sign_extend for 16 bit. Is there any other way?
> ...
> 
> > +       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.
> 
fixed in v3
> ...
> 
> > +static IIO_DEVICE_ATTR(store_eeprom, 0644,
> > +                      ad5110_eeprom_read,
> > +                      ad5110_eeprom_write, 0);
> 
> IIO_DEVICE_ATTR_RW() ?
> 
fixed in v3
> ...
> 
> > +static struct attribute *ad5110_attributes[] = {
> > +       &iio_dev_attr_store_eeprom.dev_attr.attr,
> > +       NULL,
> 
> No comma for a terminator line.
> 
fixed in v3
> > +};
> 
> ...
> 
> > +       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().
> 
Even I'm suspecting that and also removing id_table. But I'm not sure of
it so just left as it is.
> ...
> 
> > +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
fixed in v3.
> 
> > +module_i2c_driver(ad5110_driver);
> 
Thanks for the feedback :)
> -- 
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2021-08-11  5:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  7:57 [PATCH v2 0/2] iio: potentiometer: Add driver support for AD5110 Mugilraj Dhavachelvan
2021-08-09  7:57 ` [PATCH v2 1/2] dt-bindings: iio: potentiometer: Add AD5110 in trivial-devices Mugilraj Dhavachelvan
2021-08-13 20:57   ` Rob Herring
2021-08-09  7:57 ` [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110 Mugilraj Dhavachelvan
2021-08-09 20:05   ` Jonathan Cameron
2021-08-10 12:49   ` Andy Shevchenko
2021-08-11  5:45     ` Mugilraj Dhavachelvan [this message]
2021-08-11  7:03       ` Andy Shevchenko
2021-08-11  7:05         ` Andy Shevchenko
2021-08-11  8:11           ` Mugilraj Dhavachelvan
2021-08-11  8:15     ` Lars-Peter Clausen
2021-08-11 16:06       ` Andy Shevchenko
2021-08-12 16:53         ` Mugilraj Dhavachelvan
2021-08-14  8:18           ` Mugilraj Dhavachelvan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811054558.GA3826@mugil-Nitro-AN515-52 \
    --to=dmugil2000@gmail.com \
    --cc=Darius.Berghe@analog.com \
    --cc=Dragos.Bogdan@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=sst@poczta.fm \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).