public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Menon <simeddon@gmail.com>
To: linux-iio@vger.kernel.org, marcelo.schmitt1@gmail.com,
	lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
	lars@metafoo.d, Siddharth Menon <simeddon@gmail.com>
Subject: [PATCH 1/2] iio: accel: adis16203: Use units.h macros for measurements
Date: Wed,  5 Mar 2025 20:59:11 +0530	[thread overview]
Message-ID: <20250305155712.49833-3-simeddon@gmail.com> (raw)
In-Reply-To: <20250305155712.49833-2-simeddon@gmail.com>

Replace hardcoded microvolt and degree values with MILLI macros from
linux/units.h. Also fixed typo in comment (1.22mV->0.22mV).

Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
 drivers/staging/iio/accel/adis16203.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
index c1c73308800c..ac4b28bcd766 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
+#include <linux/units.h>
 
 #define ADIS16203_STARTUP_DELAY 220 /* ms */
 
@@ -173,10 +174,10 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 		case IIO_VOLTAGE:
 			if (chan->channel == 0) {
 				*val = 1;
-				*val2 = 220000; /* 1.22 mV */
+				*val2 = 220 * MILLI; /* 0.22 mV */
 			} else {
 				*val = 0;
-				*val2 = 610000; /* 0.61 mV */
+				*val2 = 610 * MILLI; /* 0.61 mV */
 			}
 			return IIO_VAL_INT_PLUS_MICRO;
 		case IIO_TEMP:
@@ -185,7 +186,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 			return IIO_VAL_INT_PLUS_MICRO;
 		case IIO_INCLI:
 			*val = 0;
-			*val2 = 25000; /* 0.025 degree */
+			*val2 = 25 * MILLI; /* 0.025 degree */
 			return IIO_VAL_INT_PLUS_MICRO;
 		default:
 			return -EINVAL;
-- 
2.48.1


  reply	other threads:[~2025-03-05 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 15:29 [PATCH 0/2] iio: accel: adis16203: cleanup and standardization Siddharth Menon
2025-03-05 15:29 ` Siddharth Menon [this message]
2025-03-05 15:29 ` [PATCH 2/2] iio: accel: adis16203: remove spi_set_drvdata() Siddharth Menon
2025-03-08 14:43 ` [PATCH 0/2] iio: accel: adis16203: cleanup and standardization Jonathan Cameron
2025-03-08 14:49   ` Jonathan Cameron
2025-03-09  5:48     ` Siddharth Menon
2025-03-09 16:27       ` 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=20250305155712.49833-3-simeddon@gmail.com \
    --to=simeddon@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.d \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=marcelo.schmitt1@gmail.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