mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Ariana Lazar" <ariana.lazar@microchip.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] iio: dac: mcp47feb02: Fix Vref validation [1-999] case
Date: Sun, 15 Mar 2026 12:28:04 +0000	[thread overview]
Message-ID: <20260315122804.228961f6@jic23-huawei> (raw)
In-Reply-To: <abAMvPm0G5jK_GZh@ashevche-desk.local>

On Tue, 10 Mar 2026 14:21:16 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Tue, Mar 10, 2026 at 01:56:44PM +0200, Ariana Lazar wrote:
> > Store reference voltages in uV instead of mV to avoid invalid error code
> > in dev_err_probe() call. Vref variables store the actual value returned by
> > devm_regulator_get_enable_read_voltage() function instead of the results of
> > dividing it by MILLI. The corner case [1-999] divided by MILLI of the
> > voltage reference variable value would become 0 is covered too.  
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> 
> ...
> 
> >  	struct device *dev = &client->dev;
> >  	struct mcp47feb02_data *data;
> >  	struct iio_dev *indio_dev;
> > -	int vref1_mV = 0;
> > -	int vref_mV = 0;
> > -	int vdd_mV;
> > -	int ret;
> > +	int vref1_uV, vref_uV, vdd_uV, ret;  
> 
> Hmm... Semantically ret != vrefXX_uV and putting on one line is questionable.
> But I leave it to Jonathan and others.
I would have left it on a separate line, but I don't care enough to
tweak it whilst applying.

So applied as is to the fixes-togreg branch of iio.git.
Thanks,

Jonathan

> 
> ...
> 
> >  	if (ret > 0) {
> > -		vref_mV = ret / MILLI;
> > +		vref_uV = ret;
> >  		data->use_vref = true;
> >  	} else {
> > +		vref_uV = 0;
> >  		dev_dbg(dev, "using internal band gap as voltage reference.\n");
> >  		dev_dbg(dev, "Vref is unavailable.\n");
> >  	}  
> 
> Now a question here, why do we need use_vrefXX if we may deduct it
> from vrefXX_uV?  Perhaps it deserves a separate change.
> 
> 


      reply	other threads:[~2026-03-15 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 11:56 Ariana Lazar
2026-03-10 12:21 ` Andy Shevchenko
2026-03-15 12:28   ` Jonathan Cameron [this message]

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=20260315122804.228961f6@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=ariana.lazar@microchip.com \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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

all inboxes | Powered by JetHome®