Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: Jakub Szczudlo <jakubszczudlo40@gmail.com>,
	linux-iio@vger.kernel.org, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, marcelo.schmitt@analog.com,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	mike.looijmans@topic.nl, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, jorge.marques@analog.com,
	antoniu.miclaus@analog.com, mazziesaccount@gmail.com,
	jishnu.prakash@oss.qualcomm.com, duje@dujemihanovic.xyz,
	wens@kernel.org, sakari.ailus@linux.intel.com, linusw@kernel.org
Subject: Re: [PATCH 3/3] iio: adc: Add ti-ads1110 support to ti-ads1100 driver
Date: Mon, 8 Jun 2026 19:03:36 +0100	[thread overview]
Message-ID: <20260608190336.2e90b297@jic23-huawei> (raw)
In-Reply-To: <CALoEA-xWB226gf01OdB5LBMRqrds=b2UN+DmXJdH1j6rq1c5-A@mail.gmail.com>

On Mon, 8 Jun 2026 09:39:07 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> Hi Jakub,
> 
> various comments inline, some nitpicks and some more serious.
> 
> Josh
> 
> On Sun, 7 Jun 2026 at 20:38, Jakub Szczudlo <jakubszczudlo40@gmail.com> wrote:
> >
> > From: jszczudlo <jakubszczudlo40@gmail.com>
> >
> > add ADS1100 support  
> 
> Wrap the commit message to 72 characters per line, this is too
> short.
> 
> > make changing gain and datarate wait for new reading
> > fix unbalanced regulator disable when removing in singleshot mode  
> 
> Additionally, write the commit messages as regular sentences, not
> a list of changes.
> 
> >
> > Signed-off-by: jszczudlo <jakubszczudlo40@gmail.com>  
> 
> Ensure that your full name is in the Signed-off-by tag (this goes for all
> patches in this series).

A few follow ups to the good review you already have from Joshua.

> > @@ -85,6 +98,50 @@ static int ads1100_set_config_bits(struct ads1100_data *data, u8 mask, u8 value)
> >         return 0;
> >  };
> >
> > +static int ads11x0_get_voltage_microvolts(struct ads1100_data *data)
> > +{
> > +       if (data->has_reference_voltage)
> > +               return ADS1110_REFERENCE_VOLTAGE_MICROVOLT;
> > +       else
> > +               return regulator_get_voltage(data->reg_vdd);
> > +}
> > +
> > +static int ads11x0_get_voltage_milivolts(struct ads1100_data *data)
> > +{
> > +       return ads11x0_get_voltage_microvolts(data) / (MICRO / MILLI);
> > +}
> > +
> > +static bool ads11x0_new_data_ready(struct ads1100_data *data)
> > +{
> > +       int ret;
> > +       u8 buffer[3];
> > +
> > +       ret = i2c_master_recv(data->client, (char *)&buffer, sizeof(buffer));
> > +       if (ret < sizeof(buffer)) {  
> 
> Sashiko raises an issue here. sizeof returns a size_t, therefore the compiler
> will promote ret to a size_t, wrapping any potential negative error value to
> a large positive value, throwing away the error.
> 
> > +               dev_err(&data->client->dev, "I2C read fail: %d\n", ret);
> > +               return 0;
It gets thrown away here anyway which is also very wrong!  If an error occurs
it should be propagated. If it makes sense to ignore it, do that at the
caller and add a comment on why.
> > +       }
> > +
> > +       int return_val = FIELD_GET(ADS1100_CFG_ST_BSY, buffer[2]);

When there isn't a good reason to do otherwise we still flow oldstyle c
where local variable declarations come at the top of scope.
However

	return FIELD_GET();
should be fine.

> > +
> > +       return return_val;
> > +}


> >  static void ads1100_disable_continuous(void *data)
> > @@ -307,6 +383,7 @@ static int ads1100_probe(struct i2c_client *client)
> >         struct iio_dev *indio_dev;
> >         struct ads1100_data *data;
> >         struct device *dev = &client->dev;
> > +       const struct ads11x0_config *model;
> >         int ret;
> >
> >         indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> > @@ -334,10 +411,18 @@ static int ads1100_probe(struct i2c_client *client)
> >                 return dev_err_probe(dev, ret,
> >                                      "Failed to enable vdd regulator\n");
> >
> > -       ret = devm_add_action_or_reset(dev, ads1100_reg_disable, data->reg_vdd);
> > +       ret = devm_add_action_or_reset(dev, ads1100_reg_disable, data);
> >         if (ret)
> >                 return ret;
> >
> > +       model = device_get_match_data(dev);
> > +       if (!model)
> > +               return dev_err_probe(dev, ret,
> > +                               "Can't set device data\n");  
> 
> Hmm, if device_get_match_data fails, ret will still be 0 per previous
> devm_add_action_or_reset() call, therefore you're returning a "successful
> error". Additionally, the error message isn't aligned with the parenthesis.

Message also talks about 'setting' when it is 'getting' data from firmware.
So needs a rewrite.

Jonathan



  reply	other threads:[~2026-06-08 18:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 18:35 [PATCH 0/3] iio: adc: Extend ti-ads1100 driver Jakub Szczudlo
2026-06-07 18:35 ` [PATCH 1/3] dt-bindings: iio: adc: Update title and enum Jakub Szczudlo
2026-06-08 17:30   ` Conor Dooley
2026-06-08 17:57   ` Jonathan Cameron
2026-06-07 18:35 ` [PATCH 2/3] iio: adc: Update Kconfig description for TI_ADS1100 Jakub Szczudlo
2026-06-08  6:45   ` Joshua Crofts
2026-06-08 11:43     ` Andy Shevchenko
2026-06-08 17:53       ` Jonathan Cameron
2026-06-07 18:35 ` [PATCH 3/3] iio: adc: Add ti-ads1110 support to ti-ads1100 driver Jakub Szczudlo
2026-06-07 18:50   ` sashiko-bot
2026-06-08  7:39   ` Joshua Crofts
2026-06-08 18:03     ` Jonathan Cameron [this message]
2026-06-08 18:23   ` Jonathan Cameron
2026-06-08  6:42 ` [PATCH 0/3] iio: adc: Extend " Joshua Crofts
2026-06-08 11:42 ` Andy Shevchenko
2026-06-08 18:25 ` Jonathan Cameron
2026-06-09 16:10 ` David Lechner
2026-06-13 14:44   ` Jakub Szczudło

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=20260608190336.2e90b297@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=duje@dujemihanovic.xyz \
    --cc=jakubszczudlo40@gmail.com \
    --cc=jishnu.prakash@oss.qualcomm.com \
    --cc=jorge.marques@analog.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=mazziesaccount@gmail.com \
    --cc=mike.looijmans@topic.nl \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=wens@kernel.org \
    /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