Skip to content

Commit 6876eb3

Browse files
committed
Merge tag 'pm-4.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix a cpufreq regression introduced by recent changes related to the generic DT driver, an initialization time memory leak in cpuidle on ARM, a PM core bug that may cause system suspend/resume to fail on some systems, a request type validation issue in the PM QoS framework and two documentation-related issues. Specifics: - Fix a regression in cpufreq on systems using DT as the source of CPU configuration information where two different code paths attempt to create the cpufreq-dt device object (there can be only one) and fix up the "compatible" matching for some TI platforms on top of that (Viresh Kumar, Dave Gerlach). - Fix an initialization time memory leak in cpuidle on ARM which occurs if the cpuidle driver initialization fails (Stefan Wahren). - Fix a PM core function that checks whether or not there are any system suspend/resume callbacks for a device, but forgets to check legacy callbacks which then may be skipped incorrectly and the system may crash and/or the device may become unusable after a suspend-resume cycle (Rafael Wysocki). - Fix request type validation for latency tolerance PM QoS requests which may lead to unexpected behavior (Jan Schönherr). - Fix a broken link to PM documentation from a header file and a typo in a PM document (Geert Uytterhoeven, Rafael Wysocki)" * tag 'pm-4.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: ti-cpufreq: Support additional am43xx platforms ARM: cpuidle: Avoid memleak if init fail cpufreq: dt-platdev: Add some missing platforms to the blacklist PM: core: Fix device_pm_check_callbacks() PM: docs: Drop an excess character from devices.rst PM / QoS: Use the correct variable to check the QoS request type driver core: Fix link to device power management documentation
2 parents d32e5f4 + d84c97f commit 6876eb3

File tree

7 files changed

+30
-13
lines changed

7 files changed

+30
-13
lines changed

Documentation/driver-api/pm/devices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ sub-domain of the parent domain.
675675

676676
Support for power domains is provided through the :c:member:`pm_domain` field of
677677
|struct device|. This field is a pointer to an object of type
678-
|struct dev_pm_domain|, defined in :file:`include/linux/pm.h``, providing a set
678+
|struct dev_pm_domain|, defined in :file:`include/linux/pm.h`, providing a set
679679
of power management callbacks analogous to the subsystem-level and device driver
680680
callbacks that are executed for the given device during all power transitions,
681681
instead of the respective subsystem-level callbacks. Specifically, if a

drivers/base/power/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,10 +1860,13 @@ void device_pm_check_callbacks(struct device *dev)
18601860
{
18611861
spin_lock_irq(&dev->power.lock);
18621862
dev->power.no_pm_callbacks =
1863-
(!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
1864-
(!dev->class || pm_ops_is_empty(dev->class->pm)) &&
1863+
(!dev->bus || (pm_ops_is_empty(dev->bus->pm) &&
1864+
!dev->bus->suspend && !dev->bus->resume)) &&
1865+
(!dev->class || (pm_ops_is_empty(dev->class->pm) &&
1866+
!dev->class->suspend && !dev->class->resume)) &&
18651867
(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
18661868
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
1867-
(!dev->driver || pm_ops_is_empty(dev->driver->pm));
1869+
(!dev->driver || (pm_ops_is_empty(dev->driver->pm) &&
1870+
!dev->driver->suspend && !dev->driver->resume));
18681871
spin_unlock_irq(&dev->power.lock);
18691872
}

drivers/base/power/qos.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
277277
mutex_unlock(&dev_pm_qos_sysfs_mtx);
278278
}
279279

280-
static bool dev_pm_qos_invalid_request(struct device *dev,
281-
struct dev_pm_qos_request *req)
280+
static bool dev_pm_qos_invalid_req_type(struct device *dev,
281+
enum dev_pm_qos_req_type type)
282282
{
283-
return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE
284-
&& !dev->power.set_latency_tolerance);
283+
return type == DEV_PM_QOS_LATENCY_TOLERANCE &&
284+
!dev->power.set_latency_tolerance;
285285
}
286286

287287
static int __dev_pm_qos_add_request(struct device *dev,
@@ -290,7 +290,7 @@ static int __dev_pm_qos_add_request(struct device *dev,
290290
{
291291
int ret = 0;
292292

293-
if (!dev || dev_pm_qos_invalid_request(dev, req))
293+
if (!dev || !req || dev_pm_qos_invalid_req_type(dev, type))
294294
return -EINVAL;
295295

296296
if (WARN(dev_pm_qos_request_active(req),

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ static const struct of_device_id whitelist[] __initconst = {
106106
* platforms using "operating-points-v2" property.
107107
*/
108108
static const struct of_device_id blacklist[] __initconst = {
109+
{ .compatible = "calxeda,highbank", },
110+
{ .compatible = "calxeda,ecx-2000", },
111+
112+
{ .compatible = "marvell,armadaxp", },
113+
114+
{ .compatible = "nvidia,tegra124", },
115+
116+
{ .compatible = "st,stih407", },
117+
{ .compatible = "st,stih410", },
118+
119+
{ .compatible = "sigma,tango4", },
120+
109121
{ }
110122
};
111123

drivers/cpufreq/ti-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static int ti_cpufreq_setup_syscon_register(struct ti_cpufreq_data *opp_data)
190190

191191
static const struct of_device_id ti_cpufreq_of_match[] = {
192192
{ .compatible = "ti,am33xx", .data = &am3x_soc_data, },
193-
{ .compatible = "ti,am4372", .data = &am4x_soc_data, },
193+
{ .compatible = "ti,am43", .data = &am4x_soc_data, },
194194
{ .compatible = "ti,dra7", .data = &dra7_soc_data },
195195
{},
196196
};

drivers/cpuidle/cpuidle-arm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ static int __init arm_idle_init(void)
104104
ret = dt_init_idle_driver(drv, arm_idle_state_match, 1);
105105
if (ret <= 0) {
106106
ret = ret ? : -ENODEV;
107-
goto out_fail;
107+
goto init_fail;
108108
}
109109

110110
ret = cpuidle_register_driver(drv);
111111
if (ret) {
112112
pr_err("Failed to register cpuidle driver\n");
113-
goto out_fail;
113+
goto init_fail;
114114
}
115115

116116
/*
@@ -149,6 +149,8 @@ static int __init arm_idle_init(void)
149149
}
150150

151151
return 0;
152+
init_fail:
153+
kfree(drv);
152154
out_fail:
153155
while (--cpu >= 0) {
154156
dev = per_cpu(cpuidle_devices, cpu);

include/linux/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ struct dev_links_info {
838838
* @driver_data: Private pointer for driver specific info.
839839
* @links: Links to suppliers and consumers of this device.
840840
* @power: For device power management.
841-
* See Documentation/power/admin-guide/devices.rst for details.
841+
* See Documentation/driver-api/pm/devices.rst for details.
842842
* @pm_domain: Provide callbacks that are executed during system suspend,
843843
* hibernation, system resume and during runtime PM transitions
844844
* along with subsystem-level and driver-level callbacks.

0 commit comments

Comments
 (0)