[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c97e840e-fe8e-40e9-baef-0a18103848fd@gmail.com>
Date: Thu, 26 Jun 2025 08:07:19 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Lothar Rubusch <l.rubusch@...il.com>, jic23@...nel.org,
dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] iio: adc: ti-adc128s052: replace literal by unit
expression
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@...il.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
Powered by blists - more mailing lists