diff mbox

drivers: rtc: fix s3c-rtc initialization failure without rtc source clock

Message ID 1413372446-28541-1-git-send-email-m.szyprowski@samsung.com
State Accepted
Commit eaf3a659086e1d1d85dc8fbce4007e3c9076e0b3
Headers show

Commit Message

Marek Szyprowski Oct. 15, 2014, 11:27 a.m. UTC
This patch fixes unconditional initialization failure on non-exynos3250
SoCs. Commit df9e26d093d33a097c5558aab017dd2f540ccfe5 ("rtc: s3c: add support for RTC of Exynos3250 SoC") introduced rtc source clock support,
but also added initialization failure on SoCs, which doesn't need such
clock.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/rtc/rtc-s3c.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Chanwoo Choi Oct. 16, 2014, 2:25 a.m. UTC | #1
On 10/15/2014 08:27 PM, Marek Szyprowski wrote:
> This patch fixes unconditional initialization failure on non-exynos3250
> SoCs. Commit df9e26d093d33a097c5558aab017dd2f540ccfe5 ("rtc: s3c: add support for RTC of Exynos3250 SoC") introduced rtc source clock support,
> but also added initialization failure on SoCs, which doesn't need such
> clock.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index a6b1252c9941..806072238c00 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -535,13 +535,15 @@ static int s3c_rtc_probe(struct platform_device *pdev)
>  	}
>  	clk_prepare_enable(info->rtc_clk);
>  
> -	info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
> -	if (IS_ERR(info->rtc_src_clk)) {
> -		dev_err(&pdev->dev, "failed to find rtc source clock\n");
> -		return PTR_ERR(info->rtc_src_clk);
> +	if (info->data->needs_src_clk) {
> +		info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
> +		if (IS_ERR(info->rtc_src_clk)) {
> +			dev_err(&pdev->dev,
> +				"failed to find rtc source clock\n");
> +			return PTR_ERR(info->rtc_src_clk);
> +		}
> +		clk_prepare_enable(info->rtc_src_clk);
>  	}
> -	clk_prepare_enable(info->rtc_src_clk);
> -
>  
>  	/* check to see if everything is setup correctly */
>  	if (info->data->enable)
> 

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index a6b1252c9941..806072238c00 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -535,13 +535,15 @@  static int s3c_rtc_probe(struct platform_device *pdev)
 	}
 	clk_prepare_enable(info->rtc_clk);
 
-	info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
-	if (IS_ERR(info->rtc_src_clk)) {
-		dev_err(&pdev->dev, "failed to find rtc source clock\n");
-		return PTR_ERR(info->rtc_src_clk);
+	if (info->data->needs_src_clk) {
+		info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
+		if (IS_ERR(info->rtc_src_clk)) {
+			dev_err(&pdev->dev,
+				"failed to find rtc source clock\n");
+			return PTR_ERR(info->rtc_src_clk);
+		}
+		clk_prepare_enable(info->rtc_src_clk);
 	}
-	clk_prepare_enable(info->rtc_src_clk);
-
 
 	/* check to see if everything is setup correctly */
 	if (info->data->enable)