[PATCH v2 1/2] memstick: ms_block: keep the power off during a full msb_reset()

From: Ho Jie Feng

Date: Thu Dec 03 2026 - 11:45:13 EST


Keep the power off for long enough so that the card properly
power cycles.

mspro_block already waits 10 ms when it power cycles the card to fall
back to serial mode. Move that delay to a define in memstick.h and use
it in both drivers.

Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ho Jie Feng <hjf3108@xxxxxxxxx>
---
drivers/memstick/core/ms_block.c | 3 +++
drivers/memstick/core/mspro_block.c | 2 +-
include/linux/memstick.h | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
index 151dffb636c1e..d3cae3a40dca2 100644
--- a/drivers/memstick/core/ms_block.c
+++ b/drivers/memstick/core/ms_block.c
@@ -740,6 +740,9 @@ static int msb_reset(struct msb_data *msb, bool full)

msb_invalidate_reg_window(msb);

+ /* Allow enough time for the card to fully power off */
+ msleep(MEMSTICK_POWER_OFF_DELAY_MS);
+
error = host->set_param(host,
MEMSTICK_POWER, MEMSTICK_POWER_ON);
if (error)
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 215f4c3759c41..7da1ca4c2268f 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -867,7 +867,7 @@ static int mspro_block_switch_interface(struct memstick_dev *card)
dev_name(&card->dev));
msb->system = MEMSTICK_SYS_SERIAL;
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
- msleep(10);
+ msleep(MEMSTICK_POWER_OFF_DELAY_MS);
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON);
host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL);

diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 107bdcbedf794..cec27e2372758 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -202,6 +202,8 @@ enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE };
#define MEMSTICK_POWER_OFF 0
#define MEMSTICK_POWER_ON 1

+#define MEMSTICK_POWER_OFF_DELAY_MS 10
+
#define MEMSTICK_SERIAL 0
#define MEMSTICK_PAR4 1
#define MEMSTICK_PAR8 2
--
2.56.1