summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@google.com>2021-04-19 17:34:49 +0800
committerLinus Walleij <linus.walleij@linaro.org>2021-04-22 01:53:29 +0200
commit56ab29ec6ff6c1441fda6ddcca0193be32d395b7 (patch)
tree5329e9b104e268542412f6ea14c9cf5e90432900 /drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
parentea9d2ed46520a3fb0b865143cc824aea27deb8fa (diff)
downloadlwn-56ab29ec6ff6c1441fda6ddcca0193be32d395b7.tar.gz
lwn-56ab29ec6ff6c1441fda6ddcca0193be32d395b7.zip
pinctrl: mediatek: use spin lock in mtk_rmw
Commit 42a46434e9b1 ("pinctrl: add lock in mtk_rmw function.") uses mutex lock in mtk_rmw. However the function is possible called from atomic context. For example call trace: mutex_lock+0x28/0x64 mtk_rmw+0x38/0x80 [snip] max98357a_daiops_trigger+0x8c/0x9c soc_pcm_trigger+0x5c/0x10c The max98357a_daiops_trigger() could run in either atomic or non-atomic context. As a result, dmesg shows some similar messages: "BUG: sleeping function called from invalid context at kernel/locking/mutex.c:254". Uses spin lock in mtk_rmw instead. Fixes: 42a46434e9b1 ("pinctrl: add lock in mtk_rmw function.") Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20210419093449.3125704-1-tzungbi@google.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
index be35443d81f8..a6f1bdb2083b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
@@ -253,7 +253,7 @@ struct mtk_pinctrl {
struct mtk_pinctrl_group *groups;
const char **grp_names;
/* lock pin's register resource to avoid multiple threads issue*/
- struct mutex lock;
+ spinlock_t lock;
};
void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set);