diff mbox series

[3/4] drm: bridge: simple-bridge: use only devm* in probe

Message ID 20240617-tdp158-v1-3-df98ef7dec6d@freebox.fr (mailing list archive)
State New, archived
Headers show
Series Basic support for TI TDP158 | expand

Commit Message

Marc Gonzalez June 17, 2024, 4:03 p.m. UTC
Once probe uses only devm functions, remove() becomes unnecessary.

Signed-off-by: Marc Gonzalez <mgonzalez@freebox.fr>
---
 drivers/gpu/drm/bridge/simple-bridge.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Dmitry Baryshkov June 17, 2024, 10:28 p.m. UTC | #1
On Mon, Jun 17, 2024 at 06:03:01PM GMT, Marc Gonzalez wrote:
> Once probe uses only devm functions, remove() becomes unnecessary.

Breves vibrantesque sententiae

With the hope of getting an expanded commit message:

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


> 
> Signed-off-by: Marc Gonzalez <mgonzalez@freebox.fr>
> ---
>  drivers/gpu/drm/bridge/simple-bridge.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c
> index d672e34970e18..f1e458a15882f 100644
> --- a/drivers/gpu/drm/bridge/simple-bridge.c
> +++ b/drivers/gpu/drm/bridge/simple-bridge.c
> @@ -214,16 +214,7 @@ static int simple_bridge_probe(struct platform_device *pdev)
>  	sbridge->bridge.of_node = dev->of_node;
>  	sbridge->bridge.timings = sbridge->info->timings;
>  
> -	drm_bridge_add(&sbridge->bridge);
> -
> -	return 0;
> -}
> -
> -static void simple_bridge_remove(struct platform_device *pdev)
> -{
> -	struct simple_bridge *sbridge = platform_get_drvdata(pdev);
> -
> -	drm_bridge_remove(&sbridge->bridge);
> +	return devm_drm_bridge_add(dev, &sbridge->bridge);
>  }
>  
>  /*
> @@ -300,7 +291,6 @@ MODULE_DEVICE_TABLE(of, simple_bridge_match);
>  
>  static struct platform_driver simple_bridge_driver = {
>  	.probe	= simple_bridge_probe,
> -	.remove_new = simple_bridge_remove,
>  	.driver		= {
>  		.name		= "simple-bridge",
>  		.of_match_table	= simple_bridge_match,
> 
> -- 
> 2.34.1
>
Marc Gonzalez June 18, 2024, 11:37 a.m. UTC | #2
On 18/06/2024 00:28, Dmitry Baryshkov wrote:

> On Mon, Jun 17, 2024 at 06:03:01PM GMT, Marc Gonzalez wrote:
>
>> Once probe uses only devm functions, remove() becomes unnecessary.
> 
> Breves vibrantesque sententiae
> 
> With the hope of getting an expanded commit message:
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

I'm not quite sure what else to say.

Using only devm* functions in probe, the remove() callback is
no longer needed, since devm unwind will free all resources.

Is that better?

NB: this patch is not *required* but I thought "might as well
change it while I'm in the code".

Regards
Dmitry Baryshkov June 18, 2024, 5:24 p.m. UTC | #3
On Tue, Jun 18, 2024 at 01:37:15PM GMT, Marc Gonzalez wrote:
> On 18/06/2024 00:28, Dmitry Baryshkov wrote:
> 
> > On Mon, Jun 17, 2024 at 06:03:01PM GMT, Marc Gonzalez wrote:
> >
> >> Once probe uses only devm functions, remove() becomes unnecessary.
> > 
> > Breves vibrantesque sententiae
> > 
> > With the hope of getting an expanded commit message:
> > 
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> I'm not quite sure what else to say.
> 
> Using only devm* functions in probe, the remove() callback is
> no longer needed, since devm unwind will free all resources.
> 
> Is that better?

Yes. Or something like:

The only call in remove() is drm_bridge_remove(). Use devm_bridge_add(),
removing the need to call drm_bridge_remove() manually and drop the
driver's remove callback completely.

> 
> NB: this patch is not *required* but I thought "might as well
> change it while I'm in the code".
> 
> Regards
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c
index d672e34970e18..f1e458a15882f 100644
--- a/drivers/gpu/drm/bridge/simple-bridge.c
+++ b/drivers/gpu/drm/bridge/simple-bridge.c
@@ -214,16 +214,7 @@  static int simple_bridge_probe(struct platform_device *pdev)
 	sbridge->bridge.of_node = dev->of_node;
 	sbridge->bridge.timings = sbridge->info->timings;
 
-	drm_bridge_add(&sbridge->bridge);
-
-	return 0;
-}
-
-static void simple_bridge_remove(struct platform_device *pdev)
-{
-	struct simple_bridge *sbridge = platform_get_drvdata(pdev);
-
-	drm_bridge_remove(&sbridge->bridge);
+	return devm_drm_bridge_add(dev, &sbridge->bridge);
 }
 
 /*
@@ -300,7 +291,6 @@  MODULE_DEVICE_TABLE(of, simple_bridge_match);
 
 static struct platform_driver simple_bridge_driver = {
 	.probe	= simple_bridge_probe,
-	.remove_new = simple_bridge_remove,
 	.driver		= {
 		.name		= "simple-bridge",
 		.of_match_table	= simple_bridge_match,