diff mbox series

[v1,1/3] units: complement the set of Hz units

Message ID 20220725184439.7618-2-ddrokosov@sberdevices.ru (mailing list archive)
State Changes Requested
Headers show
Series units: complement the set of Hz units | expand

Commit Message

Dmitry Rokosov July 25, 2022, 6:44 p.m. UTC
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.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
 include/linux/units.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andy Shevchenko July 25, 2022, 9:29 p.m. UTC | #1
On Mon, Jul 25, 2022 at 8:44 PM Dmitry Rokosov <DDRokosov@sberdevices.ru> wrote:
>
> 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.

...

> +#define NHZ_PER_HZ             1000000000UL
> +#define UHZ_PER_HZ             1000000UL
> +#define MHZ_PER_HZ             1000UL

mHZ perhaps?

>  #define HZ_PER_KHZ             1000UL
>  #define KHZ_PER_MHZ            1000UL
>  #define HZ_PER_MHZ             1000000UL
Dmitry Rokosov July 26, 2022, 9:49 a.m. UTC | #2
Hello Andy,

Thank you for quick review.

On Mon, Jul 25, 2022 at 11:29:31PM +0200, Andy Shevchenko wrote:
> On Mon, Jul 25, 2022 at 8:44 PM Dmitry Rokosov <DDRokosov@sberdevices.ru> wrote:
> >
> > 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.
> 
> ...
> 
> > +#define NHZ_PER_HZ             1000000000UL
> > +#define UHZ_PER_HZ             1000000UL
> > +#define MHZ_PER_HZ             1000UL
> 
> mHZ perhaps?
> 

I'm afraid it will not have the same view as other HZ units.
Maybe it's better to call mHZ as MILLIHZ? What do you think?
diff mbox series

Patch

diff --git a/include/linux/units.h b/include/linux/units.h
index 681fc652e3d7..900a642f0ff8 100644
--- a/include/linux/units.h
+++ b/include/linux/units.h
@@ -20,6 +20,9 @@ 
 #define PICO	1000000000000ULL
 #define FEMTO	1000000000000000ULL
 
+#define NHZ_PER_HZ		1000000000UL
+#define UHZ_PER_HZ		1000000UL
+#define MHZ_PER_HZ		1000UL
 #define HZ_PER_KHZ		1000UL
 #define KHZ_PER_MHZ		1000UL
 #define HZ_PER_MHZ		1000000UL