watchdog: s3c2410: Fix build issue without EXYNOS_SNAPSHOT 85/217785/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Nov 2019 07:28:43 +0000 (16:28 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Nov 2019 07:47:37 +0000 (16:47 +0900)
The watchdog driver can be used without CONFIG_EXYNOS_SNAPSHOT,
but some s3c watchdog functions are dependent on the config.
Fix build issue without CONFIG_EXYNOS_SNAPSHOT.

Change-Id: I9f846c99fc5a7dfea95c5e4835dcf1336d8cf7e9
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/watchdog/s3c2410_wdt.c
include/linux/exynos-ss.h

index 78c88b3a6da59efb32307c039257722cb63f33cc..eba49c13c536d1b9f6bc6d1a86f98fae21502c61 100644 (file)
@@ -880,46 +880,47 @@ static int s3c2410wdt_panic_handler(struct notifier_block *nb,
        return 0;
 }
 
-inline int s3c2410wdt_set_emergency_reset(unsigned int timeout_cnt, int index)
+inline int s3c2410wdt_multistage_emergency_reset(unsigned int timeout_cnt)
 {
-       struct s3c2410_wdt *wdt = s3c_wdt[index];
        unsigned int wtdat = 0;
        unsigned int wtcnt = wtdat + timeout_cnt;
        unsigned long wtcon;
+       int index;
 
-       if (!wdt)
+       index = s3c2410wdt_get_multistage_index();
+
+       if (index < 0)
                return -ENODEV;
 
        /* emergency reset with wdt reset */
-       wtcon = readl(wdt->reg_base + S3C2410_WTCON);
-       wtcon |= S3C2410_WTCON_RSTEN | S3C2410_WTCON_ENABLE;
+       wtcon = readl(s3c_wdt[index]->reg_base + S3C2410_WTCON);
+       wtcon |= S3C2410_WTCON_INTEN | S3C2410_WTCON_ENABLE;
 
-       writel(wtdat, wdt->reg_base + S3C2410_WTDAT);
-       writel(wtcnt, wdt->reg_base + S3C2410_WTCNT);
-       writel(wtcon, wdt->reg_base + S3C2410_WTCON);
+       writel(wtdat, s3c_wdt[index]->reg_base + S3C2410_WTDAT);
+       writel(wtcnt, s3c_wdt[index]->reg_base + S3C2410_WTCNT);
+       writel(wtcon, s3c_wdt[index]->reg_base + S3C2410_WTCON);
 
        return 0;
 }
+#endif
 
-inline int s3c2410wdt_multistage_emergency_reset(unsigned int timeout_cnt)
+inline int s3c2410wdt_set_emergency_reset(unsigned int timeout_cnt, int index)
 {
+       struct s3c2410_wdt *wdt = s3c_wdt[index];
        unsigned int wtdat = 0;
        unsigned int wtcnt = wtdat + timeout_cnt;
        unsigned long wtcon;
-       int index;
-
-       index = s3c2410wdt_get_multistage_index();
 
-       if (index < 0)
+       if (!wdt)
                return -ENODEV;
 
        /* emergency reset with wdt reset */
-       wtcon = readl(s3c_wdt[index]->reg_base + S3C2410_WTCON);
-       wtcon |= S3C2410_WTCON_INTEN | S3C2410_WTCON_ENABLE;
+       wtcon = readl(wdt->reg_base + S3C2410_WTCON);
+       wtcon |= S3C2410_WTCON_RSTEN | S3C2410_WTCON_ENABLE;
 
-       writel(wtdat, s3c_wdt[index]->reg_base + S3C2410_WTDAT);
-       writel(wtcnt, s3c_wdt[index]->reg_base + S3C2410_WTCNT);
-       writel(wtcon, s3c_wdt[index]->reg_base + S3C2410_WTCON);
+       writel(wtdat, wdt->reg_base + S3C2410_WTDAT);
+       writel(wtcnt, wdt->reg_base + S3C2410_WTCNT);
+       writel(wtcon, wdt->reg_base + S3C2410_WTCON);
 
        return 0;
 }
@@ -972,7 +973,6 @@ inline void s3c2410wdt_reset_confirm(unsigned long mtime, int index)
 
        /* This function does not return. */
 }
-#endif
 
 #ifdef CONFIG_PM_SLEEP
 static int s3c2410wdt_dev_suspend(struct device *dev)
index 4a692187835b09fa47299f985a6a4447c1ddee45..f6c742609f1a267ccf676658a7f6c7608ab4a286 100644 (file)
@@ -159,31 +159,6 @@ void exynos_ss_check_crash_key(unsigned int code, int value);
 #define exynos_ss_check_crash_key(a,b) do { } while(0)
 #endif
 
-#ifdef CONFIG_S3C2410_WATCHDOG
-extern int s3c2410wdt_set_emergency_stop(int index);
-extern int s3c2410wdt_set_emergency_reset(unsigned int timeout, int index);
-extern int s3c2410wdt_keepalive_emergency(bool reset, int index);
-extern void s3c2410wdt_reset_confirm(unsigned long mtime, int index);
-#else
-
-static inline int s3c2410wdt_set_emergency_stop(int index)
-{
-       return -1;
-}
-
-static inline int s3c2410wdt_set_emergency_reset(unsigned int timeout_cnt, int index)
-{
-       return -1;
-}
-
-static inline int s3c2410wdt_keepalive_emergency(bool reset, int index)
-{
-       return -1;
-}
-
-#define s3c2410wdt_reset_confirm(a, b)         do { } while(0)
-#endif
-
 #else
 #define exynos_ss_acpm(a,b,c)          do { } while(0)
 #define exynos_ss_task(a,b)            do { } while(0)
@@ -246,6 +221,31 @@ static inline unsigned long exynos_ss_get_spare_paddr(unsigned int offset)
 }
 #endif /* CONFIG_EXYNOS_SNAPSHOT */
 
+#ifdef CONFIG_S3C2410_WATCHDOG
+extern int s3c2410wdt_set_emergency_stop(int index);
+extern int s3c2410wdt_set_emergency_reset(unsigned int timeout, int index);
+extern int s3c2410wdt_keepalive_emergency(bool reset, int index);
+extern void s3c2410wdt_reset_confirm(unsigned long mtime, int index);
+#else /* CONFIG_S3C2410_WATCHDOG */
+
+static inline int s3c2410wdt_set_emergency_stop(int index)
+{
+       return -1;
+}
+
+static inline int s3c2410wdt_set_emergency_reset(unsigned int timeout_cnt, int index)
+{
+       return -1;
+}
+
+static inline int s3c2410wdt_keepalive_emergency(bool reset, int index)
+{
+       return -1;
+}
+
+#define s3c2410wdt_reset_confirm(a, b)         do { } while(0)
+#endif  /* CONFIG_S3C2410_WATCHDOG */
+
 static inline void exynos_ss_bug_func(void) {BUG();}
 static inline void exynos_ss_spin_func(void) {do {wfi();} while(1);}