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: Pass PMC context via sys-off callback data

To avoid relying on global variables, use the sys-off callback data to
store a reference to the PMC context structure.

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

+11 -5
+11 -5
drivers/soc/tegra/pmc.c
··· 1138 1138 return NOTIFY_DONE; 1139 1139 } 1140 1140 1141 - static void tegra_pmc_restart(void) 1141 + static void tegra_pmc_restart(struct tegra_pmc *pmc) 1142 1142 { 1143 1143 u32 value; 1144 1144 ··· 1150 1150 1151 1151 static int tegra_pmc_restart_handler(struct sys_off_data *data) 1152 1152 { 1153 - tegra_pmc_restart(); 1153 + struct tegra_pmc *pmc = data->cb_data; 1154 + 1155 + tegra_pmc_restart(pmc); 1154 1156 1155 1157 return NOTIFY_DONE; 1156 1158 } 1157 1159 1158 1160 static int tegra_pmc_power_off_handler(struct sys_off_data *data) 1159 1161 { 1162 + struct tegra_pmc *pmc = data->cb_data; 1163 + 1160 1164 /* 1161 1165 * Reboot Nexus 7 into special bootloader mode if USB cable is 1162 1166 * connected in order to display battery status and power off. ··· 1170 1166 const u32 go_to_charger_mode = 0xa5a55a5a; 1171 1167 1172 1168 tegra_pmc_writel(pmc, go_to_charger_mode, PMC_SCRATCH37); 1173 - tegra_pmc_restart(); 1169 + tegra_pmc_restart(pmc); 1174 1170 } 1175 1171 1176 1172 return NOTIFY_DONE; ··· 3015 3011 err = devm_register_sys_off_handler(&pdev->dev, 3016 3012 SYS_OFF_MODE_RESTART, 3017 3013 SYS_OFF_PRIO_LOW, 3018 - tegra_pmc_restart_handler, NULL); 3014 + tegra_pmc_restart_handler, 3015 + pmc); 3019 3016 if (err) { 3020 3017 dev_err(&pdev->dev, "failed to register sys-off handler: %d\n", 3021 3018 err); ··· 3030 3025 err = devm_register_sys_off_handler(&pdev->dev, 3031 3026 SYS_OFF_MODE_POWER_OFF, 3032 3027 SYS_OFF_PRIO_FIRMWARE, 3033 - tegra_pmc_power_off_handler, NULL); 3028 + tegra_pmc_power_off_handler, 3029 + pmc); 3034 3030 if (err) { 3035 3031 dev_err(&pdev->dev, "failed to register sys-off handler: %d\n", 3036 3032 err);