* [PATCH] mmc: use assign_bit() where applicable
@ 2026-09-18 14:18 Peng Fan (OSS)
2026-09-18 18:22 ` Aubin Constans
0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2026-09-18 14:18 UTC (permalink / raw)
To: Aubin Constans, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Kees Cook, Peng Fan
Cc: linux-kernel, linux-mmc, linux-arm-kernel
From: Peng Fan <peng.fan@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@nxp.com>
---
drivers/mmc/host/atmel-mci.c | 5 +----
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: use assign_bit() where applicable
2026-09-18 14:18 [PATCH] mmc: use assign_bit() where applicable Peng Fan (OSS)
@ 2026-09-18 18:22 ` Aubin Constans
0 siblings, 0 replies; 2+ messages in thread
From: Aubin Constans @ 2026-09-18 18:22 UTC (permalink / raw)
To: Peng Fan (OSS),
Ulf Hansson, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Kees Cook, Peng Fan
Cc: linux-kernel, linux-mmc, linux-arm-kernel
On 18/09/2026 16:18, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@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@nxp.com>
> ---
> drivers/mmc/host/atmel-mci.c | 5 +----
Acked-by: Aubin Constans <aubin.constans@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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-18 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 14:18 [PATCH] mmc: use assign_bit() where applicable Peng Fan (OSS)
2026-09-18 18:22 ` Aubin Constans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®