Subject: [PATCH 14/15] watchdog/mpcore_wdt: Add clock framework support

From: [email-masked] (Srinidhi Kasagar)
Date: Wed, 7 Mar 2012 16:47:12 +0530

On Wed, Mar 07, 2012 at 11:27:55 +0100, Viresh KUMAR wrote:
> This patch adds in clk framework support for wdt driver. If clk_get fails for
> some platform, then we continue without clk_* API's.
> 
> Signed-off-by: Viresh Kumar <[email-masked]>
> ---
>  drivers/watchdog/mpcore_wdt.c |   71 ++++++++++++++++++++++++++++++++++++-----
>  1 files changed, 63 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
> index ebd964a..9747193 100644
> --- a/drivers/watchdog/mpcore_wdt.c
> +++ b/drivers/watchdog/mpcore_wdt.c
> @@ -17,6 +17,7 @@
>   *
>   * (c) Copyright 1995    Alan Cox <[email-masked]>
>   */

[..]

> @@ -350,6 +368,28 @@ static int __devinit mpcore_wdt_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	wdt->clk = clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(wdt->clk)) {
> +		dev_warn(&pdev->dev, "Clock not found\n");
> +		wdt->clk = NULL;
> +	}
> +
> +	if (wdt->clk) {
> +		ret = clk_enable(wdt->clk);
> +		if (ret) {
> +			dev_err(&pdev->dev, "Clock enable failed\n");
> +			goto err_put_clk;
> +		}
> +	}
> +
> +	wdt->boot_status = (readl(wdt->base + TWD_WDOG_RESETSTAT) &
> +			TWD_WDOG_RESETSTAT_MASK) ? WDIOF_CARDRESET : 0;
> +

I see that patch 12/15 does this, why are you doing it here again in clock patch?

> +	mpcore_wdt_stop(wdt);
> +
> +	if (wdt->clk)
> +		clk_disable(wdt->clk);
> +
>  	/*
>  	 * Check that the margin value is within it's range;
>  	 * if not reset to the default
> @@ -368,25 +408,32 @@ static int __devinit mpcore_wdt_probe(struct platform_device *pdev)
>  		dev_printk(KERN_ERR, wdt->dev,
>  			"cannot register miscdev on minor=%d (err=%d)\n",
>  							WATCHDOG_MINOR, ret);
> -		return ret;
> +		goto err_put_clk;
>  	}
>  
> -	wdt->boot_status = (readl(wdt->base + TWD_WDOG_RESETSTAT) &
> -			TWD_WDOG_RESETSTAT_MASK) ? WDIOF_CARDRESET : 0;
> -

oh, you delete this stuff here again.

something messy in patch creation?

Srinidhi