Skip to contentSkip to conversation

mfd: axp20x: Do not sleep in the power off handler

PATCH Applied Samuel Holland 3 participants 7 messages Nov 5, 2022 – Nov 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: axp20x: Do not sleep in the power off handler

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +1 -1
index 88a212a8168c..880c41fa7021 100644
@@ -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)
Signature · 1 line
2.37.3
#1 lore raw
Quoted 16 lines · Samuel Holland

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +0 -0
index 88a212a8168c..880c41fa7021 100644

drivers/mfd/axp20x.c static void axp20x_power_off(void) · line 848

Quoted 8 lines
drivers/mfd/axp20x.c +1 -1
@@ -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.

Signature · 2 lines
Best regards,
Dmitry
maintainer
#2 lore raw
Quoted 24 lines · Dmitry Osipenko
Quoted 23 lines · Samuel Holland

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +1 -1
index 88a212a8168c..880c41fa7021 100644
@@ -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);
 }
 
Quoted 5 lines

drivers/mfd/axp20x.c static void axp20x_power_off(void) · line 848

Quoted 1 line
drivers/mfd/axp20x.c +0 -0
 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?

Signature · 1 line
Lee Jones [李琼斯]
Reviewed-by
#3 lore raw
Quoted 26 lines · Lee Jones
Quoted 24 lines · Dmitry Osipenko
Quoted 23 lines · Samuel Holland

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +1 -1
index 88a212a8168c..880c41fa7021 100644
@@ -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);
 }
 
Quoted 7 lines
Quoted 5 lines

drivers/mfd/axp20x.c static void axp20x_power_off(void) · line 848

Quoted 1 line
drivers/mfd/axp20x.c +0 -0
 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.

Signature · 2 lines
Best regards,
Dmitry
maintainer
#4 lore raw
Quoted 33 lines · Dmitry Osipenko
Quoted 32 lines · Lee Jones
Quoted 29 lines · Dmitry Osipenko
Quoted 16 lines · Samuel Holland

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +0 -0
index 88a212a8168c..880c41fa7021 100644

drivers/mfd/axp20x.c static void axp20x_power_off(void) · line 848

Quoted 8 lines
drivers/mfd/axp20x.c +1 -1
@@ -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.

Quoted 8 lines
Quoted 1 line

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.

Thanks.

Signature · 1 line
Lee Jones [李琼斯]
#5 lore raw
In reply to Dmitry Osipenko
Quoted 24 lines · Dmitry Osipenko
Quoted 23 lines · Samuel Holland

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +1 -1
index 88a212a8168c..880c41fa7021 100644
@@ -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);
 }
 
Quoted 5 lines

drivers/mfd/axp20x.c static void axp20x_power_off(void) · line 848

Quoted 1 line
drivers/mfd/axp20x.c +0 -0
 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

maintainer Applied
#6 lore raw
In reply to Samuel Holland
Quoted 10 lines · Samuel Holland

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()")

---

 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 1 line
Lee Jones [李琼斯]