blob: 92b7fe52bd1ba5c08275ff2c41faaf68dce6d648 [file] [log] [blame]
From: Dmitry Rokosov <DDRokosov@sberdevices.ru>
Subject: units: complement the set of Hz units
Date: Mon, 1 Aug 2022 14:37:25 +0000
Patch series "units: complement the set of Hz units", v3.
During msa311 accel IIO driver development
https://lore.kernel.org/linux-iio/20220616104211.9257-1-ddrokosov@sberdevices.ru/
Andy requested to use proper units in the hz->ms calculation. Current
units.h header doesn't have milli, micro and nano HZ coefficients, so some
drivers (in the IIO subsystem) implement their own copies for that.
The current patchset resolves such a problem and intoduces general
MILLIHZ_PER_HZ, MICROHZ_PER_HZ and NANOHZ_PER_HZ definitions in the
units.h, and fixes all drivers which duplicate these units.
This patch (of 3):
Currently, Hz units do not have milli, micro and nano Hz coefficients.
Some drivers (IIO especially) use their analogues to calculate
appropriate Hz values. This patch includes them to units.h definitions,
so they can be used from different kernel places.
Link: https://lkml.kernel.org/r/20220801143811.14817-1-ddrokosov@sberdevices.ru
Link: https://lkml.kernel.org/r/20220801143811.14817-2-ddrokosov@sberdevices.ru
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Wolfram Sang <wsa@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Jyoti Bhayana <jbhayana@google.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/units.h | 3 +++
1 file changed, 3 insertions(+)
--- a/include/linux/units.h~units-complement-the-set-of-hz-units
+++ a/include/linux/units.h
@@ -20,6 +20,9 @@
#define PICO 1000000000000ULL
#define FEMTO 1000000000000000ULL
+#define NANOHZ_PER_HZ 1000000000UL
+#define MICROHZ_PER_HZ 1000000UL
+#define MILLIHZ_PER_HZ 1000UL
#define HZ_PER_KHZ 1000UL
#define KHZ_PER_MHZ 1000UL
#define HZ_PER_MHZ 1000000UL
_