linux/net/6lowpan
Peng Fan ab86dbf4a6 net: protocol: use assign_bit() where applicable
Convert open-coded if/else with set_bit/clear_bit and their
non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit
API. Where a bit is toggled based on its own value, use change_bit()
instead.

Done with Coccinelle semantic patch:
    // set_bit -> clear_bit => assign_bit

    @@
    expression cond, bit, addr;
    @@

    -if (cond)
    -        set_bit(bit, addr);
    -else
    -        clear_bit(bit, addr);
    +assign_bit(bit, addr, cond);

    // clear_bit -> set_bit => assign_bit

    @@
    expression cond, bit, addr;
    @@

    -if (cond)
    -        clear_bit(bit, addr);
    -else
    -        set_bit(bit, addr);
    +assign_bit(bit, addr, !cond);

    // __set_bit -> __clear_bit => __assign_bit

    @@
    expression cond, bit, addr;
    @@

    -if (cond)
    -        __set_bit(bit, addr);
    -else
    -        __clear_bit(bit, addr);
    +__assign_bit(bit, addr, cond);

    // __clear_bit -> __set_bit => __assign_bit

    @@
    expression cond, bit, addr;
    @@

    -if (cond)
    -        __clear_bit(bit, addr);
    -else
    -        __set_bit(bit, addr);
    +__assign_bit(bit, addr, !cond);

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260920022745.3145847-1-peng.fan@oss.nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-21 17:18:54 -07:00
..
6lowpan_i.h 6lowpan: no need to check return value of debugfs_create functions 2019-07-06 12:50:01 +02:00
core.c net: fill in MODULE_DESCRIPTION()s for 6LoWPAN 2024-02-09 14:12:01 -08:00
debugfs.c net: protocol: use assign_bit() where applicable 2026-09-21 17:18:54 -07:00
iphc.c 6lowpan: fix off-by-one in multicast context address compression 2026-06-01 19:10:16 -07:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ndisc.c net: replace ND_PRINTK with dynamic debug 2025-07-10 15:27:32 -07:00
nhc_dest.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_fragment.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ghc_ext_dest.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ghc_ext_frag.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ghc_ext_hop.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ghc_ext_route.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ghc_icmpv6.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ghc_udp.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_hop.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_ipv6.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_mobility.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_routing.c net: 6lowpan: use array for find nhc id 2022-06-09 21:53:28 +02:00
nhc_udp.c net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02:00
nhc.c 6lowpan: fix NHC entry use-after-free on error path 2026-06-11 15:27:07 -07:00
nhc.h net: 6lowpan: fix mismatched comments 2026-09-02 09:03:06 +02:00