Linux IIO development
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Marilene Andrade Garcia" <marilene.agarcia@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org,
	"Kim Seer Paller" <kimseer.paller@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
	"Marcelo Schmitt" <Marcelo.Schmitt@analog.com>,
	"Ceclan Dumitru" <dumitru.ceclan@analog.com>,
	"Jonathan Santos" <Jonathan.Santos@analog.com>,
	"Dragos Bogdan" <dragos.bogdan@analog.com>
Subject: Re: [PATCH v11 2/3] iio: adc: max14001: New driver
Date: Wed, 17 Sep 2025 08:14:57 -0500	[thread overview]
Message-ID: <e8734476-2b47-4031-92fe-98b325629408@baylibre.com> (raw)
In-Reply-To: <aMptAUsQaUIYpVNG@smile.fi.intel.com>

On 9/17/25 3:10 AM, Andy Shevchenko wrote:
> On Tue, Sep 16, 2025 at 01:04:41PM -0500, David Lechner wrote:
>> On 9/15/25 5:16 PM, Marilene Andrade Garcia wrote:
> 

...

>>> +	if (ret < 0)
>>> +		ret = 1250000;
>>> +	else
>>> +		ext_vrefin = 1;
>>> +	st->vref_mV = ret / (MICRO / MILLI);
>>
>> Just a style choice here, but in other drivers with similar handling
>> we wrote it like this to avoid the extra if statement:
> 
> I didn't get this. You move from clear if to not-so-clear ternary. How is
> the proposed code better?

I can't say one is better than the other. What I suggested is just
how we've done it other similar other drivers.

> 
>> 	if (ret < 0 && ret != -ENODEV)
>> 		return dev_err_probe(dev, ret, "Failed to get REFIN voltage\n");
>>
>> 	ext_vrefin = ret != -ENODEV;
>> 	st->vref_mV = ext_vrefin ? ret / 1000 : 1250;
>>
>> Keeping (MICRO / MILLI) instead of 1000 is fine too. There are varying opinions
>> on this.
> 
>> Or we could drop ext_vrefin and have:
> 
> It goes back and force. Can we keep the code as it's in this version?

Sure. Existing code is good enough for me. (And in that case, I
agree that renaming to `use_ext_vrefin` is an improvement.)

> 
>> 	if (ret < 0 && ret != -ENODEV)
>> 		return dev_err_probe(dev, ret, "Failed to get REFIN voltage\n");
>>
>> 	if (ret != -ENODEV) {
>> 		st->vref_mV = ret / 1000;
>>
>> 		/* regmap set bits goes here. */
>> 		... 
>> 	} else {
>> 		st->vref_mV = 1250;
>> 	}
> 

  parent reply	other threads:[~2025-09-17 13:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 22:14 [PATCH v11 0/3] Add MAX14001/MAX14002 support Marilene Andrade Garcia
2025-09-15 22:16 ` [PATCH v11 1/3] dt-bindings: iio: adc: add max14001 Marilene Andrade Garcia
2025-09-16 16:40   ` David Lechner
2025-09-16 19:20     ` Conor Dooley
2025-09-20 21:44       ` Marcelo Schmitt
2025-09-21 21:22         ` Conor Dooley
2025-09-21 21:49           ` Marilene Andrade Garcia
2025-09-15 22:16 ` [PATCH v11 2/3] iio: adc: max14001: New driver Marilene Andrade Garcia
2025-09-16  7:57   ` Andy Shevchenko
2025-09-16 18:04   ` David Lechner
2025-09-16 18:25     ` David Lechner
2025-09-17  8:10     ` Andy Shevchenko
2025-09-17  8:12       ` Andy Shevchenko
2025-09-17 13:21         ` David Lechner
2025-09-17 13:14       ` David Lechner [this message]
2025-09-23  0:56     ` Marilene Andrade Garcia
2025-09-23 14:27       ` David Lechner
2025-09-24  2:40         ` Marilene Andrade Garcia
2025-09-15 22:16 ` [PATCH v11 3/3] iio: ABI: Add voltage mean raw attribute Marilene Andrade Garcia

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=e8734476-2b47-4031-92fe-98b325629408@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=Jonathan.Santos@analog.com \
    --cc=Marcelo.Schmitt@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dragos.bogdan@analog.com \
    --cc=dumitru.ceclan@analog.com \
    --cc=jic23@kernel.org \
    --cc=kimseer.paller@analog.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marilene.agarcia@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@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