Message ID | 20240902131123.3007226-1-lihongbo22@huawei.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Mikulas Patocka |
Headers | show |
Series | [-next] dm: Make use of __assign_bit() API | expand |
On 02/09/24 09:11PM, Hongbo Li 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); > >Use this API to simplify the code. No functional change >intended. > >Signed-off-by: Hongbo Li <lihongbo22@huawei.com> >--- Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com>
diff --git a/drivers/md/dm-clone-metadata.c b/drivers/md/dm-clone-metadata.c index 2db84cd2202b..14c5c28d938b 100644 --- a/drivers/md/dm-clone-metadata.c +++ b/drivers/md/dm-clone-metadata.c @@ -530,10 +530,7 @@ static int __load_bitset_in_core(struct dm_clone_metadata *cmd) return r; for (i = 0; ; i++) { - if (dm_bitset_cursor_get_value(&c)) - __set_bit(i, cmd->region_map); - else - __clear_bit(i, cmd->region_map); + __assign_bit(i, cmd->region_map, dm_bitset_cursor_get_value(&c)); if (i >= (cmd->nr_regions - 1)) break;
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 to simplify the code. No functional change intended. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> --- drivers/md/dm-clone-metadata.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)