* [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API
@ 2023-07-10 10:08 Andy Shevchenko
2023-07-10 10:08 ` [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-07-10 10:08 UTC (permalink / raw)
To: Jakub Kicinski, netdev, linux-kernel
Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Christian Brauner,
Andy Shevchenko
We have for some time the assign_bit() API to replace open coded
if (foo)
set_bit(n, bar);
else
clear_bit(n, bar);
Use this API in the code. No functional change intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
net/core/dev.c | 8 ++------
net/core/sock.c | 15 +++------------
2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 69a3e544676c..d6e1b786c5c5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6316,12 +6316,8 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
* softirq mode will happen in the next round of napi_schedule().
* This should not cause hiccups/stalls to the live traffic.
*/
- list_for_each_entry(napi, &dev->napi_list, dev_list) {
- if (threaded)
- set_bit(NAPI_STATE_THREADED, &napi->state);
- else
- clear_bit(NAPI_STATE_THREADED, &napi->state);
- }
+ list_for_each_entry(napi, &dev->napi_list, dev_list)
+ assign_bit(NAPI_STATE_THREADED, &napi->state, threaded);
return err;
}
diff --git a/net/core/sock.c b/net/core/sock.c
index 9370fd50aa2c..ab1e8d1bd5a1 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1244,17 +1244,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
break;
case SO_PASSCRED:
- if (valbool)
- set_bit(SOCK_PASSCRED, &sock->flags);
- else
- clear_bit(SOCK_PASSCRED, &sock->flags);
+ assign_bit(SOCK_PASSCRED, &sock->flags, valbool);
break;
case SO_PASSPIDFD:
- if (valbool)
- set_bit(SOCK_PASSPIDFD, &sock->flags);
- else
- clear_bit(SOCK_PASSPIDFD, &sock->flags);
+ assign_bit(SOCK_PASSPIDFD, &sock->flags, valbool);
break;
case SO_TIMESTAMP_OLD:
@@ -1358,10 +1352,7 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
break;
case SO_PASSSEC:
- if (valbool)
- set_bit(SOCK_PASSSEC, &sock->flags);
- else
- clear_bit(SOCK_PASSSEC, &sock->flags);
+ assign_bit(SOCK_PASSSEC, &sock->flags, valbool);
break;
case SO_MARK:
if (!sockopt_ns_capable(sock_net(sk)->user_ns, CAP_NET_RAW) &&
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API
2023-07-10 10:08 [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Andy Shevchenko
@ 2023-07-10 10:08 ` Andy Shevchenko
2023-07-10 14:05 ` Alexander Lobakin
2023-07-10 14:05 ` [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Alexander Lobakin
2023-07-11 11:00 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2023-07-10 10:08 UTC (permalink / raw)
To: Jakub Kicinski, netdev, linux-kernel
Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Christian Brauner,
Andy Shevchenko
We have for some time the __assign_bit() API to replace open coded
if (foo)
__set_bit(n, bar);
else
__clear_bit(n, bar);
Use this API in the code. No functional change intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
net/netlink/af_netlink.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d81e7a43944c..81e4b802f3f9 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1630,10 +1630,7 @@ static void netlink_update_socket_mc(struct netlink_sock *nlk,
old = test_bit(group - 1, nlk->groups);
subscriptions = nlk->subscriptions - old + new;
- if (new)
- __set_bit(group - 1, nlk->groups);
- else
- __clear_bit(group - 1, nlk->groups);
+ __assign_bit(group - 1, nlk->groups, new);
netlink_update_subscriptions(&nlk->sk, subscriptions);
netlink_update_listeners(&nlk->sk);
}
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API
2023-07-10 10:08 [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Andy Shevchenko
2023-07-10 10:08 ` [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API Andy Shevchenko
@ 2023-07-10 14:05 ` Alexander Lobakin
2023-07-11 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2023-07-10 14:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jakub Kicinski, netdev, linux-kernel, David S. Miller,
Eric Dumazet, Paolo Abeni, Christian Brauner
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Mon, 10 Jul 2023 13:08:29 +0300
> We have for some time the assign_bit() API to replace open coded
>
> if (foo)
> set_bit(n, bar);
> else
> clear_bit(n, bar);
>
> Use this API in the code. No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Thanks,
Olek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API
2023-07-10 10:08 ` [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API Andy Shevchenko
@ 2023-07-10 14:05 ` Alexander Lobakin
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2023-07-10 14:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jakub Kicinski, netdev, linux-kernel, David S. Miller,
Eric Dumazet, Paolo Abeni, Christian Brauner
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Mon, 10 Jul 2023 13:08:30 +0300
> We have for some time the __assign_bit() API to replace open coded
>
> if (foo)
> __set_bit(n, bar);
> else
> __clear_bit(n, bar);
>
> Use this API in the code. No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Thanks,
Olek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API
2023-07-10 10:08 [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Andy Shevchenko
2023-07-10 10:08 ` [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API Andy Shevchenko
2023-07-10 14:05 ` [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Alexander Lobakin
@ 2023-07-11 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-11 11:00 UTC (permalink / raw)
To: Andy Shevchenko
Cc: kuba, netdev, linux-kernel, davem, edumazet, pabeni, brauner
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 10 Jul 2023 13:08:29 +0300 you wrote:
> We have for some time the assign_bit() API to replace open coded
>
> if (foo)
> set_bit(n, bar);
> else
> clear_bit(n, bar);
>
> [...]
Here is the summary with links:
- [net-next,resend,v1,1/2] net/core: Make use of assign_bit() API
https://git.kernel.org/netdev/net-next/c/274c4a6d529c
- [net-next,resend,v1,2/2] netlink: Make use of __assign_bit() API
https://git.kernel.org/netdev/net-next/c/b8e39b38487e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-11 11:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-10 10:08 [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Andy Shevchenko
2023-07-10 10:08 ` [PATCH net-next][resend v1 2/2] netlink: Make use of __assign_bit() API Andy Shevchenko
2023-07-10 14:05 ` Alexander Lobakin
2023-07-10 14:05 ` [PATCH net-next][resend v1 1/2] net/core: Make use of assign_bit() API Alexander Lobakin
2023-07-11 11:00 ` patchwork-bot+netdevbpf
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).