mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ho Jie Feng <hjf3108@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
	Alex Dubov <oakad@yahoo.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ho Jie Feng <hjf3108@gmail.com>,
	stable@vger.kernel.org, Thomas Fourier <fourier.thomas@gmail.com>,
	Maoyi Xie <maoyixie.tju@gmail.com>,
	Guangshuo Li <liguangshuo@mail.sdu.edu.cn>,
	Hemanth Selam <hemanth.selam@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v2 1/2] memstick: ms_block: keep the power off during a full msb_reset()
Date: Fri,  4 Dec 2026 00:42:27 +0800	[thread overview]
Message-ID: <20261203164240.31581-2-hjf3108@gmail.com> (raw)
In-Reply-To: <20261203164240.31581-1-hjf3108@gmail.com>

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@vger.kernel.org
Signed-off-by: Ho Jie Feng <hjf3108@gmail.com>
---
 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


  reply	other threads:[~2026-12-03 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 16:42 [PATCH v2 0/2] memstick: fixes for mspro_block and ms_block Ho Jie Feng
2026-12-03 16:42 ` Ho Jie Feng [this message]
2026-12-03 16:42 ` [PATCH v2 2/2] memstick: ms_block: add the missing newline to the parallel switch error Ho Jie Feng

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=20261203164240.31581-2-hjf3108@gmail.com \
    --to=hjf3108@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=fourier.thomas@gmail.com \
    --cc=hemanth.selam@gmail.com \
    --cc=liguangshuo@mail.sdu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=maoyixie.tju@gmail.com \
    --cc=maximlevitsky@gmail.com \
    --cc=oakad@yahoo.com \
    --cc=stable@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®