driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links
Subsystems (2)
PATCH 1/1 driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links
Commit 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation") didn't completely fix STATELESS + SYNC_STATE_ONLY handling.
What looks like an optimization in that commit is actually a bug that causes an if condition to always take the else path. This prevents reordering of devices in the dpm_list when a DL_FLAG_STATELESS device link is create on top of an existing DL_FLAG_SYNC_STATE_ONLY device link.
---
Sigh... device links are tricky and hard! Sorry about the endless fixes :( Also, how was this not caught by the compiler as a warning?
-Saravana
drivers/base/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/core.c +5 -3
@@ -543,12 +543,14 @@ struct device_link *device_link_add(struct device *consumer,if (flags &DL_FLAG_STATELESS ) {kref_get (&link->kref); - link->flags |=DL_FLAG_STATELESS ;if (link->flags &DL_FLAG_SYNC_STATE_ONLY && - !(link->flags &DL_FLAG_STATELESS )) + !(link->flags &DL_FLAG_STATELESS )) { + link->flags |=DL_FLAG_STATELESS ; goto reorder; -else + }else { + link->flags |=DL_FLAG_STATELESS ; goto out; + } }/*
Signature · 1 line
2.26.2.761.g0e0b3e54be-goog
Quoted 34 lines · Saravana Kannan
Commit
21c27f06587d("driver core: FixSYNC_STATE_ONLYdevice link implementation") didn't completely fix STATELESS +SYNC_STATE_ONLYhandling.What looks like an optimization in that commit is actually a bug that causes an if condition to always take the else path. This prevents reordering of devices in the
dpm_listwhen aDL_FLAG_STATELESSdevice link is create on top of an existingDL_FLAG_SYNC_STATE_ONLYdevice link.Fixes 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation")Signed-off-by Saravana Kannan <[email protected]>---
Sigh... device links are tricky and hard! Sorry about the endless fixes :( Also, how was this not caught by the compiler as a warning?(quoted diff) +0
-1-Saravana drivers/base/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/base/core.c +1
-2@@ -543,12 +543,14 @@ struct device_link *device_link_add(struct device *consumer,if (flags &DL_FLAG_STATELESS ) {kref_get (&link->kref); - link->flags |=DL_FLAG_STATELESS ;if (link->flags &DL_FLAG_SYNC_STATE_ONLY && - !(link->flags &DL_FLAG_STATELESS )) + !(link->flags &DL_FLAG_STATELESS )) {
drivers/base/core.c struct device_link *device_link_add(struct device *consumer, · line 556
Quoted 10 lines
drivers/base/core.c +4
-1+ link->flags |=DL_FLAG_STATELESS ; goto reorder; - else + }else { + link->flags |=DL_FLAG_STATELESS ; goto out; + } }/*
Forgot to add [email protected]. Doing that now.
-Saravana
Quoted 11 lines · Saravana Kannan
Commit
21c27f06587d("driver core: FixSYNC_STATE_ONLYdevice link implementation") didn't completely fix STATELESS +SYNC_STATE_ONLYhandling.What looks like an optimization in that commit is actually a bug that causes an if condition to always take the else path. This prevents reordering of devices in the
dpm_listwhen aDL_FLAG_STATELESSdevice link is create on top of an existingDL_FLAG_SYNC_STATE_ONLYdevice link.
Quoted 5 lines
Fixes 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation")Signed-off-by Saravana Kannan <[email protected]>---
Sigh... device links are tricky and hard! Sorry about the endless fixes :( Also, how was this not caught by the compiler as a warning?
Well, I haven't spotted this either ...
Quoted 28 lines
drivers/base/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/base/core.c +5
-4@@ -543,12 +543,14 @@ struct device_link *device_link_add(struct device *consumer,if (flags &DL_FLAG_STATELESS ) {kref_get (&link->kref); - link->flags |=DL_FLAG_STATELESS ;if (link->flags &DL_FLAG_SYNC_STATE_ONLY && - !(link->flags &DL_FLAG_STATELESS )) + !(link->flags &DL_FLAG_STATELESS )) { + link->flags |=DL_FLAG_STATELESS ; goto reorder; -else + }else { + link->flags |=DL_FLAG_STATELESS ; goto out; + } }/* -- 2.26.2.761.g0e0b3e54be-goog