* [PATCH] watchdog: starfive: add lock annotations to fix context imbalances
@ 2023-11-22 8:51 Ben Dooks
2023-11-22 14:58 ` Guenter Roeck
2023-12-12 16:54 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2023-11-22 8:51 UTC (permalink / raw)
To: linux-watchdog; +Cc: linux, wim, samin.guo, xingyu.wu, linux-kernel, Ben Dooks
Add the necessary __acquires() and __releases() to the functions
that take and release the wdt lock to avoid the following sparse
warnings:
drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit
drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/watchdog/starfive-wdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
index 5f501b41faf9..49b38ecc092d 100644
--- a/drivers/watchdog/starfive-wdt.c
+++ b/drivers/watchdog/starfive-wdt.c
@@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
/* Write unlock-key to unlock. Write other value to lock. */
static void starfive_wdt_unlock(struct starfive_wdt *wdt)
+ __acquires(&wdt->lock)
{
spin_lock(&wdt->lock);
writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
}
static void starfive_wdt_lock(struct starfive_wdt *wdt)
+ __releases(&wdt->lock)
{
writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
spin_unlock(&wdt->lock);
--
2.37.2.352.g3c44437643
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] watchdog: starfive: add lock annotations to fix context imbalances
2023-11-22 8:51 [PATCH] watchdog: starfive: add lock annotations to fix context imbalances Ben Dooks
@ 2023-11-22 14:58 ` Guenter Roeck
2023-12-12 16:54 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2023-11-22 14:58 UTC (permalink / raw)
To: Ben Dooks, linux-watchdog; +Cc: wim, samin.guo, xingyu.wu, linux-kernel
On 11/22/23 00:51, Ben Dooks wrote:
> Add the necessary __acquires() and __releases() to the functions
> that take and release the wdt lock to avoid the following sparse
> warnings:
>
> drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit
> drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/starfive-wdt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 5f501b41faf9..49b38ecc092d 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
>
> /* Write unlock-key to unlock. Write other value to lock. */
> static void starfive_wdt_unlock(struct starfive_wdt *wdt)
> + __acquires(&wdt->lock)
> {
> spin_lock(&wdt->lock);
> writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
> }
>
> static void starfive_wdt_lock(struct starfive_wdt *wdt)
> + __releases(&wdt->lock)
> {
> writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
> spin_unlock(&wdt->lock);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] watchdog: starfive: add lock annotations to fix context imbalances
2023-11-22 8:51 [PATCH] watchdog: starfive: add lock annotations to fix context imbalances Ben Dooks
2023-11-22 14:58 ` Guenter Roeck
@ 2023-12-12 16:54 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2023-12-12 16:54 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-watchdog, wim, samin.guo, xingyu.wu, linux-kernel
On Wed, Nov 22, 2023 at 08:51:18AM +0000, Ben Dooks wrote:
> Add the necessary __acquires() and __releases() to the functions
> that take and release the wdt lock to avoid the following sparse
> warnings:
>
> drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit
> drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/starfive-wdt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 5f501b41faf9..49b38ecc092d 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
>
> /* Write unlock-key to unlock. Write other value to lock. */
> static void starfive_wdt_unlock(struct starfive_wdt *wdt)
> + __acquires(&wdt->lock)
> {
> spin_lock(&wdt->lock);
> writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
> }
>
> static void starfive_wdt_lock(struct starfive_wdt *wdt)
> + __releases(&wdt->lock)
> {
> writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
> spin_unlock(&wdt->lock);
> --
> 2.37.2.352.g3c44437643
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-12 16:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 8:51 [PATCH] watchdog: starfive: add lock annotations to fix context imbalances Ben Dooks
2023-11-22 14:58 ` Guenter Roeck
2023-12-12 16:54 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox