diff mbox series

[v2,1/4] staging: media: tegra-vde: Remove BIT() macro from UAPI header

Message ID 20190618161458.20499-5-digetx@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/4] staging: media: tegra-vde: Remove BIT() macro from UAPI header | expand

Commit Message

Dmitry Osipenko June 18, 2019, 4:14 p.m. UTC
The BIT macro isn't available in userspace. Checkpatch complains about
shifts being used instead of the macro and people are starting to send
patches without realizing that it's a UAPI header file. Hence let's
replace the BIT macro with a hex values to make everyone happy.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/staging/media/tegra-vde/uapi.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Joe Perches June 18, 2019, 6:23 p.m. UTC | #1
On Tue, 2019-06-18 at 19:14 +0300, Dmitry Osipenko wrote:
> The BIT macro isn't available in userspace. Checkpatch complains about
> shifts being used instead of the macro and people are starting to send
> patches without realizing that it's a UAPI header file. Hence let's
> replace the BIT macro with a hex values to make everyone happy.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/staging/media/tegra-vde/uapi.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/tegra-vde/uapi.h b/drivers/staging/media/tegra-vde/uapi.h
> index a0dad1ed94ef..dd3e4a8c9f7e 100644
> --- a/drivers/staging/media/tegra-vde/uapi.h
> +++ b/drivers/staging/media/tegra-vde/uapi.h
> @@ -6,8 +6,8 @@
>  #include <linux/types.h>
>  #include <asm/ioctl.h>
>  
> -#define FLAG_B_FRAME		BIT(0)
> -#define FLAG_REFERENCE		BIT(1)
> +#define FLAG_B_FRAME		0x1
> +#define FLAG_REFERENCE		0x2
>  
>  struct tegra_vde_h264_frame {
>  	__s32 y_fd;

The BIT macro is already used quite a bit in uapi headers.
I imagine all those need fixup...

$ git grep -P '\bBIT\s*\(' include/uapi
include/uapi/linux/bpf.h:#define BPF_FIB_LOOKUP_DIRECT  BIT(0)
include/uapi/linux/bpf.h:#define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
include/uapi/linux/coresight-stm.h:#define STM_FLAG_TIMESTAMPED   BIT(3)
include/uapi/linux/coresight-stm.h:#define STM_FLAG_GUARANTEED    BIT(7)
include/uapi/linux/nl80211.h: * bitmask of BIT(NL80211_BAND_*) as described in %enum
include/uapi/linux/pkt_sched.h:#define TC_ETF_DEADLINE_MODE_ON  BIT(0)
include/uapi/linux/pkt_sched.h:#define TC_ETF_OFFLOAD_ON        BIT(1)
include/uapi/linux/psci.h:#define PSCI_1_0_OS_INITIATED                 BIT(0)
include/uapi/linux/serio.h:#define SERIO_TIMEOUT        BIT(0)
include/uapi/linux/serio.h:#define SERIO_PARITY BIT(1)
include/uapi/linux/serio.h:#define SERIO_FRAME  BIT(2)
include/uapi/linux/serio.h:#define SERIO_OOB_DATA       BIT(3)
include/uapi/linux/tc_act/tc_ctinfo.h:  CTINFO_MODE_DSCP        = BIT(0),
include/uapi/linux/tc_act/tc_ctinfo.h:  CTINFO_MODE_CPMARK      = BIT(1)
Johannes Berg June 18, 2019, 6:37 p.m. UTC | #2
On Tue, 2019-06-18 at 11:23 -0700, Joe Perches wrote:
> 
> include/uapi/linux/nl80211.h: * bitmask of BIT(NL80211_BAND_*) as described in %enum
> 
> 
That's a comment :P

johannes
Joe Perches June 18, 2019, 6:44 p.m. UTC | #3
On Tue, 2019-06-18 at 20:37 +0200, Johannes Berg wrote:
> On Tue, 2019-06-18 at 11:23 -0700, Joe Perches wrote:
> > include/uapi/linux/nl80211.h: * bitmask of BIT(NL80211_BAND_*) as described in %enum
> > 
> > 
> That's a comment :P

That's true and that's nice.

It was a casual grep and the comment should
probably be improved anyway.

<insert appropriate emoji here>

cheers, Joe
diff mbox series

Patch

diff --git a/drivers/staging/media/tegra-vde/uapi.h b/drivers/staging/media/tegra-vde/uapi.h
index a0dad1ed94ef..dd3e4a8c9f7e 100644
--- a/drivers/staging/media/tegra-vde/uapi.h
+++ b/drivers/staging/media/tegra-vde/uapi.h
@@ -6,8 +6,8 @@ 
 #include <linux/types.h>
 #include <asm/ioctl.h>
 
-#define FLAG_B_FRAME		BIT(0)
-#define FLAG_REFERENCE		BIT(1)
+#define FLAG_B_FRAME		0x1
+#define FLAG_REFERENCE		0x2
 
 struct tegra_vde_h264_frame {
 	__s32 y_fd;