public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu@amd.com>
To: Philip Rakity <prakity@marvell.com>
Cc: zhangfei gao <zhangfei.gao@gmail.com>,
	"Nath, Arindam" <Arindam.Nath@amd.com>,
	Subhash Jadavani <subhashj@codeaurora.org>,
	Chris Ball <cjb@laptop.org>,
	linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci: fix retuning timer wrongly deleted in sdhci_tasklet_finish
Date: Fri, 22 Jul 2011 08:58:40 +0800	[thread overview]
Message-ID: <20110722005837.GA32049@lovegaga> (raw)
In-Reply-To: <086235A9-1100-4ABB-9D4D-B2757382BF0B@marvell.com>

Hi Philip,

On Thu, Jul 21, 2011 at 01:27:11PM -0700, Philip Rakity wrote:
> 
> Aaron,
> 
> Code is fine.
Thanks.

> Do you want to also fix the problem with suspend or should I do the patch ?
> When we are suspending we should kill the tuning timer.
Yes, that is a problem.

I've another patch to add support for re-tuning mode 2 queued for
submit which should have fixed this problem, but I didn't touch anything
if mmc_suspend_host failed, so when I submit the other patch, please
take you time to review it and let's see how we can fix the problem
altogether :-)

> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 4da6a4d..88c25e8 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2289,18 +2289,14 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
>  
>  	sdhci_disable_card_detection(host);
>  
> -	/* Disable tuning since we are suspending */
> -	if (host->version >= SDHCI_SPEC_300 && host->tuning_count &&
> -	    host->tuning_mode == SDHCI_TUNING_MODE_1) {
> -		host->flags &= ~SDHCI_NEEDS_RETUNING;
> -		mod_timer(&host->tuning_timer, jiffies +
> -			host->tuning_count * HZ);
> -	}
> -
>  	ret = mmc_suspend_host(host->mmc);
>  	if (ret)
>  		return ret;
>  
> +	/* Disable tuning since we are suspending */
> +	if (host->version >= SDHCI_SPEC_300)
> +		del_timer_sync(&host->tuning_timer);
> +
>  	free_irq(host->irq, host);
>  
>  	if (host->vmmc)
> 
> 
> 
> Philip
> 
> On Jul 21, 2011, at 3:03 AM, Aaron Lu wrote:
> 
> > On Thu, Jul 21, 2011 at 05:35:02PM +0800, zhangfei gao wrote:
> >> 
> >> Does the execute_tuning is called again?
> >> del_timer is not delete timer really, but deactivate the timer, which
> >> could be re-activated by mod_timer.
> >> So if execute_tuning is called, the mod_timer will tigger the tuning
> >> timer again.
> >> 
> > 
> > Hi zhangfei,
> > 
> > Thanks for the comment.
> > 
> > The execute_tuning will be called at two places:
> > 1 In mmc_sd_init_uhs_card, when host is initializing an UHS card,
> > and the re-tuning timer will be activated for the first time;
> > 2 When re-tuning timer expired
> > 
> > So if the re-tuning timer is deactivated in sdhci_tasklet_finish,
> > execute_tuning will have no chance of getting called again, and the
> > host will not be able to do the re-tuning anymore.
> > 
> >>>>> 
> >>>>> Signed-off-by: Aaron Lu <Aaron.Lu@amd.com>
> >>>>> ---
> >>>>>  drivers/mmc/host/sdhci.c |    3 ---
> >>>>>  1 files changed, 0 insertions(+), 3 deletions(-)
> >>>>> 
> >>>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> >>>>> index 91d9892..6250bac 100644
> >>>>> --- a/drivers/mmc/host/sdhci.c
> >>>>> +++ b/drivers/mmc/host/sdhci.c
> >>>>> @@ -1863,9 +1863,6 @@ static void sdhci_tasklet_finish(unsigned long
> >>>>> param)
> >>>>> 
> >>>>>     del_timer(&host->timer);
> >>>>> 
> >>>>> -   if (host->version >= SDHCI_SPEC_300)
> >>>>> -           del_timer(&host->tuning_timer);
> >>>>> -
> >>>>>     mrq = host->mrq;
> >>>>> 
> >>>>>     /*
> >>>>> --
> >>>>> 1.7.1
> >>>> 
> >>>> 
> >>> 
> >>> 
> >> 
> > 
> 
> 


  reply	other threads:[~2011-07-22  1:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11  5:27 [PATCH] mmc: sdhci: fix retuning timer wrongly deleted in sdhci_tasklet_finish Aaron Lu
2011-07-15  6:51 ` Nath, Arindam
2011-07-21  5:23   ` Aaron Lu
2011-07-21  9:35     ` zhangfei gao
2011-07-21 10:03       ` Aaron Lu
2011-07-21 20:27         ` Philip Rakity
2011-07-22  0:58           ` Aaron Lu [this message]
2011-07-22 10:21         ` zhangfei gao
2011-07-27  9:15           ` Aaron Lu
2011-07-27 14:56             ` Philip Rakity
2011-07-28 22:28 ` Chris Ball

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=20110722005837.GA32049@lovegaga \
    --to=aaron.lu@amd.com \
    --cc=Arindam.Nath@amd.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=prakity@marvell.com \
    --cc=subhashj@codeaurora.org \
    --cc=zhangfei.gao@gmail.com \
    /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