diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-08-18 20:40:29 +0800 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-08-23 08:56:28 +0200 |
commit | 5ffbe2e613873222474a0f575296187002a8995d (patch) | |
tree | 6322c9986f795f846f549d5b4f8bc10483f11273 /drivers/pinctrl/core.c | |
parent | f0059021084137b4ffd2ffc7ee4b62a895c4c84a (diff) | |
download | linux-5ffbe2e613873222474a0f575296187002a8995d.tar.gz linux-5ffbe2e613873222474a0f575296187002a8995d.tar.bz2 linux-5ffbe2e613873222474a0f575296187002a8995d.zip |
pinctrl: core: Hold pctldev->mutex mutex lock while traversing gpio_ranges list
Hold pctldev->mutex mutex_lock when traverse the list.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ff06582103c0..faeb8726aee0 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); |