From: Axel Lin <axel.lin@ingics.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] pinctrl: core: Hold pctldev->mutex mutex lock while traversing gpio_ranges list
Date: Sun, 18 Aug 2013 20:40:29 +0800 [thread overview]
Message-ID: <1376829629.3391.5.camel@phoenix> (raw)
In-Reply-To: <1376829262.3391.1.camel@phoenix>
Hold pctldev->mutex mutex_lock when traverse the list.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/pinctrl/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index c670527..4adef2f 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -357,14 +357,17 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
/* Loop over the pin controllers */
list_for_each_entry(pctldev, &pinctrldev_list, node) {
/* Loop over the ranges */
+ mutex_lock(&pctldev->mutex);
list_for_each_entry(range, &pctldev->gpio_ranges, node) {
/* Check if any gpio range overlapped with gpio chip */
if (range->base + range->npins - 1 < chip->base ||
range->base > chip->base + chip->ngpio - 1)
continue;
+ mutex_unlock(&pctldev->mutex);
mutex_unlock(&pinctrldev_list_mutex);
return true;
}
+ mutex_unlock(&pctldev->mutex);
}
mutex_unlock(&pinctrldev_list_mutex);
--
1.8.1.2
next prev parent reply other threads:[~2013-08-18 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 12:34 [PATCH 1/2] pinctrl: core: Hold pinctrldev_list_mutex mutex while traversing pinctrldev_list Axel Lin
2013-08-18 12:40 ` Axel Lin [this message]
2013-08-21 21:20 ` [PATCH 2/2] pinctrl: core: Hold pctldev->mutex mutex lock while traversing gpio_ranges list Linus Walleij
2013-08-21 21:19 ` [PATCH 1/2] pinctrl: core: Hold pinctrldev_list_mutex mutex while traversing pinctrldev_list Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376829629.3391.5.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=haojian.zhuang@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.