Linux IIO development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Lothar Rubusch <l.rubusch@gmail.com>,
	jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] iio: adc: ti-adc128s052: replace literal by unit expression
Date: Thu, 26 Jun 2025 08:07:19 +0300	[thread overview]
Message-ID: <c97e840e-fe8e-40e9-baef-0a18103848fd@gmail.com> (raw)
In-Reply-To: <20250625170218.545654-3-l.rubusch@gmail.com>

On 25/06/2025 20:02, Lothar Rubusch wrote:
> Replace the literal number 1000 by MILLI from linux/units.h
> 
> Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
> ---
>   drivers/iio/adc/ti-adc128s052.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
> index cf271c39e663..67bc7fbd52bc 100644
> --- a/drivers/iio/adc/ti-adc128s052.c
> +++ b/drivers/iio/adc/ti-adc128s052.c
> @@ -18,6 +18,7 @@
>   #include <linux/property.h>
>   #include <linux/regulator/consumer.h>
>   #include <linux/spi/spi.h>
> +#include <linux/units.h>
>   
>   struct adc128_configuration {
>   	const struct iio_chan_spec	*channels;
> @@ -189,7 +190,7 @@ static int adc128_probe(struct spi_device *spi)
>   				     "failed to read '%s' voltage",
>   				     config->refname);
>   
> -	adc->vref_mv = ret / 1000;
> +	adc->vref_mv = ret / MILLI;

This makes no sense to me. What does it mean we divide the micro volts 
by 'milli'? It is clear when we divide micro volts by 1000 that we get 
milli volts. Also, the mv suffix in variable makes units clear already, 
division by MILLI just obfuscates things. I'd keep it as 1000.

I would just drop this unless Jonathan disagrees.

Yours,
	-- Matti

  parent reply	other threads:[~2025-06-26  5:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 17:02 [PATCH v1 0/2] iio: adc: ti-adc128s052: add support for TI's ADC121s021 Lothar Rubusch
2025-06-25 17:02 ` [PATCH v1 1/2] iio: adc: ti-adc128s052: add support for adc121s021 Lothar Rubusch
2025-06-25 17:55   ` Andy Shevchenko
2025-06-26  5:24   ` Matti Vaittinen
2025-06-26 18:28     ` Jonathan Cameron
2025-06-26 21:33       ` Lothar Rubusch
2025-06-27 16:27         ` David Lechner
2025-06-28 15:29           ` Jonathan Cameron
2025-06-29  0:00       ` Sukrut Bellary
2025-06-29 16:13         ` Lothar Rubusch
2025-06-29 19:32           ` Sukrut Bellary
2025-06-27 16:33   ` David Lechner
2025-06-25 17:02 ` [PATCH v1 2/2] iio: adc: ti-adc128s052: replace literal by unit expression Lothar Rubusch
2025-06-25 17:57   ` Andy Shevchenko
2025-06-26 18:22     ` Jonathan Cameron
2025-06-26  5:07   ` Matti Vaittinen [this message]
2025-06-26 18:20     ` Jonathan Cameron

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=c97e840e-fe8e-40e9-baef-0a18103848fd@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=l.rubusch@gmail.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