[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220812165243.22177-5-ddrokosov@sberdevices.ru>
Date: Fri, 12 Aug 2022 16:52:27 +0000
From: Dmitry Rokosov <DDRokosov@...rdevices.ru>
To: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"jic23@...nel.org" <jic23@...nel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>,
"andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
"christophe.jaillet@...adoo.fr" <christophe.jaillet@...adoo.fr>,
"stano.jakubek@...il.com" <stano.jakubek@...il.com>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"stephan@...hold.net" <stephan@...hold.net>,
"daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
"wsa@...nel.org" <wsa@...nel.org>,
"lars@...afoo.de" <lars@...afoo.de>,
"Michael.Hennerich@...log.com" <Michael.Hennerich@...log.com>,
"jbhayana@...gle.com" <jbhayana@...gle.com>,
"lucas.demarchi@...el.com" <lucas.demarchi@...el.com>,
"jani.nikula@...el.com" <jani.nikula@...el.com>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>
CC: "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
kernel <kernel@...rdevices.ru>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Dmitry Rokosov <DDRokosov@...rdevices.ru>
Subject: [PATCH v5 4/7] iio: common: scmi_sensors: use HZ macro from units.h
Remove duplicated definition of UHZ_PER_HZ, because it's available in
the units.h as MICROHZ_PER_HZ.
Signed-off-by: Dmitry Rokosov <ddrokosov@...rdevices.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
---
drivers/iio/common/scmi_sensors/scmi_iio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c
index 793d628db55f..54ccf19ab2bb 100644
--- a/drivers/iio/common/scmi_sensors/scmi_iio.c
+++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
@@ -18,6 +18,7 @@
#include <linux/scmi_protocol.h>
#include <linux/time.h>
#include <linux/types.h>
+#include <linux/units.h>
#define SCMI_IIO_NUM_OF_AXIS 3
@@ -130,7 +131,6 @@ static const struct iio_buffer_setup_ops scmi_iio_buffer_ops = {
static int scmi_iio_set_odr_val(struct iio_dev *iio_dev, int val, int val2)
{
struct scmi_iio_priv *sensor = iio_priv(iio_dev);
- const unsigned long UHZ_PER_HZ = 1000000UL;
u64 sec, mult, uHz, sf;
u32 sensor_config;
char buf[32];
@@ -145,7 +145,7 @@ static int scmi_iio_set_odr_val(struct iio_dev *iio_dev, int val, int val2)
return err;
}
- uHz = val * UHZ_PER_HZ + val2;
+ uHz = val * MICROHZ_PER_HZ + val2;
/*
* The seconds field in the sensor interval in SCMI is 16 bits long
@@ -156,10 +156,10 @@ static int scmi_iio_set_odr_val(struct iio_dev *iio_dev, int val, int val2)
* count the number of characters
*/
sf = (u64)uHz * 0xFFFF;
- do_div(sf, UHZ_PER_HZ);
+ do_div(sf, MICROHZ_PER_HZ);
mult = scnprintf(buf, sizeof(buf), "%llu", sf) - 1;
- sec = int_pow(10, mult) * UHZ_PER_HZ;
+ sec = int_pow(10, mult) * MICROHZ_PER_HZ;
do_div(sec, uHz);
if (sec == 0) {
dev_err(&iio_dev->dev,
--
2.36.0
Powered by blists - more mailing lists