Skip to content

Commit 4fe7a1e

Browse files
Uwe Kleine-Königdaeinki
authored andcommitted
drm/exynos: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> fix merge conflict and drop duplicated patch description. Signed-off-by: Inki Dae <inki.dae@samsung.com>
1 parent 16ac5b2 commit 4fe7a1e

14 files changed

Lines changed: 28 additions & 55 deletions

drivers/gpu/drm/exynos/exynos5433_drm_decon.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,18 +862,16 @@ static int exynos5433_decon_probe(struct platform_device *pdev)
862862
return ret;
863863
}
864864

865-
static int exynos5433_decon_remove(struct platform_device *pdev)
865+
static void exynos5433_decon_remove(struct platform_device *pdev)
866866
{
867867
pm_runtime_disable(&pdev->dev);
868868

869869
component_del(&pdev->dev, &decon_component_ops);
870-
871-
return 0;
872870
}
873871

874872
struct platform_driver exynos5433_decon_driver = {
875873
.probe = exynos5433_decon_probe,
876-
.remove = exynos5433_decon_remove,
874+
.remove_new = exynos5433_decon_remove,
877875
.driver = {
878876
.name = "exynos5433-decon",
879877
.pm = pm_ptr(&exynos5433_decon_pm_ops),

drivers/gpu/drm/exynos/exynos7_drm_decon.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static int decon_probe(struct platform_device *pdev)
765765
return ret;
766766
}
767767

768-
static int decon_remove(struct platform_device *pdev)
768+
static void decon_remove(struct platform_device *pdev)
769769
{
770770
struct decon_context *ctx = dev_get_drvdata(&pdev->dev);
771771

@@ -774,8 +774,6 @@ static int decon_remove(struct platform_device *pdev)
774774
iounmap(ctx->regs);
775775

776776
component_del(&pdev->dev, &decon_component_ops);
777-
778-
return 0;
779777
}
780778

781779
static int exynos7_decon_suspend(struct device *dev)
@@ -840,7 +838,7 @@ static DEFINE_RUNTIME_DEV_PM_OPS(exynos7_decon_pm_ops, exynos7_decon_suspend,
840838

841839
struct platform_driver decon_driver = {
842840
.probe = decon_probe,
843-
.remove = decon_remove,
841+
.remove_new = decon_remove,
844842
.driver = {
845843
.name = "exynos-decon",
846844
.pm = pm_ptr(&exynos7_decon_pm_ops),

drivers/gpu/drm/exynos/exynos_dp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,12 @@ static int exynos_dp_probe(struct platform_device *pdev)
250250
return component_add(&pdev->dev, &exynos_dp_ops);
251251
}
252252

253-
static int exynos_dp_remove(struct platform_device *pdev)
253+
static void exynos_dp_remove(struct platform_device *pdev)
254254
{
255255
struct exynos_dp_device *dp = platform_get_drvdata(pdev);
256256

257257
component_del(&pdev->dev, &exynos_dp_ops);
258258
analogix_dp_remove(dp->adp);
259-
260-
return 0;
261259
}
262260

263261
static int exynos_dp_suspend(struct device *dev)
@@ -285,7 +283,7 @@ MODULE_DEVICE_TABLE(of, exynos_dp_match);
285283

286284
struct platform_driver dp_driver = {
287285
.probe = exynos_dp_probe,
288-
.remove = exynos_dp_remove,
286+
.remove_new = exynos_dp_remove,
289287
.driver = {
290288
.name = "exynos-dp",
291289
.owner = THIS_MODULE,

drivers/gpu/drm/exynos/exynos_drm_drv.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,9 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
346346
match);
347347
}
348348

349-
static int exynos_drm_platform_remove(struct platform_device *pdev)
349+
static void exynos_drm_platform_remove(struct platform_device *pdev)
350350
{
351351
component_master_del(&pdev->dev, &exynos_drm_ops);
352-
return 0;
353352
}
354353

355354
static void exynos_drm_platform_shutdown(struct platform_device *pdev)
@@ -362,7 +361,7 @@ static void exynos_drm_platform_shutdown(struct platform_device *pdev)
362361

363362
static struct platform_driver exynos_drm_platform_driver = {
364363
.probe = exynos_drm_platform_probe,
365-
.remove = exynos_drm_platform_remove,
364+
.remove_new = exynos_drm_platform_remove,
366365
.shutdown = exynos_drm_platform_shutdown,
367366
.driver = {
368367
.name = "exynos-drm",

drivers/gpu/drm/exynos/exynos_drm_fimc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ static int fimc_probe(struct platform_device *pdev)
13671367
return ret;
13681368
}
13691369

1370-
static int fimc_remove(struct platform_device *pdev)
1370+
static void fimc_remove(struct platform_device *pdev)
13711371
{
13721372
struct device *dev = &pdev->dev;
13731373
struct fimc_context *ctx = get_fimc_context(dev);
@@ -1377,8 +1377,6 @@ static int fimc_remove(struct platform_device *pdev)
13771377
pm_runtime_disable(dev);
13781378

13791379
fimc_put_clocks(ctx);
1380-
1381-
return 0;
13821380
}
13831381

13841382
static int fimc_runtime_suspend(struct device *dev)
@@ -1410,7 +1408,7 @@ MODULE_DEVICE_TABLE(of, fimc_of_match);
14101408

14111409
struct platform_driver fimc_driver = {
14121410
.probe = fimc_probe,
1413-
.remove = fimc_remove,
1411+
.remove_new = fimc_remove,
14141412
.driver = {
14151413
.of_match_table = fimc_of_match,
14161414
.name = "exynos-drm-fimc",

drivers/gpu/drm/exynos/exynos_drm_fimd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,13 +1277,11 @@ static int fimd_probe(struct platform_device *pdev)
12771277
return ret;
12781278
}
12791279

1280-
static int fimd_remove(struct platform_device *pdev)
1280+
static void fimd_remove(struct platform_device *pdev)
12811281
{
12821282
pm_runtime_disable(&pdev->dev);
12831283

12841284
component_del(&pdev->dev, &fimd_component_ops);
1285-
1286-
return 0;
12871285
}
12881286

12891287
static int exynos_fimd_suspend(struct device *dev)
@@ -1325,7 +1323,7 @@ static DEFINE_RUNTIME_DEV_PM_OPS(exynos_fimd_pm_ops, exynos_fimd_suspend,
13251323

13261324
struct platform_driver fimd_driver = {
13271325
.probe = fimd_probe,
1328-
.remove = fimd_remove,
1326+
.remove_new = fimd_remove,
13291327
.driver = {
13301328
.name = "exynos4-fb",
13311329
.owner = THIS_MODULE,

drivers/gpu/drm/exynos/exynos_drm_g2d.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ static int g2d_probe(struct platform_device *pdev)
15301530
return ret;
15311531
}
15321532

1533-
static int g2d_remove(struct platform_device *pdev)
1533+
static void g2d_remove(struct platform_device *pdev)
15341534
{
15351535
struct g2d_data *g2d = platform_get_drvdata(pdev);
15361536

@@ -1545,8 +1545,6 @@ static int g2d_remove(struct platform_device *pdev)
15451545
g2d_fini_cmdlist(g2d);
15461546
destroy_workqueue(g2d->g2d_workq);
15471547
kmem_cache_destroy(g2d->runqueue_slab);
1548-
1549-
return 0;
15501548
}
15511549

15521550
static int g2d_suspend(struct device *dev)
@@ -1609,7 +1607,7 @@ MODULE_DEVICE_TABLE(of, exynos_g2d_match);
16091607

16101608
struct platform_driver g2d_driver = {
16111609
.probe = g2d_probe,
1612-
.remove = g2d_remove,
1610+
.remove_new = g2d_remove,
16131611
.driver = {
16141612
.name = "exynos-drm-g2d",
16151613
.owner = THIS_MODULE,

drivers/gpu/drm/exynos/exynos_drm_gsc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,15 +1309,13 @@ static int gsc_probe(struct platform_device *pdev)
13091309
return ret;
13101310
}
13111311

1312-
static int gsc_remove(struct platform_device *pdev)
1312+
static void gsc_remove(struct platform_device *pdev)
13131313
{
13141314
struct device *dev = &pdev->dev;
13151315

13161316
component_del(dev, &gsc_component_ops);
13171317
pm_runtime_dont_use_autosuspend(dev);
13181318
pm_runtime_disable(dev);
1319-
1320-
return 0;
13211319
}
13221320

13231321
static int __maybe_unused gsc_runtime_suspend(struct device *dev)
@@ -1422,7 +1420,7 @@ MODULE_DEVICE_TABLE(of, exynos_drm_gsc_of_match);
14221420

14231421
struct platform_driver gsc_driver = {
14241422
.probe = gsc_probe,
1425-
.remove = gsc_remove,
1423+
.remove_new = gsc_remove,
14261424
.driver = {
14271425
.name = "exynos-drm-gsc",
14281426
.owner = THIS_MODULE,

drivers/gpu/drm/exynos/exynos_drm_mic.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,16 +442,14 @@ static int exynos_mic_probe(struct platform_device *pdev)
442442
return ret;
443443
}
444444

445-
static int exynos_mic_remove(struct platform_device *pdev)
445+
static void exynos_mic_remove(struct platform_device *pdev)
446446
{
447447
struct exynos_mic *mic = platform_get_drvdata(pdev);
448448

449449
component_del(&pdev->dev, &exynos_mic_component_ops);
450450
pm_runtime_disable(&pdev->dev);
451451

452452
drm_bridge_remove(&mic->bridge);
453-
454-
return 0;
455453
}
456454

457455
static const struct of_device_id exynos_mic_of_match[] = {
@@ -462,7 +460,7 @@ MODULE_DEVICE_TABLE(of, exynos_mic_of_match);
462460

463461
struct platform_driver mic_driver = {
464462
.probe = exynos_mic_probe,
465-
.remove = exynos_mic_remove,
463+
.remove_new = exynos_mic_remove,
466464
.driver = {
467465
.name = "exynos-mic",
468466
.pm = pm_ptr(&exynos_mic_pm_ops),

drivers/gpu/drm/exynos/exynos_drm_rotator.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,13 @@ static int rotator_probe(struct platform_device *pdev)
329329
return ret;
330330
}
331331

332-
static int rotator_remove(struct platform_device *pdev)
332+
static void rotator_remove(struct platform_device *pdev)
333333
{
334334
struct device *dev = &pdev->dev;
335335

336336
component_del(dev, &rotator_component_ops);
337337
pm_runtime_dont_use_autosuspend(dev);
338338
pm_runtime_disable(dev);
339-
340-
return 0;
341339
}
342340

343341
static int rotator_runtime_suspend(struct device *dev)
@@ -453,7 +451,7 @@ static DEFINE_RUNTIME_DEV_PM_OPS(rotator_pm_ops, rotator_runtime_suspend,
453451

454452
struct platform_driver rotator_driver = {
455453
.probe = rotator_probe,
456-
.remove = rotator_remove,
454+
.remove_new = rotator_remove,
457455
.driver = {
458456
.name = "exynos-rotator",
459457
.owner = THIS_MODULE,

0 commit comments

Comments
 (0)