提交 1cb406b8 编写于 作者: L Li Jun 提交者: Zheng Zengkai

extcon: ptn5150: Add queue work sync before driver release

stable inclusion
from stable-v5.10.122
commit cfe8a0967d6ea6dbc133da7df4a50ad7b4b5c60b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5W6OE

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=cfe8a0967d6ea6dbc133da7df4a50ad7b4b5c60b

--------------------------------

[ Upstream commit 782cd939 ]

Add device managed action to sync pending queue work, otherwise
the queued work may run after the work is destroyed.

Fixes: 4ed754de ("extcon: Add support for ptn5150 extcon driver")
Reviewed-by: NKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: NLi Jun <jun.li@nxp.com>
Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 6786b9d7
...@@ -194,6 +194,13 @@ static int ptn5150_init_dev_type(struct ptn5150_info *info) ...@@ -194,6 +194,13 @@ static int ptn5150_init_dev_type(struct ptn5150_info *info)
return 0; return 0;
} }
static void ptn5150_work_sync_and_put(void *data)
{
struct ptn5150_info *info = data;
cancel_work_sync(&info->irq_work);
}
static int ptn5150_i2c_probe(struct i2c_client *i2c) static int ptn5150_i2c_probe(struct i2c_client *i2c)
{ {
struct device *dev = &i2c->dev; struct device *dev = &i2c->dev;
...@@ -284,6 +291,10 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c) ...@@ -284,6 +291,10 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c)
if (ret) if (ret)
return -EINVAL; return -EINVAL;
ret = devm_add_action_or_reset(dev, ptn5150_work_sync_and_put, info);
if (ret)
return ret;
/* /*
* Update current extcon state if for example OTG connection was there * Update current extcon state if for example OTG connection was there
* before the probe * before the probe
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册