Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Aubin Constans <aubin.constans@microchip.com>,
	Ulf Hansson <ulfh@kernel.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	Kees Cook <kees@kernel.org>, Peng Fan <peng.fan@nxp.com>
Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: use assign_bit() where applicable
Date: Fri, 18 Sep 2026 22:18:04 +0800	[thread overview]
Message-ID: <20260918141810.3023069-1-peng.fan@oss.nxp.com> (raw)

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



             reply	other threads:[~2026-09-18 14:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 14:18 Peng Fan (OSS) [this message]
2026-09-18 18:22 ` [PATCH] mmc: use assign_bit() where applicable Aubin Constans
2026-09-29 13:34 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918141810.3023069-1-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=aubin.constans@microchip.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=kees@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=peng.fan@nxp.com \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox