Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc/tegra: pmc: Embed reboot notifier in PMC context

Instead of relying on a global variable to track the PMC context, embed
the reboot notifier into the PMC context so that the latter can be
resolved using container_of().

Signed-off-by: Thierry Reding <treding@nvidia.com>

+10 -7
+10 -7
drivers/soc/tegra/pmc.c
··· 470 470 unsigned long *wake_type_dual_edge_map; 471 471 unsigned long *wake_sw_status_map; 472 472 unsigned long *wake_cntrl_level_map; 473 + 474 + struct notifier_block reboot_notifier; 473 475 struct syscore syscore; 474 476 475 477 /* Pending wake IRQ processing */ ··· 1105 1103 return tegra_powergate_remove_clamping(id); 1106 1104 } 1107 1105 1108 - static void tegra_pmc_program_reboot_reason(const char *cmd) 1106 + static void tegra_pmc_program_reboot_reason(struct tegra_pmc *pmc, 1107 + const char *cmd) 1109 1108 { 1110 1109 u32 value; 1111 1110 ··· 1130 1127 static int tegra_pmc_reboot_notify(struct notifier_block *this, 1131 1128 unsigned long action, void *data) 1132 1129 { 1130 + struct tegra_pmc *pmc = container_of(this, struct tegra_pmc, 1131 + reboot_notifier); 1133 1132 if (action == SYS_RESTART) 1134 - tegra_pmc_program_reboot_reason(data); 1133 + tegra_pmc_program_reboot_reason(pmc, data); 1135 1134 1136 1135 return NOTIFY_DONE; 1137 1136 } 1138 - 1139 - static struct notifier_block tegra_pmc_reboot_notifier = { 1140 - .notifier_call = tegra_pmc_reboot_notify, 1141 - }; 1142 1137 1143 1138 static void tegra_pmc_restart(void) 1144 1139 { ··· 2996 2995 * CPU without resetting everything else. 2997 2996 */ 2998 2997 if (pmc->scratch) { 2998 + pmc->reboot_notifier.notifier_call = tegra_pmc_reboot_notify; 2999 + 2999 3000 err = devm_register_reboot_notifier(&pdev->dev, 3000 - &tegra_pmc_reboot_notifier); 3001 + &pmc->reboot_notifier); 3001 3002 if (err) { 3002 3003 dev_err(&pdev->dev, 3003 3004 "unable to register reboot notifier, %d\n",