Skip to contentSkip to conversation

soc/tegra: pmc: Don't register sys-off handler for multi-socket devices

PATCH Applied Jon Hunter 2 participants 2 messages Jul 15 Tegra architecture support

lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 soc/tegra: pmc: Don't register sys-off handler for multi-socket devices

The kernel does not permit a device to register multiple sys-off handlers for non-default priority levels. Hence, for multi-socket Tegra devices, registering the sys-off handler in the Tegra PMC driver (which uses the low priority level) more than once fails.

The Tegra PMC sys-off handler is supported for all current generations of the Tegra SoC, however, it is only used as a low priority handler if everything else fails. For example, on Tegra264 the EFI reboot handler is called to restart the device. Therefore, for multi-socket devices, skip the registering of the sys-off handler to because this is not critical.

---
 drivers/soc/tegra/pmc.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/soc/tegra/pmc.c +12 -9
index f419a5395545..41ed716d5857 100644
@@ -3074,15 +3074,18 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 		}
 	}
 
-	err = devm_register_sys_off_handler(&pdev->dev,
-					    SYS_OFF_MODE_RESTART,
-					    SYS_OFF_PRIO_LOW,
-					    tegra_pmc_restart_handler,
-					    pmc);
-	if (err) {
-		dev_err(&pdev->dev, "failed to register sys-off handler: %d\n",
-			err);
-		return err;
+	if (dev_to_node(&pdev->dev) == NUMA_NO_NODE) {
+		err = devm_register_sys_off_handler(&pdev->dev,
+						    SYS_OFF_MODE_RESTART,
+						    SYS_OFF_PRIO_LOW,
+						    tegra_pmc_restart_handler,
+						    pmc);
+		if (err) {
+			dev_err(&pdev->dev,
+				"failed to register sys-off handler: %d\n",
+				err);
+			return err;
+		}
 	}
 
 	/*
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw

From: Thierry Reding <[email protected]>

Quoted 5 lines · Jon Hunter

The kernel does not permit a device to register multiple sys-off handlers for non-default priority levels. Hence, for multi-socket Tegra devices, registering the sys-off handler in the Tegra PMC driver (which uses the low priority level) more than once fails.

Quoted 8 lines

The Tegra PMC sys-off handler is supported for all current generations of the Tegra SoC, however, it is only used as a low priority handler if everything else fails. For example, on Tegra264 the EFI reboot handler is called to restart the device. Therefore, for multi-socket devices, skip the registering of the sys-off handler to because this is not critical.

[...]

Applied, thanks!

[1/1] soc/tegra: pmc: Don't register sys-off handler for multi-socket devices

      commit: 74a161d20ef60bb8db333a5203284796429ecb99

Best regards,

Signature · 1 line
Thierry Reding <[email protected]>