diff options
-rw-r--r-- | drivers/base/core.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 36622b52e419..df3e1a44707a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -236,6 +236,13 @@ struct device_link *device_link_add(struct device *consumer, | |||
236 | link->rpm_active = true; | 236 | link->rpm_active = true; |
237 | } | 237 | } |
238 | pm_runtime_new_link(consumer); | 238 | pm_runtime_new_link(consumer); |
239 | /* | ||
240 | * If the link is being added by the consumer driver at probe | ||
241 | * time, balance the decrementation of the supplier's runtime PM | ||
242 | * usage counter after consumer probe in driver_probe_device(). | ||
243 | */ | ||
244 | if (consumer->links.status == DL_DEV_PROBING) | ||
245 | pm_runtime_get_noresume(supplier); | ||
239 | } | 246 | } |
240 | get_device(supplier); | 247 | get_device(supplier); |
241 | link->supplier = supplier; | 248 | link->supplier = supplier; |
@@ -255,12 +262,12 @@ struct device_link *device_link_add(struct device *consumer, | |||
255 | switch (consumer->links.status) { | 262 | switch (consumer->links.status) { |
256 | case DL_DEV_PROBING: | 263 | case DL_DEV_PROBING: |
257 | /* | 264 | /* |
258 | * Balance the decrementation of the supplier's | 265 | * Some callers expect the link creation during |
259 | * runtime PM usage counter after consumer probe | 266 | * consumer driver probe to resume the supplier |
260 | * in driver_probe_device(). | 267 | * even without DL_FLAG_RPM_ACTIVE. |
261 | */ | 268 | */ |
262 | if (flags & DL_FLAG_PM_RUNTIME) | 269 | if (flags & DL_FLAG_PM_RUNTIME) |
263 | pm_runtime_get_sync(supplier); | 270 | pm_runtime_resume(supplier); |
264 | 271 | ||
265 | link->status = DL_STATE_CONSUMER_PROBE; | 272 | link->status = DL_STATE_CONSUMER_PROBE; |
266 | break; | 273 | break; |