* [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
@ 2022-09-25 2:12 Yang Yingliang
2022-10-04 9:13 ` Horatiu Vultur
2022-10-04 11:46 ` Linus Walleij
0 siblings, 2 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-09-25 2:12 UTC (permalink / raw)
To: linux-gpio, linux-kernel
Cc: linus.walleij, p.zabel, horatiu.vultur, andy.shevchenko
Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
destroy whenever the driver is unbound.
Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v3:
Using devm_add_action_or_reset().
v2:
move alloc_ordered_workqueue() after ocelot_pinctrl_register().
---
drivers/pinctrl/pinctrl-ocelot.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index 62ce3957abe4..266fbc957273 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -2038,6 +2038,11 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev,
return devm_regmap_init_mmio(&pdev->dev, base, ®map_config);
}
+static void ocelot_destroy_workqueue(void *data)
+{
+ destroy_workqueue(data);
+}
+
static int ocelot_pinctrl_probe(struct platform_device *pdev)
{
const struct ocelot_match_data *data;
@@ -2069,6 +2074,11 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
if (!info->wq)
return -ENOMEM;
+ ret = devm_add_action_or_reset(dev, ocelot_destroy_workqueue,
+ info->wq);
+ if (ret)
+ return ret;
+
info->pincfg_data = &data->pincfg_data;
reset = devm_reset_control_get_optional_shared(dev, "switch");
@@ -2110,15 +2120,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
return 0;
}
-static int ocelot_pinctrl_remove(struct platform_device *pdev)
-{
- struct ocelot_pinctrl *info = platform_get_drvdata(pdev);
-
- destroy_workqueue(info->wq);
-
- return 0;
-}
-
static struct platform_driver ocelot_pinctrl_driver = {
.driver = {
.name = "pinctrl-ocelot",
@@ -2126,7 +2127,6 @@ static struct platform_driver ocelot_pinctrl_driver = {
.suppress_bind_attrs = true,
},
.probe = ocelot_pinctrl_probe,
- .remove = ocelot_pinctrl_remove,
};
module_platform_driver(ocelot_pinctrl_driver);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
2022-09-25 2:12 [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe() Yang Yingliang
@ 2022-10-04 9:13 ` Horatiu Vultur
2022-10-04 11:46 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2022-10-04 9:13 UTC (permalink / raw)
To: Yang Yingliang
Cc: linux-gpio, linux-kernel, linus.walleij, p.zabel, andy.shevchenko
The 09/25/2022 10:12, Yang Yingliang wrote:
>
> Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
> destroy whenever the driver is unbound.
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>
> Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v3:
> Using devm_add_action_or_reset().
>
> v2:
> move alloc_ordered_workqueue() after ocelot_pinctrl_register().
> ---
> drivers/pinctrl/pinctrl-ocelot.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
> index 62ce3957abe4..266fbc957273 100644
> --- a/drivers/pinctrl/pinctrl-ocelot.c
> +++ b/drivers/pinctrl/pinctrl-ocelot.c
> @@ -2038,6 +2038,11 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev,
> return devm_regmap_init_mmio(&pdev->dev, base, ®map_config);
> }
>
> +static void ocelot_destroy_workqueue(void *data)
> +{
> + destroy_workqueue(data);
> +}
> +
> static int ocelot_pinctrl_probe(struct platform_device *pdev)
> {
> const struct ocelot_match_data *data;
> @@ -2069,6 +2074,11 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
> if (!info->wq)
> return -ENOMEM;
>
> + ret = devm_add_action_or_reset(dev, ocelot_destroy_workqueue,
> + info->wq);
> + if (ret)
> + return ret;
> +
> info->pincfg_data = &data->pincfg_data;
>
> reset = devm_reset_control_get_optional_shared(dev, "switch");
> @@ -2110,15 +2120,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int ocelot_pinctrl_remove(struct platform_device *pdev)
> -{
> - struct ocelot_pinctrl *info = platform_get_drvdata(pdev);
> -
> - destroy_workqueue(info->wq);
> -
> - return 0;
> -}
> -
> static struct platform_driver ocelot_pinctrl_driver = {
> .driver = {
> .name = "pinctrl-ocelot",
> @@ -2126,7 +2127,6 @@ static struct platform_driver ocelot_pinctrl_driver = {
> .suppress_bind_attrs = true,
> },
> .probe = ocelot_pinctrl_probe,
> - .remove = ocelot_pinctrl_remove,
> };
> module_platform_driver(ocelot_pinctrl_driver);
>
> --
> 2.25.1
>
--
/Horatiu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
2022-09-25 2:12 [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe() Yang Yingliang
2022-10-04 9:13 ` Horatiu Vultur
@ 2022-10-04 11:46 ` Linus Walleij
2022-10-04 19:57 ` Linus Walleij
1 sibling, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2022-10-04 11:46 UTC (permalink / raw)
To: Yang Yingliang
Cc: linux-gpio, linux-kernel, p.zabel, horatiu.vultur, andy.shevchenko
On Sun, Sep 25, 2022 at 4:06 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
> Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
> destroy whenever the driver is unbound.
>
> Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v3:
> Using devm_add_action_or_reset().
Patch applied, after deleting the hunks removing .remove because
that was already gone upstream.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
2022-10-04 11:46 ` Linus Walleij
@ 2022-10-04 19:57 ` Linus Walleij
2022-10-06 5:54 ` Yang Yingliang
0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2022-10-04 19:57 UTC (permalink / raw)
To: Yang Yingliang
Cc: linux-gpio, linux-kernel, p.zabel, horatiu.vultur, andy.shevchenko
On Tue, Oct 4, 2022 at 1:46 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sun, Sep 25, 2022 at 4:06 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> > Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
> > destroy whenever the driver is unbound.
> >
> > Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> > v3:
> > Using devm_add_action_or_reset().
>
> Patch applied, after deleting the hunks removing .remove because
> that was already gone upstream.
Ah, the patch introducing that is in the MFD tree is it not?
Either ask Lee to apply it or wait until -rc1 it's no big deal
anyway. Remind me in two weeks.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
2022-10-04 19:57 ` Linus Walleij
@ 2022-10-06 5:54 ` Yang Yingliang
2022-10-17 8:44 ` Linus Walleij
0 siblings, 1 reply; 6+ messages in thread
From: Yang Yingliang @ 2022-10-06 5:54 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, linux-kernel, p.zabel, horatiu.vultur,
andy.shevchenko, yangyingliang
Hi,
On 2022/10/5 3:57, Linus Walleij wrote:
> On Tue, Oct 4, 2022 at 1:46 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Sun, Sep 25, 2022 at 4:06 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>>
>>> Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
>>> destroy whenever the driver is unbound.
>>>
>>> Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>> ---
>>> v3:
>>> Using devm_add_action_or_reset().
>> Patch applied, after deleting the hunks removing .remove because
>> that was already gone upstream.
> Ah, the patch introducing that is in the MFD tree is it not?
>
> Either ask Lee to apply it or wait until -rc1 it's no big deal
> anyway. Remind me in two weeks.
It's OK.
Thanks,
Yang
>
> Yours,
> Linus Walleij
> .
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
2022-10-06 5:54 ` Yang Yingliang
@ 2022-10-17 8:44 ` Linus Walleij
0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-10-17 8:44 UTC (permalink / raw)
To: Yang Yingliang
Cc: linux-gpio, linux-kernel, p.zabel, horatiu.vultur, andy.shevchenko
On Thu, Oct 6, 2022 at 7:54 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
> On 2022/10/5 3:57, Linus Walleij wrote:
> > On Tue, Oct 4, 2022 at 1:46 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> >> On Sun, Sep 25, 2022 at 4:06 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
> >>
> >>> Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
> >>> destroy whenever the driver is unbound.
> >>>
> >>> Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
> >>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> >>> ---
> >>> v3:
> >>> Using devm_add_action_or_reset().
> >> Patch applied, after deleting the hunks removing .remove because
> >> that was already gone upstream.
> > Ah, the patch introducing that is in the MFD tree is it not?
> >
> > Either ask Lee to apply it or wait until -rc1 it's no big deal
> > anyway. Remind me in two weeks.
>
> It's OK.
>
> Thanks,
> Yang
I rebased my development on v6.1-rc1 now and applied this patch!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-17 8:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 2:12 [PATCH -next v3] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe() Yang Yingliang
2022-10-04 9:13 ` Horatiu Vultur
2022-10-04 11:46 ` Linus Walleij
2022-10-04 19:57 ` Linus Walleij
2022-10-06 5:54 ` Yang Yingliang
2022-10-17 8:44 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).