diff mbox series

[01/19] mmc: atmel-mci: Keep timer enabled when queuing a next request

Message ID 20200414161413.3036-2-ulf.hansson@linaro.org
State New
Headers show
Series mmc: Improve host driver's support for R1B responses | expand

Commit Message

Ulf Hansson April 14, 2020, 4:13 p.m. UTC
When atmci_request_end() is about to finish a request for one slot, there
is a possibility that there is new request queued for another slot. If this
turns out to be the case, the new request is started and the timer is
re-programmed for it.

Although, a few lines below in atmci_request_end(), this timer becomes
deleted, likely corresponding to the other recently completed request. This
looks wrong, so let's fix it.

Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

---
 drivers/mmc/host/atmel-mci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Ludovic Desroches April 17, 2020, 8:39 p.m. UTC | #1
On Tue, Apr 14, 2020 at 06:13:55PM +0200, Ulf Hansson wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> When atmci_request_end() is about to finish a request for one slot, there
> is a possibility that there is new request queued for another slot. If this
> turns out to be the case, the new request is started and the timer is
> re-programmed for it.
> 
> Although, a few lines below in atmci_request_end(), this timer becomes
> deleted, likely corresponding to the other recently completed request. This
> looks wrong, so let's fix it.
> 
> Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Nice catch.

Thanks

Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

> ---
>  drivers/mmc/host/atmel-mci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index aeaaa5314924..0472df8391b5 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -1557,6 +1557,8 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
> 
>         WARN_ON(host->cmd || host->data);
> 
> +       del_timer(&host->timer);
> +
>         /*
>          * Update the MMC clock rate if necessary. This may be
>          * necessary if set_ios() is called when a different slot is
> @@ -1583,8 +1585,6 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
>                 host->state = STATE_IDLE;
>         }
> 
> -       del_timer(&host->timer);
> -
>         spin_unlock(&host->lock);
>         mmc_request_done(prev_mmc, mrq);
>         spin_lock(&host->lock);
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index aeaaa5314924..0472df8391b5 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1557,6 +1557,8 @@  static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
 
 	WARN_ON(host->cmd || host->data);
 
+	del_timer(&host->timer);
+
 	/*
 	 * Update the MMC clock rate if necessary. This may be
 	 * necessary if set_ios() is called when a different slot is
@@ -1583,8 +1585,6 @@  static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
 		host->state = STATE_IDLE;
 	}
 
-	del_timer(&host->timer);
-
 	spin_unlock(&host->lock);
 	mmc_request_done(prev_mmc, mrq);
 	spin_lock(&host->lock);