LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [External][PATCH] power: supply: bq2415x: fix deadlock in bq2415x_set_autotimer
@ 2021-06-21 12:14 Kezhou Li
2021-08-15 21:53 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Kezhou Li @ 2021-06-21 12:14 UTC (permalink / raw)
To: pali, sre; +Cc: linux-pm, linux-kernel, Kezhou Li
From: "Kezhou Li" <kezhou.li@tinno.com>
The bq2415x_timer_error called by bq2415x_timer_work when some error
happens, and then calls cancel_delayed_work_sync(&bq->work). Finally
this function is waiting for the work to finish but the work is
waiting for the return of the function. So it causes a deadlock.
Signed-off-by: Kezhou Li <kezhou.li@tinno.com>
---
drivers/power/supply/bq2415x_charger.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/power/supply/bq2415x_charger.c b/drivers/power/supply/bq2415x_charger.c
index 5724001..7889edb 100644
--- a/drivers/power/supply/bq2415x_charger.c
+++ b/drivers/power/supply/bq2415x_charger.c
@@ -862,8 +862,6 @@ static void bq2415x_set_autotimer(struct bq2415x_device *bq, int state)
schedule_delayed_work(&bq->work, BQ2415X_TIMER_TIMEOUT * HZ);
bq2415x_exec_command(bq, BQ2415X_TIMER_RESET);
bq->timer_error = NULL;
- } else {
- cancel_delayed_work_sync(&bq->work);
}
mutex_unlock(&bq2415x_timer_mutex);
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [External][PATCH] power: supply: bq2415x: fix deadlock in bq2415x_set_autotimer
2021-06-21 12:14 [External][PATCH] power: supply: bq2415x: fix deadlock in bq2415x_set_autotimer Kezhou Li
@ 2021-08-15 21:53 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2021-08-15 21:53 UTC (permalink / raw)
To: Kezhou Li; +Cc: pali, linux-pm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]
Hi,
On Mon, Jun 21, 2021 at 08:14:20PM +0800, Kezhou Li wrote:
> From: "Kezhou Li" <kezhou.li@tinno.com>
>
> The bq2415x_timer_error called by bq2415x_timer_work when some error
> happens, and then calls cancel_delayed_work_sync(&bq->work). Finally
> this function is waiting for the work to finish but the work is
> waiting for the return of the function. So it causes a deadlock.
>
> Signed-off-by: Kezhou Li <kezhou.li@tinno.com>
> ---
The patch is not correct, since bq2415x_sysfs_set_timer() should
call cancel_delayed_work_sync() for the "off" case.
-- Sebastian
> drivers/power/supply/bq2415x_charger.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/power/supply/bq2415x_charger.c b/drivers/power/supply/bq2415x_charger.c
> index 5724001..7889edb 100644
> --- a/drivers/power/supply/bq2415x_charger.c
> +++ b/drivers/power/supply/bq2415x_charger.c
> @@ -862,8 +862,6 @@ static void bq2415x_set_autotimer(struct bq2415x_device *bq, int state)
> schedule_delayed_work(&bq->work, BQ2415X_TIMER_TIMEOUT * HZ);
> bq2415x_exec_command(bq, BQ2415X_TIMER_RESET);
> bq->timer_error = NULL;
> - } else {
> - cancel_delayed_work_sync(&bq->work);
> }
>
> mutex_unlock(&bq2415x_timer_mutex);
> --
> 1.9.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-15 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 12:14 [External][PATCH] power: supply: bq2415x: fix deadlock in bq2415x_set_autotimer Kezhou Li
2021-08-15 21:53 ` Sebastian Reichel
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).