diff mbox series

[net-next] devlink: use _BITUL() macro instead of BIT() in the UAPI header

Message ID 20201215102531.16958-1-tklauser@distanz.ch (mailing list archive)
State Accepted
Commit 75f4d4544db9fa34e1f04174f27d9f8a387be37d
Delegated to: Netdev Maintainers
Headers show
Series [net-next] devlink: use _BITUL() macro instead of BIT() in the UAPI header | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 842 this patch: 842
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 710 this patch: 710
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Tobias Klauser Dec. 15, 2020, 10:25 a.m. UTC
The BIT() macro is not available for the UAPI headers. Moreover, it can
be defined differently in user space headers. Thus, replace its usage
with the _BITUL() macro which is already used in other macro definitions
in <linux/devlink.h>.

Fixes: dc64cc7c6310 ("devlink: Add devlink reload limit option")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 include/uapi/linux/devlink.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 17, 2020, 12:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 15 Dec 2020 11:25:31 +0100 you wrote:
> The BIT() macro is not available for the UAPI headers. Moreover, it can
> be defined differently in user space headers. Thus, replace its usage
> with the _BITUL() macro which is already used in other macro definitions
> in <linux/devlink.h>.
> 
> Fixes: dc64cc7c6310 ("devlink: Add devlink reload limit option")
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> 
> [...]

Here is the summary with links:
  - [net-next] devlink: use _BITUL() macro instead of BIT() in the UAPI header
    https://git.kernel.org/netdev/net/c/75f4d4544db9

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Jacob Keller Jan. 5, 2021, 6:50 p.m. UTC | #2
On 12/15/2020 2:25 AM, Tobias Klauser wrote:
> The BIT() macro is not available for the UAPI headers. Moreover, it can
> be defined differently in user space headers. Thus, replace its usage
> with the _BITUL() macro which is already used in other macro definitions
> in <linux/devlink.h>.
> 
> Fixes: dc64cc7c6310 ("devlink: Add devlink reload limit option")
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Yep, this is correct, and we ran into this exact issue a few months ago
with the flash update parameters work. Wonder how difficult it would be
to get something like checkpatch.pl or another utility to complain about
using BIT() macros in UAPI..?

Unfortunately this is easy to overlook because the kernel side code
almost always has BIT defined, so you won't get a compilation failure
until you try to use the uapi header in a userspace program.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> ---
>  include/uapi/linux/devlink.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
> index 5203f54a2be1..cf89c318f2ac 100644
> --- a/include/uapi/linux/devlink.h
> +++ b/include/uapi/linux/devlink.h
> @@ -322,7 +322,7 @@ enum devlink_reload_limit {
>  	DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1
>  };
>  
> -#define DEVLINK_RELOAD_LIMITS_VALID_MASK (BIT(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
> +#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
>  
>  enum devlink_attr {
>  	/* don't change the order or add anything between, this is ABI! */
>
diff mbox series

Patch

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 5203f54a2be1..cf89c318f2ac 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -322,7 +322,7 @@  enum devlink_reload_limit {
 	DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1
 };
 
-#define DEVLINK_RELOAD_LIMITS_VALID_MASK (BIT(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
+#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
 
 enum devlink_attr {
 	/* don't change the order or add anything between, this is ABI! */