* [PATCH] mfd: axp20x: Do not sleep in the power off handler
@ 2022-11-05 21:29 Samuel Holland
2022-11-06 22:40 ` Dmitry Osipenko
2022-11-07 9:38 ` Lee Jones
0 siblings, 2 replies; 7+ messages in thread
From: Samuel Holland @ 2022-11-05 21:29 UTC (permalink / raw)
To: Chen-Yu Tsai, Lee Jones
Cc: Samuel Holland, Dmitry Osipenko, Michał Mirosław,
Rafael J. Wysocki, Russell King (Oracle), linux-kernel
Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
function axp20x_power_off() now runs inside a RCU read-side critical
section, so it is not allowed to call msleep(). Use mdelay() instead.
Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/mfd/axp20x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 88a212a8168c..880c41fa7021 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -842,7 +842,7 @@ static void axp20x_power_off(void)
AXP20X_OFF);
/* Give capacitors etc. time to drain to avoid kernel panic msg. */
- msleep(500);
+ mdelay(500);
}
int axp20x_match_device(struct axp20x_dev *axp20x)
--
2.37.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] mfd: axp20x: Do not sleep in the power off handler
2022-11-05 21:29 [PATCH] mfd: axp20x: Do not sleep in the power off handler Samuel Holland
@ 2022-11-06 22:40 ` Dmitry Osipenko
2022-11-07 9:39 ` Lee Jones
2022-11-07 14:33 ` Samuel Holland
2022-11-07 9:38 ` Lee Jones
1 sibling, 2 replies; 7+ messages in thread
From: Dmitry Osipenko @ 2022-11-06 22:40 UTC (permalink / raw)
To: Samuel Holland, Chen-Yu Tsai, Lee Jones
Cc: Michał Mirosław, Rafael J. Wysocki,
Russell King (Oracle), linux-kernel
On 11/6/22 00:29, Samuel Holland wrote:
> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
> function axp20x_power_off() now runs inside a RCU read-side critical
> section, so it is not allowed to call msleep(). Use mdelay() instead.
>
> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>
> drivers/mfd/axp20x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 88a212a8168c..880c41fa7021 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -842,7 +842,7 @@ static void axp20x_power_off(void)
> AXP20X_OFF);
>
> /* Give capacitors etc. time to drain to avoid kernel panic msg. */
> - msleep(500);
> + mdelay(500);
> }
>
> int axp20x_match_device(struct axp20x_dev *axp20x)
ARM was doing local_irq_disable() on power-off before
do_kernel_power_off() was introduced, so this should've been incorrect
for a couple years at least. If I'm not missing anything.
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mfd: axp20x: Do not sleep in the power off handler
2022-11-06 22:40 ` Dmitry Osipenko
@ 2022-11-07 9:39 ` Lee Jones
2022-11-07 11:39 ` Dmitry Osipenko
2022-11-07 14:33 ` Samuel Holland
1 sibling, 1 reply; 7+ messages in thread
From: Lee Jones @ 2022-11-07 9:39 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Samuel Holland, Chen-Yu Tsai, Michał Mirosław,
Rafael J. Wysocki, Russell King (Oracle), linux-kernel
On Mon, 07 Nov 2022, Dmitry Osipenko wrote:
> On 11/6/22 00:29, Samuel Holland wrote:
> > Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
> > function axp20x_power_off() now runs inside a RCU read-side critical
> > section, so it is not allowed to call msleep(). Use mdelay() instead.
> >
> > Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
> > Signed-off-by: Samuel Holland <samuel@sholland.org>
> > ---
> >
> > drivers/mfd/axp20x.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> > index 88a212a8168c..880c41fa7021 100644
> > --- a/drivers/mfd/axp20x.c
> > +++ b/drivers/mfd/axp20x.c
> > @@ -842,7 +842,7 @@ static void axp20x_power_off(void)
> > AXP20X_OFF);
> >
> > /* Give capacitors etc. time to drain to avoid kernel panic msg. */
> > - msleep(500);
> > + mdelay(500);
> > }
> >
> > int axp20x_match_device(struct axp20x_dev *axp20x)
>
> ARM was doing local_irq_disable() on power-off before
> do_kernel_power_off() was introduced, so this should've been incorrect
> for a couple years at least. If I'm not missing anything.
Is that a review? Care to provide a tag?
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mfd: axp20x: Do not sleep in the power off handler
2022-11-07 9:39 ` Lee Jones
@ 2022-11-07 11:39 ` Dmitry Osipenko
2022-11-14 11:03 ` Lee Jones
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Osipenko @ 2022-11-07 11:39 UTC (permalink / raw)
To: Lee Jones
Cc: Samuel Holland, Chen-Yu Tsai, Michał Mirosław,
Rafael J. Wysocki, Russell King (Oracle), linux-kernel
On 11/7/22 12:39, Lee Jones wrote:
> On Mon, 07 Nov 2022, Dmitry Osipenko wrote:
>
>> On 11/6/22 00:29, Samuel Holland wrote:
>>> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
>>> function axp20x_power_off() now runs inside a RCU read-side critical
>>> section, so it is not allowed to call msleep(). Use mdelay() instead.
>>>
>>> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
>>> Signed-off-by: Samuel Holland <samuel@sholland.org>
>>> ---
>>>
>>> drivers/mfd/axp20x.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>>> index 88a212a8168c..880c41fa7021 100644
>>> --- a/drivers/mfd/axp20x.c
>>> +++ b/drivers/mfd/axp20x.c
>>> @@ -842,7 +842,7 @@ static void axp20x_power_off(void)
>>> AXP20X_OFF);
>>>
>>> /* Give capacitors etc. time to drain to avoid kernel panic msg. */
>>> - msleep(500);
>>> + mdelay(500);
>>> }
>>>
>>> int axp20x_match_device(struct axp20x_dev *axp20x)
>>
>> ARM was doing local_irq_disable() on power-off before
>> do_kernel_power_off() was introduced, so this should've been incorrect
>> for a couple years at least. If I'm not missing anything.
>
> Is that a review? Care to provide a tag?
It's a review and my point was that the "Fixes" tag in this patch
doesn't look correct. But this is minor comment, otherwise patch looks
okay. Hope that the relevant I2C controller driver supports atomic
transfer that are required for power-off to work.
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mfd: axp20x: Do not sleep in the power off handler
2022-11-07 11:39 ` Dmitry Osipenko
@ 2022-11-14 11:03 ` Lee Jones
0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2022-11-14 11:03 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Samuel Holland, Chen-Yu Tsai, Michał Mirosław,
Rafael J. Wysocki, Russell King (Oracle), linux-kernel
On Mon, 07 Nov 2022, Dmitry Osipenko wrote:
> On 11/7/22 12:39, Lee Jones wrote:
> > On Mon, 07 Nov 2022, Dmitry Osipenko wrote:
> >
> >> On 11/6/22 00:29, Samuel Holland wrote:
> >>> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
> >>> function axp20x_power_off() now runs inside a RCU read-side critical
> >>> section, so it is not allowed to call msleep(). Use mdelay() instead.
> >>>
> >>> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
> >>> Signed-off-by: Samuel Holland <samuel@sholland.org>
> >>> ---
> >>>
> >>> drivers/mfd/axp20x.c | 2 +-
> >>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> >>> index 88a212a8168c..880c41fa7021 100644
> >>> --- a/drivers/mfd/axp20x.c
> >>> +++ b/drivers/mfd/axp20x.c
> >>> @@ -842,7 +842,7 @@ static void axp20x_power_off(void)
> >>> AXP20X_OFF);
> >>>
> >>> /* Give capacitors etc. time to drain to avoid kernel panic msg. */
> >>> - msleep(500);
> >>> + mdelay(500);
> >>> }
> >>>
> >>> int axp20x_match_device(struct axp20x_dev *axp20x)
> >>
> >> ARM was doing local_irq_disable() on power-off before
> >> do_kernel_power_off() was introduced, so this should've been incorrect
> >> for a couple years at least. If I'm not missing anything.
> >
> > Is that a review? Care to provide a tag?
>
> It's a review and my point was that the "Fixes" tag in this patch
> doesn't look correct. But this is minor comment, otherwise patch looks
> okay. Hope that the relevant I2C controller driver supports atomic
> transfer that are required for power-off to work.
>
> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: axp20x: Do not sleep in the power off handler
2022-11-06 22:40 ` Dmitry Osipenko
2022-11-07 9:39 ` Lee Jones
@ 2022-11-07 14:33 ` Samuel Holland
1 sibling, 0 replies; 7+ messages in thread
From: Samuel Holland @ 2022-11-07 14:33 UTC (permalink / raw)
To: Dmitry Osipenko, Chen-Yu Tsai, Lee Jones
Cc: Michał Mirosław, Rafael J. Wysocki,
Russell King (Oracle), linux-kernel
On 11/6/22 16:40, Dmitry Osipenko wrote:
> On 11/6/22 00:29, Samuel Holland wrote:
>> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
>> function axp20x_power_off() now runs inside a RCU read-side critical
>> section, so it is not allowed to call msleep(). Use mdelay() instead.
>>
>> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
>> Signed-off-by: Samuel Holland <samuel@sholland.org>
>> ---
>>
>> drivers/mfd/axp20x.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index 88a212a8168c..880c41fa7021 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -842,7 +842,7 @@ static void axp20x_power_off(void)
>> AXP20X_OFF);
>>
>> /* Give capacitors etc. time to drain to avoid kernel panic msg. */
>> - msleep(500);
>> + mdelay(500);
>> }
>>
>> int axp20x_match_device(struct axp20x_dev *axp20x)
>
> ARM was doing local_irq_disable() on power-off before
> do_kernel_power_off() was introduced, so this should've been incorrect
> for a couple years at least. If I'm not missing anything.
Yes, you're right. Then the correct tag is
Fixes: 179dc63d06c5 ("mfd: axp20x: Add a 500ms delay at the end of
axp20x_power_off")
Regards,
Samuel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: axp20x: Do not sleep in the power off handler
2022-11-05 21:29 [PATCH] mfd: axp20x: Do not sleep in the power off handler Samuel Holland
2022-11-06 22:40 ` Dmitry Osipenko
@ 2022-11-07 9:38 ` Lee Jones
1 sibling, 0 replies; 7+ messages in thread
From: Lee Jones @ 2022-11-07 9:38 UTC (permalink / raw)
To: Samuel Holland
Cc: Chen-Yu Tsai, Dmitry Osipenko, Michał Mirosław,
Rafael J. Wysocki, Russell King (Oracle), linux-kernel
On Sat, 05 Nov 2022, Samuel Holland wrote:
> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
> function axp20x_power_off() now runs inside a RCU read-side critical
> section, so it is not allowed to call msleep(). Use mdelay() instead.
>
> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>
> drivers/mfd/axp20x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-14 11:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-05 21:29 [PATCH] mfd: axp20x: Do not sleep in the power off handler Samuel Holland
2022-11-06 22:40 ` Dmitry Osipenko
2022-11-07 9:39 ` Lee Jones
2022-11-07 11:39 ` Dmitry Osipenko
2022-11-14 11:03 ` Lee Jones
2022-11-07 14:33 ` Samuel Holland
2022-11-07 9:38 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox