linux/drivers/base
Rafael J. Wysocki 47e5abfb54 PM / core: Fix supplier device runtime PM usage counter imbalance
If a device link is added via device_link_add() by the driver of the
link's consumer device, the supplier's runtime PM usage counter is
going to be dropped by the pm_runtime_put_suppliers() call in
driver_probe_device().  However, in that case it is not incremented
unless the supplier driver is already present and the link is not
stateless.  That leads to a runtime PM usage counter imbalance for
the supplier device in a few cases.

To prevent that from happening, bump up the supplier runtime
PM usage counter in device_link_add() for all links with the
DL_FLAG_PM_RUNTIME flag set that are added at the consumer probe
time.  Use pm_runtime_get_noresume() for that as the callers of
device_link_add() who want the supplier to be resumed by it are
expected to pass DL_FLAG_RPM_ACTIVE in flags to it anyway, but
additionally resume the supplier if the link is added during
consumer driver probe to retain the existing behavior for the
callers depending on it.

Fixes: 21d5c57b37 (PM / runtime: Use device links)
Reported-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2018-06-14 10:01:52 +02:00
..
firmware_loader treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
power Merge branches 'pm-domains' and 'pm-tools' 2018-06-13 11:08:44 +02:00
regmap Merge branch 'regmap-4.17' into regmap-4.18 for the merge window 2018-06-04 12:03:03 +01:00
test driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
arch_topology.c Revert "base: arch_topology: fix section mismatch build warnings" 2018-03-15 14:36:20 +01:00
attribute_container.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
base.h PM / core: fix deferred probe breaking suspend resume order 2018-04-24 12:18:25 +02:00
bus.c driver core: hold dev's parent lock when needed 2018-05-31 10:12:07 +02:00
cacheinfo.c drivers: base cacheinfo: Add support for ACPI based firmware tables 2018-05-17 17:28:09 +01:00
class.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
component.c component: add debugfs support 2017-12-18 16:51:11 +01:00
container.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
core.c PM / core: Fix supplier device runtime PM usage counter imbalance 2018-06-14 10:01:52 +02:00
cpu.c x86/bugs: Expose /sys/../spec_store_bypass 2018-05-03 13:55:47 +02:00
dd.c Additional power management updates for 4.18-rc1 2018-06-13 07:24:18 -07:00
devcon.c drivers: base: Unified device connection lookup 2018-03-22 13:10:29 +01:00
devcoredump.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
devres.c device: Use overflow helpers for devm_kmalloc() 2018-06-05 12:16:51 -07:00
devtmpfs.c kernel: add ksys_unshare() helper; remove in-kernel calls to sys_unshare() 2018-04-02 20:16:06 +02:00
dma-coherent.c dma-coherent: clarify dma_mmap_from_dev_coherent documentation 2018-04-23 14:44:17 +02:00
dma-contiguous.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
dma-mapping.c dma-mapping: move dma configuration to bus infrastructure 2018-05-03 16:22:18 +02:00
driver.c driver-core: return EINVAL error instead of BUG_ON() 2018-05-25 18:18:45 +02:00
firmware.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
hypervisor.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
init.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
isa.c Merge 4.15-rc3 into driver-core-next 2017-12-11 08:50:05 +01:00
Kconfig firmware_loader: move kconfig FW_LOADER entries to its own file 2018-05-14 16:43:10 +02:00
Makefile Driver core patches for 4.17-rc1 2018-04-04 19:41:45 -07:00
map.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
memory.c mm: memory_hotplug: use put_device() if device_register fail 2018-05-14 16:48:59 +02:00
module.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
node.c mm/memory_hotplug: fix leftover use of struct page during hotplug 2018-05-25 18:12:11 -07:00
pinctrl.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
platform-msi.c genirq/msi: Limit level-triggered MSI to platform devices 2018-05-13 15:58:59 +02:00
platform.c Power management updates for 4.18-rc1 2018-06-05 09:38:39 -07:00
property.c device property: Get rid of union aliasing 2018-05-17 12:47:21 +02:00
soc.c base: soc: use put_device() instead of kfree() 2018-03-15 14:37:03 +01:00
syscore.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
topology.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00
transport_class.c driver core: Remove redundant license text 2017-12-07 18:36:44 +01:00