diff mbox series

[RFC,2/6] mmc: renesas_sdhi: complain loudly if driver needs update

Message ID 20200129203709.30493-3-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc: tmio: move TAP handling to SDHI driver | expand

Commit Message

Wolfram Sang Jan. 29, 2020, 8:37 p.m. UTC
When the tap array in the driver is too low, this is not a warning but
an error. Also _once is not helpful, we should make sure it is
prominently in the logs. It is safe to do this because this will only
show up during SoC enablement when we a new SoCs needs more taps (if
that ever will happen).

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Note: 'unsigned long' seems big enough for a while. But, famous last
words(tm). We could handle this at runtime by reallocating a bigger
buffer. Very unsure if it is worth it, though.

 drivers/mmc/host/renesas_sdhi_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Niklas Söderlund Feb. 10, 2020, 10:47 p.m. UTC | #1
Hi Wolfram,

Thanks for your patch.

On 2020-01-29 21:37:05 +0100, Wolfram Sang wrote:
> When the tap array in the driver is too low, this is not a warning but
> an error. Also _once is not helpful, we should make sure it is
> prominently in the logs. It is safe to do this because this will only
> show up during SoC enablement when we a new SoCs needs more taps (if
> that ever will happen).
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Note: 'unsigned long' seems big enough for a while. But, famous last
> words(tm). We could handle this at runtime by reallocating a bigger
> buffer. Very unsure if it is worth it, though.

I can not tell if it's worth doing this now or not. But if it's a error 
instead of a warning it will be easier to spot if we should have done so 
;-)

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> 
>  drivers/mmc/host/renesas_sdhi_core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index b3ab66f963f8..d63aeb35bd0b 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -499,9 +499,9 @@ static int renesas_sdhi_execute_tuning(struct tmio_mmc_host *host, u32 opcode)
>  		return 0; /* Tuning is not supported */
>  
>  	if (host->tap_num * 2 >= sizeof(host->taps) * BITS_PER_BYTE) {
> -		dev_warn_once(&host->pdev->dev,
> -			"Too many taps, skipping tuning. Please consider updating size of taps field of tmio_mmc_host\n");
> -		return 0;
> +		dev_err(&host->pdev->dev,
> +			"Too many taps, please update 'taps' in tmio_mmc_host!\n");
> +		return -EINVAL;
>  	}
>  
>  	priv->doing_tune = true;
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index b3ab66f963f8..d63aeb35bd0b 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -499,9 +499,9 @@  static int renesas_sdhi_execute_tuning(struct tmio_mmc_host *host, u32 opcode)
 		return 0; /* Tuning is not supported */
 
 	if (host->tap_num * 2 >= sizeof(host->taps) * BITS_PER_BYTE) {
-		dev_warn_once(&host->pdev->dev,
-			"Too many taps, skipping tuning. Please consider updating size of taps field of tmio_mmc_host\n");
-		return 0;
+		dev_err(&host->pdev->dev,
+			"Too many taps, please update 'taps' in tmio_mmc_host!\n");
+		return -EINVAL;
 	}
 
 	priv->doing_tune = true;