lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250721094328.6556-2-quic_sayalil@quicinc.com>
Date: Mon, 21 Jul 2025 15:13:28 +0530
From: Sayali Lokhande <quic_sayalil@...cinc.com>
To: <ulf.hansson@...aro.org>, <wsa+renesas@...g-engineering.com>,
        <avri.altman@....com>, <adrian.hunter@...el.com>,
        <shawn.lin@...k-chips.com>
CC: <linux-mmc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH V1 1/1] mmc: sdio: Export an API to reinit the SDIO card

Some SDIO client drivers, manage external power to the SDIO card.
In such cases, the card may be power-cycled independently of the
MMC core's runtime PM state.
Currently, reinitialization of the SDIO card is tied to the runtime
PM resume path. However, if the card is powered off and on again before
the autosuspend delay expires, the runtime suspend/resume callbacks are
not triggered, leaving the card in an uninitialized state.

To address this, export sdio_reinit_card() so that client drivers can
explicitly trigger reinitialization after powering the card back on,
ensuring proper device state regardless of runtime PM behavior.

This change enables more robust handling of power-managed SDIO devices
in scenarios where runtime PM is disabled or insufficient.

Signed-off-by: Sayali Lokhande <quic_sayalil@...cinc.com>
---
 drivers/mmc/core/core.h       | 1 +
 drivers/mmc/core/sdio.c       | 2 +-
 drivers/mmc/core/sdio_io.c    | 6 ++++++
 include/linux/mmc/sdio_func.h | 2 ++
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 622085cd766f..737584fafd7a 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -147,6 +147,7 @@ static inline void mmc_claim_host(struct mmc_host *host)
 	__mmc_claim_host(host, NULL, NULL);
 }
 
+int mmc_sdio_reinit_card(struct mmc_host *host);
 int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq);
 void mmc_cqe_post_req(struct mmc_host *host, struct mmc_request *mrq);
 int mmc_cqe_recovery(struct mmc_host *host);
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 0f753367aec1..fc3dda1a67c8 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -911,7 +911,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 	return err;
 }
 
-static int mmc_sdio_reinit_card(struct mmc_host *host)
+int mmc_sdio_reinit_card(struct mmc_host *host)
 {
 	int ret;
 
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index b774bf51981d..eae2fb361ec2 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -812,3 +812,9 @@ void sdio_retune_release(struct sdio_func *func)
 	mmc_retune_release(func->card->host);
 }
 EXPORT_SYMBOL_GPL(sdio_retune_release);
+
+int sdio_reinit_card(struct mmc_host *host)
+{
+	return mmc_sdio_reinit_card(host);
+}
+EXPORT_SYMBOL_GPL(sdio_reinit_card);
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index fed1f5f4a8d3..f33d0512b6a6 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -12,6 +12,7 @@
 #include <linux/mod_devicetable.h>
 
 #include <linux/mmc/pm.h>
+#include <linux/mmc/host.h>
 
 struct mmc_card;
 struct sdio_func;
@@ -132,6 +133,7 @@ extern void sdio_release_host(struct sdio_func *func);
 
 extern int sdio_enable_func(struct sdio_func *func);
 extern int sdio_disable_func(struct sdio_func *func);
+extern int sdio_reinit_card(struct mmc_host *host);
 
 extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ