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