Skip to contentSkip to conversation

power: reset: pwr-mlxbf: support graceful shutdown

PATCH Superseded Asmaa Mnebhi 2 participants 3 messages Apr 29, 2024 – Jun 11, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: reset: pwr-mlxbf: support graceful shutdown

Replace the low power mode with a graceful shutdown.

---
 drivers/power/reset/pwr-mlxbf.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/power/reset/pwr-mlxbf.c +3 -13
index 1775b318d0ef..4f1cd1c0018c 100644
@@ -18,7 +18,6 @@
 
 struct pwr_mlxbf {
 	struct work_struct reboot_work;
-	struct work_struct shutdown_work;
 	const char *hid;
 };
 
@@ -27,22 +26,17 @@ static void pwr_mlxbf_reboot_work(struct work_struct *work)
 	acpi_bus_generate_netlink_event("button/reboot.*", "Reboot Button", 0x80, 1);
 }
 
-static void pwr_mlxbf_shutdown_work(struct work_struct *work)
-{
-	acpi_bus_generate_netlink_event("button/power.*", "Power Button", 0x80, 1);
-}
-
 static irqreturn_t pwr_mlxbf_irq(int irq, void *ptr)
 {
 	const char *rst_pwr_hid = "MLNXBF24";
-	const char *low_pwr_hid = "MLNXBF29";
+	const char *shutdown_hid = "MLNXBF29";
 	struct pwr_mlxbf *priv = ptr;
 
 	if (!strncmp(priv->hid, rst_pwr_hid, 8))
 		schedule_work(&priv->reboot_work);
 
-	if (!strncmp(priv->hid, low_pwr_hid, 8))
-		schedule_work(&priv->shutdown_work);
+	if (!strncmp(priv->hid, shutdown_hid, 8))
+		orderly_poweroff(true);
 
 	return IRQ_HANDLED;
 }
@@ -70,10 +64,6 @@ static int pwr_mlxbf_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return dev_err_probe(dev, irq, "Error getting %s irq.\n", priv->hid);
 
-	err = devm_work_autocancel(dev, &priv->shutdown_work, pwr_mlxbf_shutdown_work);
-	if (err)
-		return err;
-
 	err = devm_work_autocancel(dev, &priv->reboot_work, pwr_mlxbf_reboot_work);
 	if (err)
 		return err;
Signature · 1 line
2.30.1
#1 lore raw

Hi,

Quoted 1 line · Asmaa Mnebhi

Replace the low power mode with a graceful shutdown.

That's a summary of what the code changes, but the commit description is missing an important information. It's not obvious why this change is needed. Especially considering the past of this driver: It started with

reset => emergency reset
low power => poweroff HID event

Then got changed to

reset => reset HID event
low power => poweroff HID event

And now is further changed to

reset => reset HID event
low power => emergency poweroff

I don't think it's sensible to continue this ping pong, so please properly describe what those IRQs are for and why further changes are needed.

Greetings,

-- Sebastian

#2 lore raw

Just sent a new patch with a description.

Thanks!
Asmaa

Quoted 36 lines

-----Original Message-----
From: Sebastian Reichel <[email protected]>
Sent: Wednesday, June 5, 2024 8:07 PM
To: Asmaa Mnebhi <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v1 1/1] power: reset: pwr-mlxbf: support graceful shutdown

Hi,

Quoted 1 line · Asmaa Mnebhi

Replace the low power mode with a graceful shutdown.

That's a summary of what the code changes, but the commit description is missing an important information. It's not obvious why this change is needed. Especially considering the past of this driver: It started with

reset => emergency reset
low power => poweroff HID event

Then got changed to

reset => reset HID event
low power => poweroff HID event

And now is further changed to

reset => reset HID event
low power => emergency poweroff

I don't think it's sensible to continue this ping pong, so please properly describe what those IRQs are for and why further changes are needed.

Greetings,

-- Sebastian