[PATCH] mmc: use assign_bit() where applicable

Aubin Constans aubin.constans at microchip.com
Fri Sep 18 11:22:54 PDT 2026


On 18/09/2026 16:18, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan at nxp.com>
> 
> 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.
> 
> Done with Coccinelle semantic patch and manual fixups.
> 
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>   drivers/mmc/host/atmel-mci.c | 5 +----

Acked-by: Aubin Constans <aubin.constans at microchip.com>

>   drivers/mmc/host/ushc.c      | 5 +----
>   2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 8f4df250a77a..98933be5f174 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -1677,10 +1677,7 @@ static void atmci_detect_change(struct timer_list *t)
> 
>                  spin_lock(&host->lock);
> 
> -               if (!present)
> -                       clear_bit(ATMCI_CARD_PRESENT, &slot->flags);
> -               else
> -                       set_bit(ATMCI_CARD_PRESENT, &slot->flags);
> +               assign_bit(ATMCI_CARD_PRESENT, &slot->flags, present);
> 
>                  /* Clean up queue if present */
>                  mrq = slot->mrq;
> diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c
> index 7e8af5a06ac9..410e5bb62752 100644
> --- a/drivers/mmc/host/ushc.c
> +++ b/drivers/mmc/host/ushc.c
> @@ -388,10 +388,7 @@ static void ushc_enable_sdio_irq(struct mmc_host *mmc, int enable)
>   {
>          struct ushc_data *ushc = mmc_priv(mmc);
> 
> -       if (enable)
> -               set_bit(INT_EN, &ushc->flags);
> -       else
> -               clear_bit(INT_EN, &ushc->flags);
> +       assign_bit(INT_EN, &ushc->flags, enable);
>   }
> 
>   static void ushc_clean_up(struct ushc_data *ushc)
> --
> 2.51.0
> 




More information about the linux-arm-kernel mailing list