diff mbox series

[PATCH/RFC] mmc: core: disable power off notification when host is removed

Message ID 1602581312-23607-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
State New
Headers show
Series [PATCH/RFC] mmc: core: disable power off notification when host is removed | expand

Commit Message

Yoshihiro Shimoda Oct. 13, 2020, 9:28 a.m. UTC
User is possible to turn the power off after a host was removed.
So, disable the power off notification when a host is removed.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 This topic was discussed in a few month ago [1], and now I could make
 a patch for unbinding the mmc host. I'm not sure this is a correct way
 so that I marked RFC.

 [1]
  https://patchwork.kernel.org/patch/11557505/#23408537

 drivers/mmc/core/mmc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Yoshihiro Shimoda Oct. 30, 2020, 1:02 p.m. UTC | #1
Hi Ulf,

> From: Yoshihiro Shimoda, Sent: Tuesday, October 13, 2020 6:29 PM

> 

> User is possible to turn the power off after a host was removed.

> So, disable the power off notification when a host is removed.

> 

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

> ---

>  This topic was discussed in a few month ago [1], and now I could make

>  a patch for unbinding the mmc host. I'm not sure this is a correct way

>  so that I marked RFC.


I would like to drop this patch because my colleague found an issue after
he applied this patch. The issue is the following timeout happened if
we unbind a host controller right after system suspend because
the _mmc_resume() was not called.

	mmc0: Power Off Notification timed out, 100

I'll make v2 patch in next week.

Best regards,
Yoshihiro Shimoda
Ulf Hansson Oct. 30, 2020, 2:40 p.m. UTC | #2
On Fri, 30 Oct 2020 at 14:02, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
>
> Hi Ulf,
>
> > From: Yoshihiro Shimoda, Sent: Tuesday, October 13, 2020 6:29 PM
> >
> > User is possible to turn the power off after a host was removed.
> > So, disable the power off notification when a host is removed.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  This topic was discussed in a few month ago [1], and now I could make
> >  a patch for unbinding the mmc host. I'm not sure this is a correct way
> >  so that I marked RFC.
>
> I would like to drop this patch because my colleague found an issue after
> he applied this patch. The issue is the following timeout happened if
> we unbind a host controller right after system suspend because
> the _mmc_resume() was not called.

In principle we would like to run the similar operations at "remove"
as during "system suspend".

>
>         mmc0: Power Off Notification timed out, 100
>
> I'll make v2 patch in next week.

I will have a closer look at your v2, apologies for the delay in review.

Kind regards
Uffe
Yoshihiro Shimoda Nov. 2, 2020, 9:57 a.m. UTC | #3
Hi Ulf,

> From: Ulf Hansson, Sent: Friday, October 30, 2020 11:41 PM

> 

> On Fri, 30 Oct 2020 at 14:02, Yoshihiro Shimoda

> <yoshihiro.shimoda.uh@renesas.com> wrote:

> >

> > Hi Ulf,

> >

> > > From: Yoshihiro Shimoda, Sent: Tuesday, October 13, 2020 6:29 PM

> > >

> > > User is possible to turn the power off after a host was removed.

> > > So, disable the power off notification when a host is removed.

> > >

> > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

> > > ---

> > >  This topic was discussed in a few month ago [1], and now I could make

> > >  a patch for unbinding the mmc host. I'm not sure this is a correct way

> > >  so that I marked RFC.

> >

> > I would like to drop this patch because my colleague found an issue after

> > he applied this patch. The issue is the following timeout happened if

> > we unbind a host controller right after system suspend because

> > the _mmc_resume() was not called.

> 

> In principle we would like to run the similar operations at "remove"

> as during "system suspend".


Thank you for your feedback! Reusing _mmc_suspend() seems better than
my original code.

> >

> >         mmc0: Power Off Notification timed out, 100

> >

> > I'll make v2 patch in next week.

> 

> I will have a closer look at your v2, apologies for the delay in review.


No worries. I'll send v2 patch soon.

Best regards,
Yoshihiro Shimoda
diff mbox series

Patch

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index ff3063c..abc4cac 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1988,6 +1988,15 @@  static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type)
  */
 static void mmc_remove(struct mmc_host *host)
 {
+	/*
+	 * Disable power_off_notification byte in the ext_csd register
+	 */
+	if (host->card->ext_csd.rev >= 6) {
+		mmc_claim_host(host);
+		mmc_poweroff_notify(host->card, EXT_CSD_NO_POWER_NOTIFICATION);
+		mmc_release_host(host);
+	}
+
 	mmc_remove_card(host->card);
 	host->card = NULL;
 }