watchdog: mena21_wdt: Drop unnecessary mutex lock

There is already a mutex in the watchdog core which serializes
calls to the various API functions.
So the mutex lock "drv->lock" is unnecessary and can be dropped.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Jia-Ju Bai 2018-05-08 15:12:06 +08:00 committed by Wim Van Sebroeck
parent b1eb8fedc0
commit 343c2302bb

View File

@ -31,7 +31,6 @@ enum a21_wdt_gpios {
struct a21_wdt_drv { struct a21_wdt_drv {
struct watchdog_device wdt; struct watchdog_device wdt;
struct mutex lock;
unsigned gpios[NUM_GPIOS]; unsigned gpios[NUM_GPIOS];
}; };
@ -55,12 +54,8 @@ static int a21_wdt_start(struct watchdog_device *wdt)
{ {
struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
mutex_lock(&drv->lock);
gpio_set_value(drv->gpios[GPIO_WD_ENAB], 1); gpio_set_value(drv->gpios[GPIO_WD_ENAB], 1);
mutex_unlock(&drv->lock);
return 0; return 0;
} }
@ -68,12 +63,8 @@ static int a21_wdt_stop(struct watchdog_device *wdt)
{ {
struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
mutex_lock(&drv->lock);
gpio_set_value(drv->gpios[GPIO_WD_ENAB], 0); gpio_set_value(drv->gpios[GPIO_WD_ENAB], 0);
mutex_unlock(&drv->lock);
return 0; return 0;
} }
@ -81,14 +72,10 @@ static int a21_wdt_ping(struct watchdog_device *wdt)
{ {
struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt); struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
mutex_lock(&drv->lock);
gpio_set_value(drv->gpios[GPIO_WD_TRIG], 0); gpio_set_value(drv->gpios[GPIO_WD_TRIG], 0);
ndelay(10); ndelay(10);
gpio_set_value(drv->gpios[GPIO_WD_TRIG], 1); gpio_set_value(drv->gpios[GPIO_WD_TRIG], 1);
mutex_unlock(&drv->lock);
return 0; return 0;
} }
@ -108,8 +95,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
return -EINVAL; return -EINVAL;
} }
mutex_lock(&drv->lock);
if (timeout == 1) if (timeout == 1)
gpio_set_value(drv->gpios[GPIO_WD_FAST], 1); gpio_set_value(drv->gpios[GPIO_WD_FAST], 1);
else else
@ -117,8 +102,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
wdt->timeout = timeout; wdt->timeout = timeout;
mutex_unlock(&drv->lock);
return 0; return 0;
} }
@ -191,7 +174,6 @@ static int a21_wdt_probe(struct platform_device *pdev)
return ret; return ret;
} }
mutex_init(&drv->lock);
watchdog_init_timeout(&a21_wdt, 30, &pdev->dev); watchdog_init_timeout(&a21_wdt, 30, &pdev->dev);
watchdog_set_nowayout(&a21_wdt, nowayout); watchdog_set_nowayout(&a21_wdt, nowayout);
watchdog_set_drvdata(&a21_wdt, drv); watchdog_set_drvdata(&a21_wdt, drv);