diff mbox series

[v5,2/7] units: complement the set of Hz units

Message ID 20220812165243.22177-3-ddrokosov@sberdevices.ru (mailing list archive)
State Changes Requested
Headers show
Series iio: accel: add MSA311 accelerometer driver | expand

Commit Message

Dmitry Rokosov Aug. 12, 2022, 4:52 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

Jonathan Cameron Aug. 28, 2022, 3:55 p.m. UTC | #1
On Fri, 12 Aug 2022 16:52:26 +0000
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.
> 
> Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
I'm not really sure why Andrew Morton picked these up as no obviously
dependencies outside of IIO and we have other patches under review that
need these.

Anyhow, I see they are still in Andrew's nonmm-unstable tree, so
assuming he won't mind me picking them up through IIO instead / as well.
If nothing else git will sort this out when the two trees reach
linux-next or upstream anyway.

+Cc Andrew Morton.

this and next two patches applied to the togreg branch of iio.git.
I'll push that out as testing for 0-day to do it's sanity checks then
it'll go out as iio.git / togreg and get picked up by linux-next.

Thanks,

Jonathan

> ---
>  include/linux/units.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/units.h b/include/linux/units.h
> index 681fc652e3d7..2793a41e73a2 100644
> --- a/include/linux/units.h
> +++ b/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
Andrew Morton Aug. 29, 2022, 9:06 p.m. UTC | #2
On Sun, 28 Aug 2022 16:55:41 +0100 Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 12 Aug 2022 16:52:26 +0000
> 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.
> > 
> > Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> I'm not really sure why Andrew Morton picked these up as no obviously
> dependencies outside of IIO and we have other patches under review that
> need these.
> 
> Anyhow, I see they are still in Andrew's nonmm-unstable tree, so
> assuming he won't mind me picking them up through IIO instead / as well.
> If nothing else git will sort this out when the two trees reach
> linux-next or upstream anyway.
> 
> +Cc Andrew Morton.
> 
> this and next two patches applied to the togreg branch of iio.git.
> I'll push that out as testing for 0-day to do it's sanity checks then
> it'll go out as iio.git / togreg and get picked up by linux-next.
> 
> Thanks,
> 
> Jonathan
> 
> > ---
> >  include/linux/units.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/linux/units.h b/include/linux/units.h
> > index 681fc652e3d7..2793a41e73a2 100644
> > --- a/include/linux/units.h
> > +++ b/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
Andrew Morton Aug. 29, 2022, 9:07 p.m. UTC | #3
On Sun, 28 Aug 2022 16:55:41 +0100 Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 12 Aug 2022 16:52:26 +0000
> 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.
> > 
> > Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> I'm not really sure why Andrew Morton picked these up as no obviously
> dependencies outside of IIO and we have other patches under review that
> need these.

Mainly because [0/n] was titled "units: ...", not "iio: ..."!

> Anyhow, I see they are still in Andrew's nonmm-unstable tree, so
> assuming he won't mind me picking them up through IIO instead / as well.
> If nothing else git will sort this out when the two trees reach
> linux-next or upstream anyway.

I'll drop 'em.
diff mbox series

Patch

diff --git a/include/linux/units.h b/include/linux/units.h
index 681fc652e3d7..2793a41e73a2 100644
--- a/include/linux/units.h
+++ b/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