From: Gabriele Paoloni Date: Mon, 3 Dec 2012 18:08:51 +0000 (+0000) Subject: KDS: fix BUG in change I4df35f08 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9296f17d13c48a57dad6a99e7eb6812b3f3002c7;p=people%2Faperard%2Flinux-chromebook.git KDS: fix BUG in change I4df35f08 In the implementation of change I4df35f08 the same name is used for the macro "pos" parameter and "head" parameter. As consequence "head" gets corrupted. this fix introduces an auxiliar pointer for "head" and rearrange the code to make it a bit more readable BUG=chromium-os:36071,chrome-os-partner:15349,chrome-os-partner:14965 TEST=Tested on Daisy Board Signed-off-by: Gabriele Paoloni Change-Id: Icee1c07c9a87f137cdfd87fb1fe04a83f41a44b1 Reviewed-on: https://gerrit.chromium.org/gerrit/39089 Reviewed-by: Stéphane Marchesin Reviewed-by: Mandeep Singh Baines Commit-Queue: Stéphane Marchesin Tested-by: Stéphane Marchesin --- diff --git a/drivers/base/kds.c b/drivers/base/kds.c index e3054a18d749b..facc2aa61afb2 100755 --- a/drivers/base/kds.c +++ b/drivers/base/kds.c @@ -415,35 +415,36 @@ static void __kds_resource_set_release_common(struct kds_resource_set *rset) /* were we the head of the list? (head if prev is a resource) */ if (it->parent != KDS_RESOURCE) { - if (!(it->state & KDS_LINK_TRIGGERED) || - (it->state & KDS_LINK_EXCLUSIVE)) - continue; - - /* - * previous was triggered and not exclusive, so we - * trigger non-exclusive until end-of-list or first - * exclusive - */ - list_for_each_entry(it, &it->link, link) + if ((it->state & KDS_LINK_TRIGGERED) && !(it->state & KDS_LINK_EXCLUSIVE) ) { - /* exclusive found, stop triggering */ - if (it->state & KDS_LINK_EXCLUSIVE) - break; + /* + * previous was triggered and not exclusive, so we + * trigger non-exclusive until end-of-list or first + * exclusive + */ - it->state |= KDS_LINK_TRIGGERED; - /* a parent to update? */ - if (it->parent != KDS_IGNORED) + struct kds_link *it_waiting = it; + + list_for_each_entry(it, &it_waiting->link, link) { - if (0 == --it->parent->pending) + /* exclusive found, stop triggering */ + if (it->state & KDS_LINK_EXCLUSIVE) + break; + + it->state |= KDS_LINK_TRIGGERED; + /* a parent to update? */ + if ( (it->parent != KDS_IGNORED) && (it->parent != KDS_RESOURCE) ) { - /* new owner now triggered, track for callback later */ - list_add(&it->parent->callback_link, &triggered); + if (0 == --it->parent->pending) + { + /* new owner now triggered, track for callback later */ + list_add(&it->parent->callback_link, &triggered); + } } } } continue; } - /* we were the head, find the kds_resource */ resource = container_of(it, struct kds_resource, waiters);