[PATCH] target: use assign_bit() where applicable

Peng Fan (OSS) posted 1 patch 5 days, 8 hours ago
drivers/target/target_core_user.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH] target: use assign_bit() where applicable
Posted by Peng Fan (OSS) 5 days, 8 hours ago
From: Peng Fan <peng.fan@nxp.com>

Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/target/target_core_user.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index edc2afd5f4ee..425ad1246a75 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -3006,10 +3006,7 @@ static ssize_t tcmu_tmr_notification_store(struct config_item *item,
 	if (val > 1)
 		return -EINVAL;
 
-	if (val)
-		set_bit(TCMU_DEV_BIT_TMR_NOTIFY, &udev->flags);
-	else
-		clear_bit(TCMU_DEV_BIT_TMR_NOTIFY, &udev->flags);
+	assign_bit(TCMU_DEV_BIT_TMR_NOTIFY, &udev->flags, val);
 	return count;
 }
 CONFIGFS_ATTR(tcmu_, tmr_notification);
-- 
2.51.0
Re: [PATCH] target: use assign_bit() where applicable
Posted by Bodo Strößer 3 days, 10 hours ago
On 19/09/2026 15:08, Peng Fan (OSS) wrote:

> From: Peng Fan <peng.fan@nxp.com>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>   drivers/target/target_core_user.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index edc2afd5f4ee..425ad1246a75 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -3006,10 +3006,7 @@ static ssize_t tcmu_tmr_notification_store(struct config_item *item,
>   	if (val > 1)
>   		return -EINVAL;
>   
> -	if (val)
> -		set_bit(TCMU_DEV_BIT_TMR_NOTIFY, &udev->flags);
> -	else
> -		clear_bit(TCMU_DEV_BIT_TMR_NOTIFY, &udev->flags);
> +	assign_bit(TCMU_DEV_BIT_TMR_NOTIFY, &udev->flags, val);
>   	return count;
>   }
>   CONFIGFS_ATTR(tcmu_, tmr_notification);
Reviewed-by: Bodo Stroesser<bostroesser@gmail.com>

Best regards,
Bodo Strößer