LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock
@ 2018-05-08 7:12 Jia-Ju Bai
2018-05-08 8:08 ` Johannes Thumshirn
2018-05-08 14:48 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2018-05-08 7:12 UTC (permalink / raw)
To: morbidrsa, wim, linux; +Cc: linux-watchdog, linux-kernel, Jia-Ju Bai
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>
---
drivers/watchdog/mena21_wdt.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c
index 25d5d2b8cfbe..0be7f50e8ff9 100644
--- a/drivers/watchdog/mena21_wdt.c
+++ b/drivers/watchdog/mena21_wdt.c
@@ -31,7 +31,6 @@ enum a21_wdt_gpios {
struct a21_wdt_drv {
struct watchdog_device wdt;
- struct mutex lock;
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);
- mutex_lock(&drv->lock);
-
gpio_set_value(drv->gpios[GPIO_WD_ENAB], 1);
- mutex_unlock(&drv->lock);
-
return 0;
}
@@ -68,12 +63,8 @@ static int a21_wdt_stop(struct watchdog_device *wdt)
{
struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
- mutex_lock(&drv->lock);
-
gpio_set_value(drv->gpios[GPIO_WD_ENAB], 0);
- mutex_unlock(&drv->lock);
-
return 0;
}
@@ -81,14 +72,10 @@ static int a21_wdt_ping(struct watchdog_device *wdt)
{
struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
- mutex_lock(&drv->lock);
-
gpio_set_value(drv->gpios[GPIO_WD_TRIG], 0);
ndelay(10);
gpio_set_value(drv->gpios[GPIO_WD_TRIG], 1);
- mutex_unlock(&drv->lock);
-
return 0;
}
@@ -108,8 +95,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
return -EINVAL;
}
- mutex_lock(&drv->lock);
-
if (timeout == 1)
gpio_set_value(drv->gpios[GPIO_WD_FAST], 1);
else
@@ -117,8 +102,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
wdt->timeout = timeout;
- mutex_unlock(&drv->lock);
-
return 0;
}
@@ -191,7 +174,6 @@ static int a21_wdt_probe(struct platform_device *pdev)
return ret;
}
- mutex_init(&drv->lock);
watchdog_init_timeout(&a21_wdt, 30, &pdev->dev);
watchdog_set_nowayout(&a21_wdt, nowayout);
watchdog_set_drvdata(&a21_wdt, drv);
--
2.17.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock
2018-05-08 7:12 [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock Jia-Ju Bai
@ 2018-05-08 8:08 ` Johannes Thumshirn
2018-05-08 14:48 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2018-05-08 8:08 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: wim, linux, linux-watchdog, linux-kernel
Looks good,
Reviewed-by: Johannes Thumshirn <jth@kernel.org>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock
2018-05-08 7:12 [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock Jia-Ju Bai
2018-05-08 8:08 ` Johannes Thumshirn
@ 2018-05-08 14:48 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2018-05-08 14:48 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: morbidrsa, wim, linux-watchdog, linux-kernel
On Tue, May 08, 2018 at 03:12:06PM +0800, Jia-Ju Bai wrote:
> 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: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/mena21_wdt.c | 18 ------------------
> 1 file changed, 18 deletions(-)
>
> diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c
> index 25d5d2b8cfbe..0be7f50e8ff9 100644
> --- a/drivers/watchdog/mena21_wdt.c
> +++ b/drivers/watchdog/mena21_wdt.c
> @@ -31,7 +31,6 @@ enum a21_wdt_gpios {
>
> struct a21_wdt_drv {
> struct watchdog_device wdt;
> - struct mutex lock;
> 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);
>
> - mutex_lock(&drv->lock);
> -
> gpio_set_value(drv->gpios[GPIO_WD_ENAB], 1);
>
> - mutex_unlock(&drv->lock);
> -
> return 0;
> }
>
> @@ -68,12 +63,8 @@ static int a21_wdt_stop(struct watchdog_device *wdt)
> {
> struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
>
> - mutex_lock(&drv->lock);
> -
> gpio_set_value(drv->gpios[GPIO_WD_ENAB], 0);
>
> - mutex_unlock(&drv->lock);
> -
> return 0;
> }
>
> @@ -81,14 +72,10 @@ static int a21_wdt_ping(struct watchdog_device *wdt)
> {
> struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
>
> - mutex_lock(&drv->lock);
> -
> gpio_set_value(drv->gpios[GPIO_WD_TRIG], 0);
> ndelay(10);
> gpio_set_value(drv->gpios[GPIO_WD_TRIG], 1);
>
> - mutex_unlock(&drv->lock);
> -
> return 0;
> }
>
> @@ -108,8 +95,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
> return -EINVAL;
> }
>
> - mutex_lock(&drv->lock);
> -
> if (timeout == 1)
> gpio_set_value(drv->gpios[GPIO_WD_FAST], 1);
> else
> @@ -117,8 +102,6 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
>
> wdt->timeout = timeout;
>
> - mutex_unlock(&drv->lock);
> -
> return 0;
> }
>
> @@ -191,7 +174,6 @@ static int a21_wdt_probe(struct platform_device *pdev)
> return ret;
> }
>
> - mutex_init(&drv->lock);
> watchdog_init_timeout(&a21_wdt, 30, &pdev->dev);
> watchdog_set_nowayout(&a21_wdt, nowayout);
> watchdog_set_drvdata(&a21_wdt, drv);
> --
> 2.17.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-08 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08 7:12 [PATCH] watchdog: mena21_wdt: Drop unnecessary mutex lock Jia-Ju Bai
2018-05-08 8:08 ` Johannes Thumshirn
2018-05-08 14:48 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).