Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Yangtao Li <frank.li@vivo.com>
Cc: <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Andrew Davis <afd@ti.com>
Subject: [PATCH] mmc: pwrseq: Use proper reboot notifier path
Date: Fri, 26 Jan 2024 13:01:10 -0600	[thread overview]
Message-ID: <20240126190110.148599-1-afd@ti.com> (raw)

This driver registers itself as a reboot handler, which means it claims
it can reboot the system. It does this so it is called during the system
reboot sequence. The correct way to be notified during the reboot
sequence is to register a notifier with register_reboot_notifier().
Do this here.

Note this will be called during normal reboots but not emergency reboots.
This is the expected behavior, emergency reboot means emergency, not go
do some cleanup with emmc pins.. The reboot notifiers are intentionally
not called in the emergency path for a reason and working around that by
pretending to be a reboot handler is a hack.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/mmc/core/pwrseq_emmc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
index 3b6d69cefb4eb..d5045fd1a02c1 100644
--- a/drivers/mmc/core/pwrseq_emmc.c
+++ b/drivers/mmc/core/pwrseq_emmc.c
@@ -70,14 +70,8 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev)
 		return PTR_ERR(pwrseq->reset_gpio);
 
 	if (!gpiod_cansleep(pwrseq->reset_gpio)) {
-		/*
-		 * register reset handler to ensure emmc reset also from
-		 * emergency_reboot(), priority 255 is the highest priority
-		 * so it will be executed before any system reboot handler.
-		 */
 		pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb;
-		pwrseq->reset_nb.priority = 255;
-		register_restart_handler(&pwrseq->reset_nb);
+		register_reboot_notifier(&pwrseq->reset_nb);
 	} else {
 		dev_notice(dev, "EMMC reset pin tied to a sleepy GPIO driver; reset on emergency-reboot disabled\n");
 	}
-- 
2.39.2


             reply	other threads:[~2024-01-26 19:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240126190119eucas1p28714f09cd2afe41087dcaceba9862a64@eucas1p2.samsung.com>
2024-01-26 19:01 ` Andrew Davis [this message]
2024-01-30 12:04   ` [PATCH] mmc: pwrseq: Use proper reboot notifier path Ulf Hansson
2024-02-01 16:20     ` Andrew Davis
2024-02-01 22:56       ` Ulf Hansson
2024-01-31  8:27   ` Marek Szyprowski

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=20240126190110.148599-1-afd@ti.com \
    --to=afd@ti.com \
    --cc=frank.li@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=ulf.hansson@linaro.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