History

driver core: Fix creation of device links with PM-runtime flags

After commit 515db266a9da ("driver core: Remove device link creation limitation"), if PM-runtime flags are passed to device_link_add(), it will fail (returning NULL) due to an overly restrictive flags check introduced by that commit. Fix this issue by extending the check in question to cover the PM-runtime flags too.

Rafael J. Wysocki committed 7 years ago

Commit fb583c81 parent bbe70e41 file · +4 −2Browse files

Unified · Split

drivers/base/core.c+4−2
@@ -213,6 +213,9 @@ void device_pm_move_to_tail(struct device *dev) · 212 unmodified lines
213213 DL_FLAG_AUTOREMOVE_SUPPLIER | \
214214 DL_FLAG_AUTOPROBE_CONSUMER)
215215
216+#define DL_ADD_VALID_FLAGS (DL_MANAGED_LINK_FLAGS | DL_FLAG_STATELESS | \
217+ DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE)
218+
216219 /**
217220 * device_link_add - Create a link between two devices.
218221 * @consumer: Consumer end of the link.
@@ -274,8 +277,7 @@ struct device_link *device_link_add(struct device *consumer, · 55 unmodified lines
274277 {
275278 struct device_link *link;
276279
277− if (!consumer || !supplier ||
278− (flags & ~(DL_FLAG_STATELESS | DL_MANAGED_LINK_FLAGS)) ||
280+ if (!consumer || !supplier || flags & ~DL_ADD_VALID_FLAGS ||
279281 (flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) ||
280282 (flags & DL_FLAG_AUTOPROBE_CONSUMER &&
281283 flags & (DL_FLAG_AUTOREMOVE_CONSUMER |

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t