summaryrefslogtreecommitdiff
path: root/drivers/cpuidle/cpuidle-psci.h
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2020-07-07 15:58:02 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-07-29 19:38:30 +0300
commit166bf83529c47ddcd4854ff2047f4f980dc492c8 (patch)
treec1091d91601801ef65bd7ceca83397acec194520 /drivers/cpuidle/cpuidle-psci.h
parent4b072cd6ace3fcc5fd0688980a74592a7ddee5e5 (diff)
downloadlinux-166bf83529c47ddcd4854ff2047f4f980dc492c8.tar.xz
cpuidle: psci: Fix error path via converting to a platform driver
The current error paths for the cpuidle-psci driver, may leak memory or possibly leave CPU devices attached to their PM domains. These are quite harmless issues, but still deserves to be taken care of. Although, rather than fixing them by keeping track of allocations that needs to be freed, which tends to become a bit messy, let's convert into a platform driver. In this way, it gets easier to fix the memory leaks as we can rely on the devm_* functions. Moreover, converting to a platform driver also enables support for deferred probe, which subsequent changes takes benefit from. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/cpuidle-psci.h')
-rw-r--r--drivers/cpuidle/cpuidle-psci.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/cpuidle/cpuidle-psci.h b/drivers/cpuidle/cpuidle-psci.h
index ac8170684d4f..d8e925e84c27 100644
--- a/drivers/cpuidle/cpuidle-psci.h
+++ b/drivers/cpuidle/cpuidle-psci.h
@@ -3,15 +3,18 @@
#ifndef __CPUIDLE_PSCI_H
#define __CPUIDLE_PSCI_H
+struct device;
struct device_node;
void psci_set_domain_state(u32 state);
-int __init psci_dt_parse_state_node(struct device_node *np, u32 *state);
+int psci_dt_parse_state_node(struct device_node *np, u32 *state);
#ifdef CONFIG_ARM_PSCI_CPUIDLE_DOMAIN
-struct device __init *psci_dt_attach_cpu(int cpu);
+struct device *psci_dt_attach_cpu(int cpu);
+void psci_dt_detach_cpu(struct device *dev);
#else
-static inline struct device __init *psci_dt_attach_cpu(int cpu) { return NULL; }
+static inline struct device *psci_dt_attach_cpu(int cpu) { return NULL; }
+static inline void psci_dt_detach_cpu(struct device *dev) { }
#endif
#endif /* __CPUIDLE_PSCI_H */