[COMMON] watchdog: s3c2410_wdt: Change to get clock freq
authorChangki Kim <changki.kim@samsung.com>
Tue, 17 Jan 2017 01:29:24 +0000 (10:29 +0900)
committerJaehyoung Choi <jkkkkk.choi@samsung.com>
Wed, 9 May 2018 11:27:47 +0000 (20:27 +0900)
If cpu lockup is occured mutex lock in clk funtion,
watchdog may not start in urgent situations because of clk funtion.

Change-Id: Idf935d72afd521cd5586d67eceacef968a672c5f
Signed-off-by: Changki Kim <changki.kim@samsung.com>
drivers/watchdog/s3c2410_wdt.c

index cfe098cef13c15a06063f96114ad7c6af18f42e4..7d31b7818a3fb606067e9575e87c39bbbd2712cd 100644 (file)
@@ -126,6 +126,7 @@ struct s3c2410_wdt {
        spinlock_t              lock;
        unsigned long           wtcon_save;
        unsigned long           wtdat_save;
+       unsigned long           freq;
        struct watchdog_device  wdt_device;
        struct notifier_block   freq_transition;
        const struct s3c2410_wdt_variant *drv_data;
@@ -355,7 +356,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd,
                                    unsigned int timeout)
 {
        struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd);
-       unsigned long freq = clk_get_rate(wdt->rate_clock);
+       unsigned long freq = wdt->freq;
        unsigned int count;
        unsigned int divisor = 1;
        unsigned long wtcon;
@@ -693,6 +694,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
                ret = PTR_ERR(wdt->rate_clock);
                goto err;
        }
+       wdt->freq = clk_get_rate(wdt->rate_clock);
 
        wdt->gate_clock = devm_clk_get(dev, "gate_watchdog");
        if (IS_ERR(wdt->gate_clock)) {