Accepted, thanks. Mikulas
On Mon, 21 Sep 2026, Peng Fan (OSS) wrote: > From: Peng Fan <[email protected]> > > Convert open-coded if/else with set_bit/clear_bit to the assign_bit API. > > 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); > > Signed-off-by: Peng Fan <[email protected]> > --- > > V2: > Separate device-mapper and mraid > https://lore.kernel.org/all/[email protected]/ > > drivers/md/dm-mpath.c | 5 +---- > drivers/md/dm-zone.c | 6 ++---- > drivers/md/persistent-data/dm-bitset.c | 5 +---- > 3 files changed, 4 insertions(+), 12 deletions(-) > > diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c > index 7cb7bb6233b6..ae9318f5f21b 100644 > --- a/drivers/md/dm-mpath.c > +++ b/drivers/md/dm-mpath.c > @@ -1604,10 +1604,7 @@ static void pg_init_done(void *data, int errors) > goto out; > > if (test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { > - if (delay_retry) > - set_bit(MPATHF_PG_INIT_DELAY_RETRY, &m->flags); > - else > - clear_bit(MPATHF_PG_INIT_DELAY_RETRY, &m->flags); > + assign_bit(MPATHF_PG_INIT_DELAY_RETRY, &m->flags, delay_retry); > > if (__pg_init_all_paths(m)) > goto out; > diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c > index f29acf64429a..35916c6e490e 100644 > --- a/drivers/md/dm-zone.c > +++ b/drivers/md/dm-zone.c > @@ -447,10 +447,8 @@ void dm_finalize_zone_settings(struct dm_table *t, > struct queue_limits *lim) > struct mapped_device *md = t->md; > > if (lim->features & BLK_FEAT_ZONED) { > - if (dm_table_supports_zone_append(t)) > - clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); > - else > - set_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); > + assign_bit(DMF_EMULATE_ZONE_APPEND, &md->flags, > + !dm_table_supports_zone_append(t)); > } else { > clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); > md->disk->nr_zones = 0; > diff --git a/drivers/md/persistent-data/dm-bitset.c > b/drivers/md/persistent-data/dm-bitset.c > index 00c0a3f186b7..6680f05c25ec 100644 > --- a/drivers/md/persistent-data/dm-bitset.c > +++ b/drivers/md/persistent-data/dm-bitset.c > @@ -59,10 +59,7 @@ static int pack_bits(uint32_t index, void *value, void > *context) > if (r) > return r; > > - if (bv) > - set_bit(bit, (unsigned long *) &word); > - else > - clear_bit(bit, (unsigned long *) &word); > + assign_bit(bit, (unsigned long *)&word, bv); > } > > *((__le64 *) value) = cpu_to_le64(word); > -- > 2.51.0 >

