[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGETcx9hYrnMF8JU+KV6jvxExq3jYgdg4Z_-TyjN4RUQnV8qvA@mail.gmail.com>
Date: Tue, 19 May 2020 21:38:07 -0700
From: Saravana Kannan <saravanak@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Saravana Kannan <saravanak@...gle.com>
Cc: Android Kernel Team <kernel-team@...roid.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
stable <stable@...r.kernel.org>
Subject: Re: [PATCH v1] driver core: Fix handling of SYNC_STATE_ONLY +
STATELESS device links
On Tue, May 19, 2020 at 9:36 PM Saravana Kannan <saravanak@...gle.com> wrote:
>
> 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.
>
> Fixes: 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation")
> Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> ---
> 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(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 83a3e0b62ce3..dfd4e94ef790 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -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;
> + }
> }
>
> /*
Forgot to add stable@...r.kernel.org. Doing that now.
-Saravana
Powered by blists - more mailing lists