* [PATCH] coresight: do not use the BIT() macro in the UAPI header
@ 2020-03-24 4:22 Eugene Syromiatnikov
2020-03-24 6:28 ` Greg Kroah-Hartman
2020-03-24 15:31 ` Mathieu Poirier
0 siblings, 2 replies; 7+ messages in thread
From: Eugene Syromiatnikov @ 2020-03-24 4:22 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, linux-stm32, Pratik Patel,
Maxime Coquelin, Alexandre Torgue
Cc: Michael Williams, Mathieu Poirier, Greg Kroah-Hartman,
Chunyan Zhang, Dmitry V. Levin
The BIT() macro definition is not available for the UAPI headers
(moreover, it can be defined differently in the user space); replace
its usage with the _BITUL() macro that is defined in <linux/const.h>.
Fixes: 237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
---
include/uapi/linux/coresight-stm.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/coresight-stm.h b/include/uapi/linux/coresight-stm.h
index aac550a..8847dbf 100644
--- a/include/uapi/linux/coresight-stm.h
+++ b/include/uapi/linux/coresight-stm.h
@@ -2,8 +2,10 @@
#ifndef __UAPI_CORESIGHT_STM_H_
#define __UAPI_CORESIGHT_STM_H_
-#define STM_FLAG_TIMESTAMPED BIT(3)
-#define STM_FLAG_GUARANTEED BIT(7)
+#include <linux/const.h>
+
+#define STM_FLAG_TIMESTAMPED _BITUL(3)
+#define STM_FLAG_GUARANTEED _BITUL(7)
/*
* The CoreSight STM supports guaranteed and invariant timing
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: do not use the BIT() macro in the UAPI header
2020-03-24 4:22 [PATCH] coresight: do not use the BIT() macro in the UAPI header Eugene Syromiatnikov
@ 2020-03-24 6:28 ` Greg Kroah-Hartman
2020-03-24 9:53 ` Eugene Syromiatnikov
2020-03-24 15:31 ` Mathieu Poirier
1 sibling, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-24 6:28 UTC (permalink / raw)
To: Eugene Syromiatnikov
Cc: linux-kernel, linux-arm-kernel, linux-stm32, Pratik Patel,
Maxime Coquelin, Alexandre Torgue, Michael Williams,
Mathieu Poirier, Chunyan Zhang, Dmitry V. Levin
On Tue, Mar 24, 2020 at 05:22:13AM +0100, Eugene Syromiatnikov wrote:
> The BIT() macro definition is not available for the UAPI headers
> (moreover, it can be defined differently in the user space); replace
> its usage with the _BITUL() macro that is defined in <linux/const.h>.
Why is somehow _BITUL() ok to use here instead?
Just open-code it, I didn't think we could use any BIT()-like macros in
uapi .h files.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: do not use the BIT() macro in the UAPI header
2020-03-24 6:28 ` Greg Kroah-Hartman
@ 2020-03-24 9:53 ` Eugene Syromiatnikov
2020-03-24 10:19 ` Greg Kroah-Hartman
0 siblings, 1 reply; 7+ messages in thread
From: Eugene Syromiatnikov @ 2020-03-24 9:53 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-kernel, linux-arm-kernel, linux-stm32, Pratik Patel,
Maxime Coquelin, Alexandre Torgue, Michael Williams,
Mathieu Poirier, Chunyan Zhang, Dmitry V. Levin
On Tue, Mar 24, 2020 at 07:28:53AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 24, 2020 at 05:22:13AM +0100, Eugene Syromiatnikov wrote:
> > The BIT() macro definition is not available for the UAPI headers
> > (moreover, it can be defined differently in the user space); replace
> > its usage with the _BITUL() macro that is defined in <linux/const.h>.
>
> Why is somehow _BITUL() ok to use here instead?
It is provided in an UAPI header (include/uapi/linux/const.h)
and is appropriately prefixed with an underscore to avoid conflicts.
> Just open-code it, I didn't think we could use any BIT()-like macros in
> uapi .h files.
>
> thanks,
>
> greg k-h
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: do not use the BIT() macro in the UAPI header
2020-03-24 9:53 ` Eugene Syromiatnikov
@ 2020-03-24 10:19 ` Greg Kroah-Hartman
2020-03-24 12:13 ` Eugene Syromiatnikov
0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-24 10:19 UTC (permalink / raw)
To: Eugene Syromiatnikov
Cc: linux-kernel, linux-arm-kernel, linux-stm32, Pratik Patel,
Maxime Coquelin, Alexandre Torgue, Michael Williams,
Mathieu Poirier, Chunyan Zhang, Dmitry V. Levin
On Tue, Mar 24, 2020 at 10:53:04AM +0100, Eugene Syromiatnikov wrote:
> On Tue, Mar 24, 2020 at 07:28:53AM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Mar 24, 2020 at 05:22:13AM +0100, Eugene Syromiatnikov wrote:
> > > The BIT() macro definition is not available for the UAPI headers
> > > (moreover, it can be defined differently in the user space); replace
> > > its usage with the _BITUL() macro that is defined in <linux/const.h>.
> >
> > Why is somehow _BITUL() ok to use here instead?
>
> It is provided in an UAPI header (include/uapi/linux/const.h)
> and is appropriately prefixed with an underscore to avoid conflicts.
Because no one uses _ in their own macros? :)
Anyway, this is fine, but if it's really the way forward, I think a lot
of files will end up being changed...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: do not use the BIT() macro in the UAPI header
2020-03-24 10:19 ` Greg Kroah-Hartman
@ 2020-03-24 12:13 ` Eugene Syromiatnikov
0 siblings, 0 replies; 7+ messages in thread
From: Eugene Syromiatnikov @ 2020-03-24 12:13 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-kernel, linux-arm-kernel, linux-stm32, Pratik Patel,
Maxime Coquelin, Alexandre Torgue, Michael Williams,
Mathieu Poirier, Chunyan Zhang, Dmitry V. Levin
On Tue, Mar 24, 2020 at 11:19:38AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 24, 2020 at 10:53:04AM +0100, Eugene Syromiatnikov wrote:
> > On Tue, Mar 24, 2020 at 07:28:53AM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Mar 24, 2020 at 05:22:13AM +0100, Eugene Syromiatnikov wrote:
> > > > The BIT() macro definition is not available for the UAPI headers
> > > > (moreover, it can be defined differently in the user space); replace
> > > > its usage with the _BITUL() macro that is defined in <linux/const.h>.
> > >
> > > Why is somehow _BITUL() ok to use here instead?
> >
> > It is provided in an UAPI header (include/uapi/linux/const.h)
> > and is appropriately prefixed with an underscore to avoid conflicts.
>
> Because no one uses _ in their own macros? :)
Well, it is a reserved prefix (ANSI C99, 4.1.2 "Standard headers": "All
other identifiers that begin with an underscore and either an upper-case
letter or another underscore are reserved"), so valid C files shouldn't
use them.
> Anyway, this is fine, but if it's really the way forward, I think a lot
> of files will end up being changed...
There are 5 cases for using BIT() in UAPI headers so far (rtc.h[1],
serio.h[2], psci.h[3], pkt_sched.h[4], coresight-stm.h), two of them were
conversions from the open-coded variant; the usage of _BITUL in pkt_sched.h
made me think that it is the better approach since people tend to use
BIT-like macro anyway, so, by increasing a number of cases it may raise
awareness of the UAPI specifics.
[1] https://lore.kernel.org/lkml/20200324041209.GA30727@asgard.redhat.com/
[2] https://lore.kernel.org/lkml/20200324041341.GA32335@asgard.redhat.com/
[3] https://lore.kernel.org/lkml/20200324041526.GA1978@asgard.redhat.com/
[4] https://lore.kernel.org/lkml/20200324041920.GA7068@asgard.redhat.com/
>
> thanks,
>
> greg k-h
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: do not use the BIT() macro in the UAPI header
2020-03-24 4:22 [PATCH] coresight: do not use the BIT() macro in the UAPI header Eugene Syromiatnikov
2020-03-24 6:28 ` Greg Kroah-Hartman
@ 2020-03-24 15:31 ` Mathieu Poirier
2020-03-26 14:10 ` Greg Kroah-Hartman
1 sibling, 1 reply; 7+ messages in thread
From: Mathieu Poirier @ 2020-03-24 15:31 UTC (permalink / raw)
To: Eugene Syromiatnikov
Cc: Linux Kernel Mailing List, linux-arm-kernel, linux-stm32,
Pratik Patel, Maxime Coquelin, Alexandre Torgue,
Michael Williams, Greg Kroah-Hartman, Chunyan Zhang,
Dmitry V. Levin
On Mon, 23 Mar 2020 at 22:22, Eugene Syromiatnikov <esyr@redhat.com> wrote:
>
> The BIT() macro definition is not available for the UAPI headers
> (moreover, it can be defined differently in the user space); replace
> its usage with the _BITUL() macro that is defined in <linux/const.h>.
>
> Fixes: 237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")
> Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
> ---
> include/uapi/linux/coresight-stm.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/coresight-stm.h b/include/uapi/linux/coresight-stm.h
> index aac550a..8847dbf 100644
> --- a/include/uapi/linux/coresight-stm.h
> +++ b/include/uapi/linux/coresight-stm.h
> @@ -2,8 +2,10 @@
> #ifndef __UAPI_CORESIGHT_STM_H_
> #define __UAPI_CORESIGHT_STM_H_
>
> -#define STM_FLAG_TIMESTAMPED BIT(3)
> -#define STM_FLAG_GUARANTEED BIT(7)
> +#include <linux/const.h>
> +
> +#define STM_FLAG_TIMESTAMPED _BITUL(3)
> +#define STM_FLAG_GUARANTEED _BITUL(7)
Greg, if you want to pick this up right away:
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Otherwise let me know and I'll add it to my next tree.
Thanks,
Mathieu
>
> /*
> * The CoreSight STM supports guaranteed and invariant timing
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] coresight: do not use the BIT() macro in the UAPI header
2020-03-24 15:31 ` Mathieu Poirier
@ 2020-03-26 14:10 ` Greg Kroah-Hartman
0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-26 14:10 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Eugene Syromiatnikov, Linux Kernel Mailing List,
linux-arm-kernel, linux-stm32, Pratik Patel, Maxime Coquelin,
Alexandre Torgue, Michael Williams, Chunyan Zhang,
Dmitry V. Levin
On Tue, Mar 24, 2020 at 09:31:15AM -0600, Mathieu Poirier wrote:
> On Mon, 23 Mar 2020 at 22:22, Eugene Syromiatnikov <esyr@redhat.com> wrote:
> >
> > The BIT() macro definition is not available for the UAPI headers
> > (moreover, it can be defined differently in the user space); replace
> > its usage with the _BITUL() macro that is defined in <linux/const.h>.
> >
> > Fixes: 237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")
> > Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
> > ---
> > include/uapi/linux/coresight-stm.h | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/uapi/linux/coresight-stm.h b/include/uapi/linux/coresight-stm.h
> > index aac550a..8847dbf 100644
> > --- a/include/uapi/linux/coresight-stm.h
> > +++ b/include/uapi/linux/coresight-stm.h
> > @@ -2,8 +2,10 @@
> > #ifndef __UAPI_CORESIGHT_STM_H_
> > #define __UAPI_CORESIGHT_STM_H_
> >
> > -#define STM_FLAG_TIMESTAMPED BIT(3)
> > -#define STM_FLAG_GUARANTEED BIT(7)
> > +#include <linux/const.h>
> > +
> > +#define STM_FLAG_TIMESTAMPED _BITUL(3)
> > +#define STM_FLAG_GUARANTEED _BITUL(7)
>
> Greg, if you want to pick this up right away:
>
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> Otherwise let me know and I'll add it to my next tree.
I'll take it now, thanks.
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-26 14:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 4:22 [PATCH] coresight: do not use the BIT() macro in the UAPI header Eugene Syromiatnikov
2020-03-24 6:28 ` Greg Kroah-Hartman
2020-03-24 9:53 ` Eugene Syromiatnikov
2020-03-24 10:19 ` Greg Kroah-Hartman
2020-03-24 12:13 ` Eugene Syromiatnikov
2020-03-24 15:31 ` Mathieu Poirier
2020-03-26 14:10 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).