mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
cpuidle: psci: Avoid initializing faux device if no DT idle states are present
Commitaf5376a77e
("cpuidle: psci: Transition to the faux device interface") transitioned the PSCI cpuidle driver from using a platform device to the faux device framework. However, unlike platform devices, the faux device infrastructure logs an error when the probe function fails, even if the failure is intentional or expected. To prevent unnecessary error logs, we can skip creating the faux device entirely if there are no PSCI idle states defined in the device tree. Introduce a check for DT idle states during initialization and avoid setting up the device if none are found. This ensures cleaner logs and avoids misleading probe failure messages when PSCI idle support is intentionally not described in DT. Fixes:af5376a77e
("cpuidle: psci: Transition to the faux device interface") Reported-by: Jon Hunter <jonathanh@nvidia.com> Closes: https://lore.kernel.org/r/cf4e70e4-9fe5-4697-8744-8c12c41b5ff9@nvidia.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://patch.msgid.link/20250502140119.2578909-1-sudeep.holla@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
e80e1342ea
commit
5836ebeb4a
1 changed files with 19 additions and 0 deletions
|
@ -438,10 +438,29 @@ static struct faux_device_ops psci_cpuidle_ops = {
|
||||||
.probe = psci_cpuidle_probe,
|
.probe = psci_cpuidle_probe,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool __init dt_idle_state_present(void)
|
||||||
|
{
|
||||||
|
struct device_node *cpu_node __free(device_node);
|
||||||
|
struct device_node *state_node __free(device_node);
|
||||||
|
|
||||||
|
cpu_node = of_cpu_device_node_get(cpumask_first(cpu_possible_mask));
|
||||||
|
if (!cpu_node)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
state_node = of_get_cpu_state_node(cpu_node, 0);
|
||||||
|
if (!state_node)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !!of_match_node(psci_idle_state_match, state_node);
|
||||||
|
}
|
||||||
|
|
||||||
static int __init psci_idle_init(void)
|
static int __init psci_idle_init(void)
|
||||||
{
|
{
|
||||||
struct faux_device *fdev;
|
struct faux_device *fdev;
|
||||||
|
|
||||||
|
if (!dt_idle_state_present())
|
||||||
|
return 0;
|
||||||
|
|
||||||
fdev = faux_device_create("psci-cpuidle", NULL, &psci_cpuidle_ops);
|
fdev = faux_device_create("psci-cpuidle", NULL, &psci_cpuidle_ops);
|
||||||
if (!fdev) {
|
if (!fdev) {
|
||||||
pr_err("Failed to create psci-cpuidle device\n");
|
pr_err("Failed to create psci-cpuidle device\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue