diff mbox series

[-next] netlink: Use the BITS_PER_LONG macro

Message ID 20240902111052.2686366-1-ruanjinjie@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [-next] netlink: Use the BITS_PER_LONG macro | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 19 this patch: 19
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-04--15-00 (tests: 718)

Commit Message

Jinjie Ruan Sept. 2, 2024, 11:10 a.m. UTC
sizeof(unsigned long) * 8 is the number of bits in an unsigned long
variable, replace it with BITS_PER_LONG macro to make it simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 net/netlink/af_netlink.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Sept. 3, 2024, 1:39 a.m. UTC | #1
On Mon, 2 Sep 2024 19:10:52 +0800 Jinjie Ruan wrote:
> sizeof(unsigned long) * 8 is the number of bits in an unsigned long
> variable, replace it with BITS_PER_LONG macro to make it simpler.

Does coccicheck catch such cases?
Jinjie Ruan Sept. 3, 2024, 2:06 a.m. UTC | #2
On 2024/9/3 9:39, Jakub Kicinski wrote:
> On Mon, 2 Sep 2024 19:10:52 +0800 Jinjie Ruan wrote:
>> sizeof(unsigned long) * 8 is the number of bits in an unsigned long
>> variable, replace it with BITS_PER_LONG macro to make it simpler.
> 
> Does coccicheck catch such cases?

Yes
Jakub Kicinski Sept. 3, 2024, 4:12 p.m. UTC | #3
On Tue, 3 Sep 2024 10:06:02 +0800 Jinjie Ruan wrote:
> > Does coccicheck catch such cases?  
> 
> Yes

which script?
diff mbox series

Patch

diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
index 5b0e4e62ab8b..e369980e30e3 100644
--- a/net/netlink/af_netlink.h
+++ b/net/netlink/af_netlink.h
@@ -19,7 +19,7 @@  enum {
 	NETLINK_F_STRICT_CHK,
 };
 
-#define NLGRPSZ(x)	(ALIGN(x, sizeof(unsigned long) * 8) / 8)
+#define NLGRPSZ(x)	(ALIGN(x, BITS_PER_LONG) / 8)
 #define NLGRPLONGS(x)	(NLGRPSZ(x)/sizeof(unsigned long))
 
 struct netlink_sock {