From: Sungjinn Chung Date: Thu, 27 Nov 2014 13:18:15 +0000 (+0900) Subject: watchdog: s3c2410_wdt: fix spinlock inconsistent lock state warning X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bff94c24cfef00d12a0f0b389f0275e342bc396e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git watchdog: s3c2410_wdt: fix spinlock inconsistent lock state warning This patch is to fix spinlock warning. < 4>[ 204.229499] I[1: BootAnimation: 2990] ================================= < 4>[ 204.229517] I[1: BootAnimation: 2990] [ INFO: inconsistent lock state ] < 4>[ 204.229538] I[1: BootAnimation: 2990] 3.10.58-3388584-eng #1 Not tainted < 4>[ 204.229557] I[1: BootAnimation: 2990] --------------------------------- < 4>[ 204.229576] I[1: BootAnimation: 2990] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. < 4>[ 204.229597] I[1: BootAnimation: 2990] BootAnimation/2990 [HC1[1]:SC0[0]:HE0:SE1] takes: < 4>[ 204.229617] I[1: BootAnimation: 2990] (wdt_lock){?.+...}, at: [] s3c2410wdt_stop+0x1c/0x38 < 4>[ 204.229677] I[1: BootAnimation: 2990] {HARDIRQ-ON-W} state was registered at: < 4>[ 204.229696] I[1: BootAnimation: 2990] [] mark_lock+0x304/0x6e4 < 4>[ 204.229725] I[1: BootAnimation: 2990] [] __lock_acquire+0x968/0x19b8 < 4>[ 204.229751] I[1: BootAnimation: 2990] [] lock_acquire+0xf4/0x128 < 4>[ 204.229775] I[1: BootAnimation: 2990] [] _raw_spin_lock+0x38/0x50 < 4>[ 204.229802] I[1: BootAnimation: 2990] [] s3c2410wdt_stop_intclear.isra.1+0x18/0x50 < 4>[ 204.229827] I[1: BootAnimation: 2990] [] s3c2410wdt_probe+0x1f4/0x444 Change-Id: I5fa03e75f6ba68b6dc58a116d134b21b7d53550e Signed-off-by: Sungjinn Chung --- diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index cfce2b70217c..ccdff8541c57 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -253,10 +253,11 @@ static int s3c2410wdt_mask_and_disable_reset(struct s3c2410_wdt *wdt, bool mask) static int s3c2410wdt_keepalive(struct watchdog_device *wdd) { struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); + unsigned long flags; - spin_lock(&wdt->lock); + spin_lock_irqsave(&wdt->lock, flags); writel(wdt->count, wdt->reg_base + S3C2410_WTCNT); - spin_unlock(&wdt->lock); + spin_unlock_irqrestore(&wdt->lock, flags); return 0; } @@ -273,30 +274,33 @@ static void __s3c2410wdt_stop(struct s3c2410_wdt *wdt) static int s3c2410wdt_stop(struct watchdog_device *wdd) { struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); + unsigned long flags; - spin_lock(&wdt->lock); + spin_lock_irqsave(&wdt->lock, flags); __s3c2410wdt_stop(wdt); - spin_unlock(&wdt->lock); + spin_unlock_irqrestore(&wdt->lock, flags); return 0; } static int s3c2410wdt_stop_intclear(struct s3c2410_wdt *wdt) { - spin_lock(&wdt->lock); + unsigned long flags; + + spin_lock_irqsave(&wdt->lock, flags); __s3c2410wdt_stop(wdt); - writel(1, wdt->reg_base + S3C2410_WTCLRINT); - spin_unlock(&wdt->lock); + writel(1, wdt->reg_base + S3C2410_WTCLRINT); + spin_unlock_irqrestore(&wdt->lock, flags); return 0; } static int s3c2410wdt_start(struct watchdog_device *wdd) { - unsigned long wtcon; + unsigned long wtcon, flags; struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); - spin_lock(&wdt->lock); + spin_lock_irqsave(&wdt->lock, flags); __s3c2410wdt_stop(wdt); @@ -317,7 +321,7 @@ static int s3c2410wdt_start(struct watchdog_device *wdd) writel(wdt->count, wdt->reg_base + S3C2410_WTDAT); writel(wdt->count, wdt->reg_base + S3C2410_WTCNT); writel(wtcon, wdt->reg_base + S3C2410_WTCON); - spin_unlock(&wdt->lock); + spin_unlock_irqrestore(&wdt->lock, flags); return 0; }