linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: msm: Use device-managed registration API
@ 2019-07-23  3:02 Chuhong Yuan
  2019-08-28  3:24 ` Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Chuhong Yuan @ 2019-07-23  3:02 UTC (permalink / raw)
  Cc: Peter Chen, Greg Kroah-Hartman, linux-usb, linux-kernel, Chuhong Yuan

Use devm_reset_controller_register to get rid
of manual unregistration.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
index bb4645a8ca46..067542e84aea 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 	ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
 	ci->rcdev.of_node = pdev->dev.of_node;
 	ci->rcdev.nr_resets = 2;
-	ret = reset_controller_register(&ci->rcdev);
+	ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
 	if (ret)
 		return ret;
 
@@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 err_iface:
 	clk_disable_unprepare(ci->core_clk);
 err_fs:
-	reset_controller_unregister(&ci->rcdev);
 	return ret;
 }
 
@@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
 	ci_hdrc_remove_device(ci->ci);
 	clk_disable_unprepare(ci->iface_clk);
 	clk_disable_unprepare(ci->core_clk);
-	reset_controller_unregister(&ci->rcdev);
 
 	return 0;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: chipidea: msm: Use device-managed registration API
  2019-07-23  3:02 [PATCH] usb: chipidea: msm: Use device-managed registration API Chuhong Yuan
@ 2019-08-28  3:24 ` Peter Chen
  2019-08-28 11:42   ` Chuhong Yuan
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen @ 2019-08-28  3:24 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On 19-07-23 11:02:07, Chuhong Yuan wrote:
> Use devm_reset_controller_register to get rid
> of manual unregistration.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
> index bb4645a8ca46..067542e84aea 100644
> --- a/drivers/usb/chipidea/ci_hdrc_msm.c
> +++ b/drivers/usb/chipidea/ci_hdrc_msm.c
> @@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
>  	ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
>  	ci->rcdev.of_node = pdev->dev.of_node;
>  	ci->rcdev.nr_resets = 2;
> -	ret = reset_controller_register(&ci->rcdev);
> +	ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
>  	if (ret)
>  		return ret;
>  
> @@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
>  err_iface:
>  	clk_disable_unprepare(ci->core_clk);
>  err_fs:
> -	reset_controller_unregister(&ci->rcdev);

It is devm API, why the unregister needs to be called at
fail path?

Peter

>  	return ret;
>  }
>  
> @@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
>  	ci_hdrc_remove_device(ci->ci);
>  	clk_disable_unprepare(ci->iface_clk);
>  	clk_disable_unprepare(ci->core_clk);
> -	reset_controller_unregister(&ci->rcdev);
>  
>  	return 0;
>  }
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: chipidea: msm: Use device-managed registration API
  2019-08-28  3:24 ` Peter Chen
@ 2019-08-28 11:42   ` Chuhong Yuan
  2019-08-29  3:39     ` Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Chuhong Yuan @ 2019-08-28 11:42 UTC (permalink / raw)
  To: Peter Chen; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Wed, Aug 28, 2019 at 11:24 AM Peter Chen <peter.chen@nxp.com> wrote:
>
> On 19-07-23 11:02:07, Chuhong Yuan wrote:
> > Use devm_reset_controller_register to get rid
> > of manual unregistration.
> >
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---
> >  drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
> > index bb4645a8ca46..067542e84aea 100644
> > --- a/drivers/usb/chipidea/ci_hdrc_msm.c
> > +++ b/drivers/usb/chipidea/ci_hdrc_msm.c
> > @@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
> >       ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
> >       ci->rcdev.of_node = pdev->dev.of_node;
> >       ci->rcdev.nr_resets = 2;
> > -     ret = reset_controller_register(&ci->rcdev);
> > +     ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
> >       if (ret)
> >               return ret;
> >
> > @@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
> >  err_iface:
> >       clk_disable_unprepare(ci->core_clk);
> >  err_fs:
> > -     reset_controller_unregister(&ci->rcdev);
>
> It is devm API, why the unregister needs to be called at
> fail path?
>

I am not very clear about your problem...
After using devm_reset_controller_register(), I have removed
reset_controller_unregister() calls
in this patch.

> Peter
>
> >       return ret;
> >  }
> >
> > @@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
> >       ci_hdrc_remove_device(ci->ci);
> >       clk_disable_unprepare(ci->iface_clk);
> >       clk_disable_unprepare(ci->core_clk);
> > -     reset_controller_unregister(&ci->rcdev);
> >
> >       return 0;
> >  }
> > --
> > 2.20.1
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: chipidea: msm: Use device-managed registration API
  2019-08-28 11:42   ` Chuhong Yuan
@ 2019-08-29  3:39     ` Peter Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2019-08-29  3:39 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On 19-08-28 19:42:32, Chuhong Yuan wrote:
> On Wed, Aug 28, 2019 at 11:24 AM Peter Chen <peter.chen@nxp.com> wrote:
> >
> > On 19-07-23 11:02:07, Chuhong Yuan wrote:
> > > Use devm_reset_controller_register to get rid
> > > of manual unregistration.
> > >
> > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > > ---
> > >  drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
> > > index bb4645a8ca46..067542e84aea 100644
> > > --- a/drivers/usb/chipidea/ci_hdrc_msm.c
> > > +++ b/drivers/usb/chipidea/ci_hdrc_msm.c
> > > @@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
> > >       ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
> > >       ci->rcdev.of_node = pdev->dev.of_node;
> > >       ci->rcdev.nr_resets = 2;
> > > -     ret = reset_controller_register(&ci->rcdev);
> > > +     ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
> > >       if (ret)
> > >               return ret;
> > >
> > > @@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
> > >  err_iface:
> > >       clk_disable_unprepare(ci->core_clk);
> > >  err_fs:
> > > -     reset_controller_unregister(&ci->rcdev);
> >
> > It is devm API, why the unregister needs to be called at
> > fail path?
> >
> 
> I am not very clear about your problem...
> After using devm_reset_controller_register(), I have removed
> reset_controller_unregister() calls
> in this patch.
> 

Sorry, my fault.

Your patch is ok, but try to clean up the label "err_fs" since
it is not needed.

Peter

> > Peter
> >
> > >       return ret;
> > >  }
> > >
> > > @@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
> > >       ci_hdrc_remove_device(ci->ci);
> > >       clk_disable_unprepare(ci->iface_clk);
> > >       clk_disable_unprepare(ci->core_clk);
> > > -     reset_controller_unregister(&ci->rcdev);
> > >
> > >       return 0;
> > >  }
> > > --
> > > 2.20.1
> > >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-29  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23  3:02 [PATCH] usb: chipidea: msm: Use device-managed registration API Chuhong Yuan
2019-08-28  3:24 ` Peter Chen
2019-08-28 11:42   ` Chuhong Yuan
2019-08-29  3:39     ` Peter Chen

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).