Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: tmio: comment the ERR_PTR usage in this driver
@ 2024-03-05 10:56 Wolfram Sang
  2024-03-05 10:58 ` Wolfram Sang
  2024-03-05 12:14 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfram Sang @ 2024-03-05 10:56 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Dirk Behme, Wolfram Sang, Ulf Hansson, linux-mmc, linux-kernel

It is not super obvious why the driver sometimes uses an ERR_PTR for the
current mrq. Explain why in comments.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index c253d176db69..93e912afd3ae 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -972,6 +972,7 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		return;
 	}
 
+	/* Disallow new mrqs and work handlers to run */
 	host->mrq = ERR_PTR(-EBUSY);
 
 	spin_unlock_irqrestore(&host->lock, flags);
@@ -1006,8 +1007,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 			"%s.%d: IOS interrupted: clk %u, mode %u",
 			current->comm, task_pid_nr(current),
 			ios->clock, ios->power_mode);
-	host->mrq = NULL;
 
+	/* Ready for new mrqs */
+	host->mrq = NULL;
 	host->clk_cache = ios->clock;
 
 	mutex_unlock(&host->ios_lock);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: tmio: comment the ERR_PTR usage in this driver
  2024-03-05 10:56 [PATCH] mmc: tmio: comment the ERR_PTR usage in this driver Wolfram Sang
@ 2024-03-05 10:58 ` Wolfram Sang
  2024-03-05 12:14 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2024-03-05 10:58 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Dirk Behme, Ulf Hansson, linux-mmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]


> +	/* Ready for new mrqs */
> +	host->mrq = NULL;
>  	host->clk_cache = ios->clock;

For the record: I think these two statements should be swapped. First
set the new value, then allow new mrqs. However, I want to test this
change internally before submitting it.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: tmio: comment the ERR_PTR usage in this driver
  2024-03-05 10:56 [PATCH] mmc: tmio: comment the ERR_PTR usage in this driver Wolfram Sang
  2024-03-05 10:58 ` Wolfram Sang
@ 2024-03-05 12:14 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2024-03-05 12:14 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-renesas-soc, Dirk Behme, linux-mmc, linux-kernel

On Tue, 5 Mar 2024 at 11:56, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> It is not super obvious why the driver sometimes uses an ERR_PTR for the
> current mrq. Explain why in comments.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/tmio_mmc_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index c253d176db69..93e912afd3ae 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -972,6 +972,7 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>                 return;
>         }
>
> +       /* Disallow new mrqs and work handlers to run */
>         host->mrq = ERR_PTR(-EBUSY);
>
>         spin_unlock_irqrestore(&host->lock, flags);
> @@ -1006,8 +1007,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>                         "%s.%d: IOS interrupted: clk %u, mode %u",
>                         current->comm, task_pid_nr(current),
>                         ios->clock, ios->power_mode);
> -       host->mrq = NULL;
>
> +       /* Ready for new mrqs */
> +       host->mrq = NULL;
>         host->clk_cache = ios->clock;
>
>         mutex_unlock(&host->ios_lock);
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-05 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 10:56 [PATCH] mmc: tmio: comment the ERR_PTR usage in this driver Wolfram Sang
2024-03-05 10:58 ` Wolfram Sang
2024-03-05 12:14 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox