Commit 274c4a6d authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Paolo Abeni

net/core: Make use of assign_bit() API

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
Message-ID: <20230710100830.89936-1-andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 68433066
...@@ -6316,12 +6316,8 @@ int dev_set_threaded(struct net_device *dev, bool threaded) ...@@ -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(). * softirq mode will happen in the next round of napi_schedule().
* This should not cause hiccups/stalls to the live traffic. * This should not cause hiccups/stalls to the live traffic.
*/ */
list_for_each_entry(napi, &dev->napi_list, dev_list) { list_for_each_entry(napi, &dev->napi_list, dev_list)
if (threaded) assign_bit(NAPI_STATE_THREADED, &napi->state, threaded);
set_bit(NAPI_STATE_THREADED, &napi->state);
else
clear_bit(NAPI_STATE_THREADED, &napi->state);
}
return err; return err;
} }
......
...@@ -1244,17 +1244,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname, ...@@ -1244,17 +1244,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
break; break;
case SO_PASSCRED: case SO_PASSCRED:
if (valbool) assign_bit(SOCK_PASSCRED, &sock->flags, valbool);
set_bit(SOCK_PASSCRED, &sock->flags);
else
clear_bit(SOCK_PASSCRED, &sock->flags);
break; break;
case SO_PASSPIDFD: case SO_PASSPIDFD:
if (valbool) assign_bit(SOCK_PASSPIDFD, &sock->flags, valbool);
set_bit(SOCK_PASSPIDFD, &sock->flags);
else
clear_bit(SOCK_PASSPIDFD, &sock->flags);
break; break;
case SO_TIMESTAMP_OLD: case SO_TIMESTAMP_OLD:
...@@ -1358,10 +1352,7 @@ int sk_setsockopt(struct sock *sk, int level, int optname, ...@@ -1358,10 +1352,7 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
break; break;
case SO_PASSSEC: case SO_PASSSEC:
if (valbool) assign_bit(SOCK_PASSSEC, &sock->flags, valbool);
set_bit(SOCK_PASSSEC, &sock->flags);
else
clear_bit(SOCK_PASSSEC, &sock->flags);
break; break;
case SO_MARK: case SO_MARK:
if (!sockopt_ns_capable(sock_net(sk)->user_ns, CAP_NET_RAW) && if (!sockopt_ns_capable(sock_net(sk)->user_ns, CAP_NET_RAW) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment