[v3,1/2] i2c: designware: Print clock freq on invalid clock freq error

Message ID 20170713134502.10816-1-hdegoede@redhat.com
State Accepted
Headers show

Commit Message

Hans de Goede July 13, 2017, 1:45 p.m.
When we refuse to probe due to an invalid clock frequency, log
the frequency which is causing this error.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Also fix the message missing a \n at the end
Changes in v3:
-Rebase on latest upstream master (adjust for s/r/ret/)
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko July 16, 2017, 2:02 p.m. | #1
On Thu, 2017-07-13 at 15:45 +0200, Hans de Goede wrote:
> When we refuse to probe due to an invalid clock frequency, log
> the frequency which is causing this error.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> ---
> Changes in v2:
> -Also fix the message missing a \n at the end
> Changes in v3:
> -Rebase on latest upstream master (adjust for s/r/ret/)
> ---
>  drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 2ea6d0d25a01..d139b156f9c9 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -319,7 +319,8 @@ static int dw_i2c_plat_probe(struct
> platform_device *pdev)
>  	if (dev->clk_freq != 100000 && dev->clk_freq != 400000
>  	    && dev->clk_freq != 1000000 && dev->clk_freq != 3400000)
> {
>  		dev_err(&pdev->dev,
> -			"Only 100kHz, 400kHz, 1MHz and 3.4MHz
> supported");
> +			"%d Hz is unsupported, only 100kHz, 400kHz,
> 1MHz and 3.4MHz are supported\n",
> +			dev->clk_freq);
>  		ret = -EINVAL;
>  		goto exit_reset;
>  	}
Wolfram Sang July 31, 2017, 1:56 p.m. | #2
On Thu, Jul 13, 2017 at 03:45:01PM +0200, Hans de Goede wrote:
> When we refuse to probe due to an invalid clock frequency, log
> the frequency which is causing this error.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied to for-current, thanks!

Patch

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 2ea6d0d25a01..d139b156f9c9 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -319,7 +319,8 @@  static int dw_i2c_plat_probe(struct platform_device *pdev)
 	if (dev->clk_freq != 100000 && dev->clk_freq != 400000
 	    && dev->clk_freq != 1000000 && dev->clk_freq != 3400000) {
 		dev_err(&pdev->dev,
-			"Only 100kHz, 400kHz, 1MHz and 3.4MHz supported");
+			"%d Hz is unsupported, only 100kHz, 400kHz, 1MHz and 3.4MHz are supported\n",
+			dev->clk_freq);
 		ret = -EINVAL;
 		goto exit_reset;
 	}