dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/panel: remove return value of function drm_panel_add
@ 2020-08-01 12:02 Bernard Zhao
  2020-08-01 14:27 ` Linus Walleij
  2020-08-02  7:07 ` Sam Ravnborg
  0 siblings, 2 replies; 8+ messages in thread
From: Bernard Zhao @ 2020-08-01 12:02 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Linus Walleij, Jerry Han, Icenowy Zheng, Jagan Teki,
	Laurent Pinchart, Stefan Mavrodiev, Robert Chiras, dri-devel,
	linux-kernel
  Cc: opensource.kernel, Bernard Zhao

The function "int drm_panel_add(struct drm_panel *panel)"
always returns 0, this return value is meaningless.
Also, there is no need to check return value which calls
"drm_panel_add and", error branch code will never run.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/drm_panel.c                              | 4 +---
 drivers/gpu/drm/panel/panel-arm-versatile.c              | 4 +++-
 drivers/gpu/drm/panel/panel-boe-himax8279d.c             | 4 +++-
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c           | 4 +++-
 drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c        | 4 +---
 drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c    | 4 +---
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c             | 4 +++-
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c            | 4 +---
 drivers/gpu/drm/panel/panel-innolux-p079zca.c            | 4 +---
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c           | 4 ++--
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c       | 4 +++-
 drivers/gpu/drm/panel/panel-lg-lb035q02.c                | 4 +++-
 drivers/gpu/drm/panel/panel-lg-lg4573.c                  | 4 +++-
 drivers/gpu/drm/panel/panel-lvds.c                       | 4 +---
 drivers/gpu/drm/panel/panel-nec-nl8048hl11.c             | 4 +++-
 drivers/gpu/drm/panel/panel-novatek-nt35510.c            | 4 +---
 drivers/gpu/drm/panel/panel-novatek-nt39016.c            | 6 +-----
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c       | 4 +++-
 drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c       | 4 +++-
 drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c     | 4 +++-
 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c    | 4 +---
 drivers/gpu/drm/panel/panel-raydium-rm67191.c            | 4 +---
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c             | 4 +---
 drivers/gpu/drm/panel/panel-samsung-ld9040.c             | 4 +++-
 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c            | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c            | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c         | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c            | 4 +++-
 drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 6 +-----
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c            | 4 +---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c              | 4 +---
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c          | 4 +++-
 drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c          | 4 +++-
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c          | 4 +++-
 drivers/gpu/drm/panel/panel-simple.c                     | 4 +---
 drivers/gpu/drm/panel/panel-sitronix-st7701.c            | 4 +---
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c           | 4 +---
 drivers/gpu/drm/panel/panel-sony-acx424akp.c             | 4 +---
 drivers/gpu/drm/panel/panel-sony-acx565akm.c             | 7 +------
 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c             | 4 +++-
 drivers/gpu/drm/panel/panel-tpo-td043mtea1.c             | 6 +-----
 drivers/gpu/drm/panel/panel-tpo-tpg110.c                 | 4 +++-
 include/drm/drm_panel.h                                  | 2 +-
 43 files changed, 80 insertions(+), 99 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 8c7bac85a793..fab41f63ad12 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -73,13 +73,11 @@ EXPORT_SYMBOL(drm_panel_init);
  *
  * Return: 0 on success or a negative error code on failure.
  */
-int drm_panel_add(struct drm_panel *panel)
+void drm_panel_add(struct drm_panel *panel)
 {
 	mutex_lock(&panel_lock);
 	list_add_tail(&panel->list, &panel_list);
 	mutex_unlock(&panel_lock);
-
-	return 0;
 }
 EXPORT_SYMBOL(drm_panel_add);
 
diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
index 41444a73c980..5aaee5414c40 100644
--- a/drivers/gpu/drm/panel/panel-arm-versatile.c
+++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
@@ -353,7 +353,9 @@ static int versatile_panel_probe(struct platform_device *pdev)
 	drm_panel_init(&vpanel->panel, dev, &versatile_panel_drm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&vpanel->panel);
+	drm_panel_add(&vpanel->panel);
+
+	return 0;
 }
 
 static const struct of_device_id versatile_panel_match[] = {
diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 74d58ee7d04c..e0630ce04147 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -896,7 +896,9 @@ static int panel_add(struct panel_info *pinfo)
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&pinfo->base);
+	drm_panel_add(&pinfo->base);
+
+	return 0;
 }
 
 static int panel_probe(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 2649469070aa..b9379ad92546 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -792,7 +792,9 @@ static int boe_panel_add(struct boe_panel *boe)
 	boe->base.funcs = &boe_panel_funcs;
 	boe->base.dev = &boe->dsi->dev;
 
-	return drm_panel_add(&boe->base);
+	drm_panel_add(&boe->base);
+
+	return 0;
 }
 
 static int boe_panel_probe(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
index fddbfddf6566..7f2eb54e4254 100644
--- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
+++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
@@ -478,9 +478,7 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&ctx->panel);
 
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO;
 	dsi->format = MIPI_DSI_FMT_RGB888;
diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
index 95b789ab9d29..2c168a405928 100644
--- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
+++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
@@ -225,9 +225,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&ctx->panel);
 
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO_BURST;
 	dsi->format = MIPI_DSI_FMT_RGB888;
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
index 873b1c7059bd..4a41d8734cc7 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
@@ -899,7 +899,9 @@ static int ili9322_probe(struct spi_device *spi)
 	drm_panel_init(&ili->panel, dev, &ili9322_drm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&ili->panel);
+	drm_panel_add(&ili->panel);
+
+	return 0;
 }
 
 static int ili9322_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index f54077c216a3..52fd6f3d4452 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -447,9 +447,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&ctx->panel);
 
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
 	dsi->format = MIPI_DSI_FMT_RGB888;
diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
index 7419f1f0acee..cc3e07b61a6c 100644
--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
@@ -477,9 +477,7 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,
 	if (err)
 		return err;
 
-	err = drm_panel_add(&innolux->base);
-	if (err < 0)
-		return err;
+	drm_panel_add(&innolux->base);
 
 	mipi_dsi_set_drvdata(dsi, innolux);
 	innolux->link = dsi;
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index 4bfd8c877c8e..4fc2185575a7 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -441,9 +441,9 @@ static int jdi_panel_add(struct jdi_panel *jdi)
 	drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
-	ret = drm_panel_add(&jdi->base);
+	drm_panel_add(&jdi->base);
 
-	return ret;
+	return 0;
 }
 
 static void jdi_panel_del(struct jdi_panel *jdi)
diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
index bac1a2a06c92..c75790f95461 100644
--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
+++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
@@ -383,7 +383,9 @@ static int kingdisplay_panel_add(struct kingdisplay_panel *kingdisplay)
 	if (err)
 		return err;
 
-	return drm_panel_add(&kingdisplay->base);
+	drm_panel_add(&kingdisplay->base);
+
+	return 0;
 }
 
 static void kingdisplay_panel_del(struct kingdisplay_panel *kingdisplay)
diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
index e90efeaba4ad..8cb403ed2d5f 100644
--- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
+++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
@@ -199,7 +199,9 @@ static int lb035q02_probe(struct spi_device *spi)
 	drm_panel_init(&lcd->panel, &lcd->spi->dev, &lb035q02_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&lcd->panel);
+	drm_panel_add(&lcd->panel);
+
+	return 0;
 }
 
 static int lb035q02_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
index 5907f2503755..02e8e593ba17 100644
--- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
+++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
@@ -262,7 +262,9 @@ static int lg4573_probe(struct spi_device *spi)
 	drm_panel_init(&ctx->panel, &spi->dev, &lg4573_drm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&ctx->panel);
+	drm_panel_add(&ctx->panel);
+
+	return 0;
 }
 
 static int lg4573_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 5ce3f4a2b7a1..41305c3dcf31 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -227,9 +227,7 @@ static int panel_lvds_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&lvds->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&lvds->panel);
 
 	dev_set_drvdata(lvds->dev, lvds);
 	return 0;
diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
index c4f83f6384e1..8217cb9a0658 100644
--- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
@@ -208,7 +208,9 @@ static int nl8048_probe(struct spi_device *spi)
 	drm_panel_init(&lcd->panel, &lcd->spi->dev, &nl8048_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&lcd->panel);
+	drm_panel_add(&lcd->panel);
+
+	return 0;
 }
 
 static int nl8048_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35510.c b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
index 4a8fa908a2cf..9a701a30fe04 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35510.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
@@ -956,9 +956,7 @@ static int nt35510_probe(struct mipi_dsi_device *dsi)
 		nt->panel.backlight = bl;
 	}
 
-	ret = drm_panel_add(&nt->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&nt->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
index 05cae8d62d56..9957b846bcff 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
@@ -303,11 +303,7 @@ static int nt39016_probe(struct spi_device *spi)
 	drm_panel_init(&panel->drm_panel, dev, &nt39016_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	err = drm_panel_add(&panel->drm_panel);
-	if (err < 0) {
-		dev_err(dev, "Failed to register panel");
-		return err;
-	}
+	drm_panel_add(&panel->drm_panel);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
index 09deb99981a4..2edda548fffd 100644
--- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
+++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
@@ -284,7 +284,9 @@ static int lcd_olinuxino_probe(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&lcd->panel);
+	drm_panel_add(&lcd->panel);
+
+	return 0;
 }
 
 static int lcd_olinuxino_remove(struct i2c_client *client)
diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index 3a0229d60095..4fbf12ee858e 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -165,7 +165,9 @@ static int osd101t2587_panel_add(struct osd101t2587_panel *osd101t2587)
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&osd101t2587->base);
+	drm_panel_add(&osd101t2587->base);
+
+	return 0;
 }
 
 static int osd101t2587_panel_probe(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
index 69693451462e..368722d98faf 100644
--- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
+++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
@@ -207,7 +207,9 @@ static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&wuxga_nt->base);
+	drm_panel_add(&wuxga_nt->base);
+
+	return 0;
 }
 
 static void wuxga_nt_panel_del(struct wuxga_nt_panel *wuxga_nt)
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 8f078b7dd89e..25112e5b353b 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -429,9 +429,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
 	/* This appears last, as it's what will unblock the DSI host
 	 * driver's component bind function.
 	 */
-	ret = drm_panel_add(&ts->base);
-	if (ret)
-		return ret;
+	drm_panel_add(&ts->base);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
index 313637d53d28..055201534bf5 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
@@ -610,9 +610,7 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
 		       DRM_MODE_CONNECTOR_DSI);
 	dev_set_drvdata(dev, panel);
 
-	ret = drm_panel_add(&panel->panel);
-	if (ret)
-		return ret;
+	drm_panel_add(&panel->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret)
diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index ef18559e237e..6298051c7244 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -201,9 +201,7 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&ctx->panel);
 
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM;
 	dsi->format = MIPI_DSI_FMT_RGB888;
diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
index 9bb2e8c7934a..358168ed8355 100644
--- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
+++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
@@ -354,7 +354,9 @@ static int ld9040_probe(struct spi_device *spi)
 	drm_panel_init(&ctx->panel, dev, &ld9040_drm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&ctx->panel);
+	drm_panel_add(&ctx->panel);
+
+	return 0;
 }
 
 static int ld9040_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 2150043dcf6b..72c26a63dbe5 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -218,9 +218,7 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
 	drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
-	ret = drm_panel_add(&s6->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&s6->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
index 36ebd5a4ac7b..d242b2f5f2d8 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
@@ -735,9 +735,7 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
 	drm_panel_init(&ctx->panel, dev, &s6e3ha2_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		goto unregister_backlight;
+	drm_panel_add(&ctx->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
index a3570e0a90a8..0c60f61015ff 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
@@ -480,9 +480,7 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
 	ctx->bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
 	ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		goto unregister_backlight;
+	drm_panel_add(&ctx->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index a5f76eb4fa25..40f2f427dc91 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -480,7 +480,9 @@ static int s6e63m0_probe(struct spi_device *spi)
 	if (ret < 0)
 		return ret;
 
-	return drm_panel_add(&ctx->panel);
+	drm_panel_add(&ctx->panel);
+
+	return 0;
 }
 
 static int s6e63m0_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
index 9d843fcc3a22..e17ba1d84481 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
@@ -243,11 +243,7 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi)
 	drm_panel_init(&ctx->panel, dev, &s6e88a0_ams452ef01_panel_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0) {
-		dev_err(dev, "Failed to add panel: %d\n", ret);
-		return ret;
-	}
+	drm_panel_add(&ctx->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0) {
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
index 8a028d2bd0d6..e36cb1a25318 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
@@ -1020,9 +1020,7 @@ static int s6e8aa0_probe(struct mipi_dsi_device *dsi)
 	drm_panel_init(&ctx->panel, dev, &s6e8aa0_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&ctx->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0)
diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
index 40fcbbbacb2c..46428b513a5d 100644
--- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
+++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
@@ -257,9 +257,7 @@ static int seiko_panel_probe(struct device *dev,
 	if (err)
 		return err;
 
-	err = drm_panel_add(&panel->base);
-	if (err < 0)
-		return err;
+	drm_panel_add(&panel->base);
 
 	dev_set_drvdata(dev, panel);
 
diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index b5d1977221a7..9727d3748034 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -326,7 +326,9 @@ static int sharp_panel_add(struct sharp_panel *sharp)
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&sharp->base);
+	drm_panel_add(&sharp->base);
+
+	return 0;
 }
 
 static void sharp_panel_del(struct sharp_panel *sharp)
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
index 1cf3f02435c1..be5cdadf5147 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
@@ -188,7 +188,9 @@ static int ls037v7dw01_probe(struct platform_device *pdev)
 	drm_panel_init(&lcd->panel, &pdev->dev, &ls037v7dw01_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	return drm_panel_add(&lcd->panel);
+	drm_panel_add(&lcd->panel);
+
+	return 0;
 }
 
 static int ls037v7dw01_remove(struct platform_device *pdev)
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index ce586c6d70c7..730efc3d6984 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -262,7 +262,9 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&sharp_nt->base);
+	drm_panel_add(&sharp_nt->base);
+
+	return 0;
 }
 
 static void sharp_nt_panel_del(struct sharp_nt_panel *sharp_nt)
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4aeb960ccf15..b290b2b966c2 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -555,9 +555,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 	if (err)
 		goto free_ddc;
 
-	err = drm_panel_add(&panel->base);
-	if (err < 0)
-		goto free_ddc;
+	drm_panel_add(&panel->base);
 
 	dev_set_drvdata(dev, panel);
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 4b4f2558e3b4..66030978bcf9 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -380,9 +380,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&st7701->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&st7701->panel);
 
 	mipi_dsi_set_drvdata(dsi, st7701);
 	st7701->dsi = dsi;
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index cc02c54c1b2e..6ed8c9823ee6 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -383,9 +383,7 @@ static int st7789v_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	ret = drm_panel_add(&ctx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&ctx->panel);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/panel/panel-sony-acx424akp.c b/drivers/gpu/drm/panel/panel-sony-acx424akp.c
index c91e55b2d7a3..4c46ed9b3f6d 100644
--- a/drivers/gpu/drm/panel/panel-sony-acx424akp.c
+++ b/drivers/gpu/drm/panel/panel-sony-acx424akp.c
@@ -506,9 +506,7 @@ static int acx424akp_probe(struct mipi_dsi_device *dsi)
 	acx->bl->props.brightness = 512;
 	acx->bl->props.power = FB_BLANK_POWERDOWN;
 
-	ret = drm_panel_add(&acx->panel);
-	if (ret < 0)
-		return ret;
+	drm_panel_add(&acx->panel);
 
 	ret = mipi_dsi_attach(dsi);
 	if (ret < 0) {
diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
index 5c4b6f6e5c2d..08442104dc43 100644
--- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
@@ -651,12 +651,7 @@ static int acx565akm_probe(struct spi_device *spi)
 	drm_panel_init(&lcd->panel, &lcd->spi->dev, &acx565akm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	ret = drm_panel_add(&lcd->panel);
-	if (ret < 0) {
-		if (lcd->has_bc)
-			acx565akm_backlight_cleanup(lcd);
-		return ret;
-	}
+	drm_panel_add(&lcd->panel);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
index aeca15dfeb3c..5f4001a21a04 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
@@ -351,7 +351,9 @@ static int td028ttec1_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	return drm_panel_add(&lcd->panel);
+	drm_panel_add(&lcd->panel);
+
+	return 0;
 }
 
 static int td028ttec1_remove(struct spi_device *spi)
diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
index 75f1f1f1b6de..1d7a0df1680e 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
@@ -461,11 +461,7 @@ static int td043mtea1_probe(struct spi_device *spi)
 	drm_panel_init(&lcd->panel, &lcd->spi->dev, &td043mtea1_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
-	ret = drm_panel_add(&lcd->panel);
-	if (ret < 0) {
-		sysfs_remove_group(&spi->dev.kobj, &td043mtea1_attr_group);
-		return ret;
-	}
+	drm_panel_add(&lcd->panel);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
index 8472d018c16f..b54dfcc5b3ef 100644
--- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
+++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
@@ -453,7 +453,9 @@ static int tpg110_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, tpg);
 
-	return drm_panel_add(&tpg->panel);
+	drm_panel_add(&tpg->panel);
+
+	return 0;
 }
 
 static int tpg110_remove(struct spi_device *spi)
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 6193cb555acc..ff066524cb70 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -175,7 +175,7 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
 		    const struct drm_panel_funcs *funcs,
 		    int connector_type);
 
-int drm_panel_add(struct drm_panel *panel);
+void drm_panel_add(struct drm_panel *panel);
 void drm_panel_remove(struct drm_panel *panel);
 
 int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/panel: remove return value of function drm_panel_add
  2020-08-01 12:02 [PATCH] drm/panel: remove return value of function drm_panel_add Bernard Zhao
@ 2020-08-01 14:27 ` Linus Walleij
  2020-08-02  7:07 ` Sam Ravnborg
  1 sibling, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2020-08-01 14:27 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: opensource.kernel, Laurent Pinchart, Stefan Mavrodiev,
	David Airlie, open list:DRM PANEL DRIVERS, Jerry Han,
	linux-kernel, Thierry Reding, Jagan Teki, Thomas Zimmermann,
	Robert Chiras, Sam Ravnborg, Icenowy Zheng

On Sat, Aug 1, 2020 at 2:02 PM Bernard Zhao <bernard@vivo.com> wrote:

> The function "int drm_panel_add(struct drm_panel *panel)"
> always returns 0, this return value is meaningless.
> Also, there is no need to check return value which calls
> "drm_panel_add and", error branch code will never run.
>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>

Makes sense.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/panel: remove return value of function drm_panel_add
  2020-08-01 12:02 [PATCH] drm/panel: remove return value of function drm_panel_add Bernard Zhao
  2020-08-01 14:27 ` Linus Walleij
@ 2020-08-02  7:07 ` Sam Ravnborg
  2020-08-02  8:00   ` [PATCH] drm: Remove unnecessary drm_panel_attach and drm_panel_detach Joe Perches
  1 sibling, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2020-08-02  7:07 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: dri-devel, opensource.kernel, Laurent Pinchart,
	Thomas Zimmermann, Stefan Mavrodiev, David Airlie, Jerry Han,
	linux-kernel, Thierry Reding, Jagan Teki, Robert Chiras,
	Icenowy Zheng

Hi Bernard.

On Sat, Aug 01, 2020 at 08:02:13PM +0800, Bernard Zhao wrote:
> The function "int drm_panel_add(struct drm_panel *panel)"
> always returns 0, this return value is meaningless.
> Also, there is no need to check return value which calls
> "drm_panel_add and", error branch code will never run.

Thanks for this nice cleanup.
Applied to drm-misc-next - so it will appear in -next after the
upcoming merge window and will hit upstream in 5.10

While applying I did the following modifications:
- Fixed kernel-doc as the function returns a void
- Fixed one panel that was missing the conversion
- Fixed warnings due to unused labels


If you are up to another cleanup task there is drm_panel_attach()
and drm_panel_detach() which are no longer needed and all users
and the empty implementations can be dropped.

This will touch a lot of drivers so this change should be split
in one patch/driver.

bridge/* can be handled as one patch I think.
imx/* is already done, awaiting to be applied.

	Sam

> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  drivers/gpu/drm/drm_panel.c                              | 4 +---
>  drivers/gpu/drm/panel/panel-arm-versatile.c              | 4 +++-
>  drivers/gpu/drm/panel/panel-boe-himax8279d.c             | 4 +++-
>  drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c           | 4 +++-
>  drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c        | 4 +---
>  drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c    | 4 +---
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c             | 4 +++-
>  drivers/gpu/drm/panel/panel-ilitek-ili9881c.c            | 4 +---
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c            | 4 +---
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c           | 4 ++--
>  drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c       | 4 +++-
>  drivers/gpu/drm/panel/panel-lg-lb035q02.c                | 4 +++-
>  drivers/gpu/drm/panel/panel-lg-lg4573.c                  | 4 +++-
>  drivers/gpu/drm/panel/panel-lvds.c                       | 4 +---
>  drivers/gpu/drm/panel/panel-nec-nl8048hl11.c             | 4 +++-
>  drivers/gpu/drm/panel/panel-novatek-nt35510.c            | 4 +---
>  drivers/gpu/drm/panel/panel-novatek-nt39016.c            | 6 +-----
>  drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c       | 4 +++-
>  drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c       | 4 +++-
>  drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c     | 4 +++-
>  drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c    | 4 +---
>  drivers/gpu/drm/panel/panel-raydium-rm67191.c            | 4 +---
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c             | 4 +---
>  drivers/gpu/drm/panel/panel-samsung-ld9040.c             | 4 +++-
>  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c            | 4 +---
>  drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c            | 4 +---
>  drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c         | 4 +---
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c            | 4 +++-
>  drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 6 +-----
>  drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c            | 4 +---
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c              | 4 +---
>  drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c          | 4 +++-
>  drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c          | 4 +++-
>  drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c          | 4 +++-
>  drivers/gpu/drm/panel/panel-simple.c                     | 4 +---
>  drivers/gpu/drm/panel/panel-sitronix-st7701.c            | 4 +---
>  drivers/gpu/drm/panel/panel-sitronix-st7789v.c           | 4 +---
>  drivers/gpu/drm/panel/panel-sony-acx424akp.c             | 4 +---
>  drivers/gpu/drm/panel/panel-sony-acx565akm.c             | 7 +------
>  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c             | 4 +++-
>  drivers/gpu/drm/panel/panel-tpo-td043mtea1.c             | 6 +-----
>  drivers/gpu/drm/panel/panel-tpo-tpg110.c                 | 4 +++-
>  include/drm/drm_panel.h                                  | 2 +-
>  43 files changed, 80 insertions(+), 99 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 8c7bac85a793..fab41f63ad12 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -73,13 +73,11 @@ EXPORT_SYMBOL(drm_panel_init);
>   *
>   * Return: 0 on success or a negative error code on failure.
>   */
> -int drm_panel_add(struct drm_panel *panel)
> +void drm_panel_add(struct drm_panel *panel)
>  {
>  	mutex_lock(&panel_lock);
>  	list_add_tail(&panel->list, &panel_list);
>  	mutex_unlock(&panel_lock);
> -
> -	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_add);
>  
> diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
> index 41444a73c980..5aaee5414c40 100644
> --- a/drivers/gpu/drm/panel/panel-arm-versatile.c
> +++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
> @@ -353,7 +353,9 @@ static int versatile_panel_probe(struct platform_device *pdev)
>  	drm_panel_init(&vpanel->panel, dev, &versatile_panel_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&vpanel->panel);
> +	drm_panel_add(&vpanel->panel);
> +
> +	return 0;
>  }
>  
>  static const struct of_device_id versatile_panel_match[] = {
> diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
> index 74d58ee7d04c..e0630ce04147 100644
> --- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
> +++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
> @@ -896,7 +896,9 @@ static int panel_add(struct panel_info *pinfo)
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&pinfo->base);
> +	drm_panel_add(&pinfo->base);
> +
> +	return 0;
>  }
>  
>  static int panel_probe(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
> index 2649469070aa..b9379ad92546 100644
> --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
> +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
> @@ -792,7 +792,9 @@ static int boe_panel_add(struct boe_panel *boe)
>  	boe->base.funcs = &boe_panel_funcs;
>  	boe->base.dev = &boe->dsi->dev;
>  
> -	return drm_panel_add(&boe->base);
> +	drm_panel_add(&boe->base);
> +
> +	return 0;
>  }
>  
>  static int boe_panel_probe(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> index fddbfddf6566..7f2eb54e4254 100644
> --- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> +++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
> @@ -478,9 +478,7 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&ctx->panel);
>  
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO;
>  	dsi->format = MIPI_DSI_FMT_RGB888;
> diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> index 95b789ab9d29..2c168a405928 100644
> --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> @@ -225,9 +225,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&ctx->panel);
>  
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO_BURST;
>  	dsi->format = MIPI_DSI_FMT_RGB888;
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> index 873b1c7059bd..4a41d8734cc7 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> @@ -899,7 +899,9 @@ static int ili9322_probe(struct spi_device *spi)
>  	drm_panel_init(&ili->panel, dev, &ili9322_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&ili->panel);
> +	drm_panel_add(&ili->panel);
> +
> +	return 0;
>  }
>  
>  static int ili9322_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> index f54077c216a3..52fd6f3d4452 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> @@ -447,9 +447,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&ctx->panel);
>  
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
>  	dsi->format = MIPI_DSI_FMT_RGB888;
> diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> index 7419f1f0acee..cc3e07b61a6c 100644
> --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> @@ -477,9 +477,7 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,
>  	if (err)
>  		return err;
>  
> -	err = drm_panel_add(&innolux->base);
> -	if (err < 0)
> -		return err;
> +	drm_panel_add(&innolux->base);
>  
>  	mipi_dsi_set_drvdata(dsi, innolux);
>  	innolux->link = dsi;
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> index 4bfd8c877c8e..4fc2185575a7 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -441,9 +441,9 @@ static int jdi_panel_add(struct jdi_panel *jdi)
>  	drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);
>  
> -	ret = drm_panel_add(&jdi->base);
> +	drm_panel_add(&jdi->base);
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static void jdi_panel_del(struct jdi_panel *jdi)
> diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> index bac1a2a06c92..c75790f95461 100644
> --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> @@ -383,7 +383,9 @@ static int kingdisplay_panel_add(struct kingdisplay_panel *kingdisplay)
>  	if (err)
>  		return err;
>  
> -	return drm_panel_add(&kingdisplay->base);
> +	drm_panel_add(&kingdisplay->base);
> +
> +	return 0;
>  }
>  
>  static void kingdisplay_panel_del(struct kingdisplay_panel *kingdisplay)
> diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> index e90efeaba4ad..8cb403ed2d5f 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> @@ -199,7 +199,9 @@ static int lb035q02_probe(struct spi_device *spi)
>  	drm_panel_init(&lcd->panel, &lcd->spi->dev, &lb035q02_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&lcd->panel);
> +	drm_panel_add(&lcd->panel);
> +
> +	return 0;
>  }
>  
>  static int lb035q02_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> index 5907f2503755..02e8e593ba17 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> @@ -262,7 +262,9 @@ static int lg4573_probe(struct spi_device *spi)
>  	drm_panel_init(&ctx->panel, &spi->dev, &lg4573_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&ctx->panel);
> +	drm_panel_add(&ctx->panel);
> +
> +	return 0;
>  }
>  
>  static int lg4573_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index 5ce3f4a2b7a1..41305c3dcf31 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -227,9 +227,7 @@ static int panel_lvds_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&lvds->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&lvds->panel);
>  
>  	dev_set_drvdata(lvds->dev, lvds);
>  	return 0;
> diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> index c4f83f6384e1..8217cb9a0658 100644
> --- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> @@ -208,7 +208,9 @@ static int nl8048_probe(struct spi_device *spi)
>  	drm_panel_init(&lcd->panel, &lcd->spi->dev, &nl8048_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&lcd->panel);
> +	drm_panel_add(&lcd->panel);
> +
> +	return 0;
>  }
>  
>  static int nl8048_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35510.c b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> index 4a8fa908a2cf..9a701a30fe04 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> @@ -956,9 +956,7 @@ static int nt35510_probe(struct mipi_dsi_device *dsi)
>  		nt->panel.backlight = bl;
>  	}
>  
> -	ret = drm_panel_add(&nt->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&nt->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0)
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> index 05cae8d62d56..9957b846bcff 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> @@ -303,11 +303,7 @@ static int nt39016_probe(struct spi_device *spi)
>  	drm_panel_init(&panel->drm_panel, dev, &nt39016_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	err = drm_panel_add(&panel->drm_panel);
> -	if (err < 0) {
> -		dev_err(dev, "Failed to register panel");
> -		return err;
> -	}
> +	drm_panel_add(&panel->drm_panel);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> index 09deb99981a4..2edda548fffd 100644
> --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> @@ -284,7 +284,9 @@ static int lcd_olinuxino_probe(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&lcd->panel);
> +	drm_panel_add(&lcd->panel);
> +
> +	return 0;
>  }
>  
>  static int lcd_olinuxino_remove(struct i2c_client *client)
> diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> index 3a0229d60095..4fbf12ee858e 100644
> --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> @@ -165,7 +165,9 @@ static int osd101t2587_panel_add(struct osd101t2587_panel *osd101t2587)
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&osd101t2587->base);
> +	drm_panel_add(&osd101t2587->base);
> +
> +	return 0;
>  }
>  
>  static int osd101t2587_panel_probe(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> index 69693451462e..368722d98faf 100644
> --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> @@ -207,7 +207,9 @@ static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&wuxga_nt->base);
> +	drm_panel_add(&wuxga_nt->base);
> +
> +	return 0;
>  }
>  
>  static void wuxga_nt_panel_del(struct wuxga_nt_panel *wuxga_nt)
> diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> index 8f078b7dd89e..25112e5b353b 100644
> --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> @@ -429,9 +429,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c,
>  	/* This appears last, as it's what will unblock the DSI host
>  	 * driver's component bind function.
>  	 */
> -	ret = drm_panel_add(&ts->base);
> -	if (ret)
> -		return ret;
> +	drm_panel_add(&ts->base);
>  
>  	return 0;
>  
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> index 313637d53d28..055201534bf5 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> @@ -610,9 +610,7 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
>  		       DRM_MODE_CONNECTOR_DSI);
>  	dev_set_drvdata(dev, panel);
>  
> -	ret = drm_panel_add(&panel->panel);
> -	if (ret)
> -		return ret;
> +	drm_panel_add(&panel->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret)
> diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> index ef18559e237e..6298051c7244 100644
> --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> @@ -201,9 +201,7 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&ctx->panel);
>  
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM;
>  	dsi->format = MIPI_DSI_FMT_RGB888;
> diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> index 9bb2e8c7934a..358168ed8355 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> @@ -354,7 +354,9 @@ static int ld9040_probe(struct spi_device *spi)
>  	drm_panel_init(&ctx->panel, dev, &ld9040_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&ctx->panel);
> +	drm_panel_add(&ctx->panel);
> +
> +	return 0;
>  }
>  
>  static int ld9040_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> index 2150043dcf6b..72c26a63dbe5 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> @@ -218,9 +218,7 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
>  	drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);
>  
> -	ret = drm_panel_add(&s6->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&s6->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> index 36ebd5a4ac7b..d242b2f5f2d8 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> @@ -735,9 +735,7 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
>  	drm_panel_init(&ctx->panel, dev, &s6e3ha2_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		goto unregister_backlight;
> +	drm_panel_add(&ctx->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> index a3570e0a90a8..0c60f61015ff 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> @@ -480,9 +480,7 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
>  	ctx->bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
>  	ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		goto unregister_backlight;
> +	drm_panel_add(&ctx->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index a5f76eb4fa25..40f2f427dc91 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -480,7 +480,9 @@ static int s6e63m0_probe(struct spi_device *spi)
>  	if (ret < 0)
>  		return ret;
>  
> -	return drm_panel_add(&ctx->panel);
> +	drm_panel_add(&ctx->panel);
> +
> +	return 0;
>  }
>  
>  static int s6e63m0_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
> index 9d843fcc3a22..e17ba1d84481 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
> @@ -243,11 +243,7 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi)
>  	drm_panel_init(&ctx->panel, dev, &s6e88a0_ams452ef01_panel_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0) {
> -		dev_err(dev, "Failed to add panel: %d\n", ret);
> -		return ret;
> -	}
> +	drm_panel_add(&ctx->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0) {
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> index 8a028d2bd0d6..e36cb1a25318 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> @@ -1020,9 +1020,7 @@ static int s6e8aa0_probe(struct mipi_dsi_device *dsi)
>  	drm_panel_init(&ctx->panel, dev, &s6e8aa0_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&ctx->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0)
> diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> index 40fcbbbacb2c..46428b513a5d 100644
> --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> @@ -257,9 +257,7 @@ static int seiko_panel_probe(struct device *dev,
>  	if (err)
>  		return err;
>  
> -	err = drm_panel_add(&panel->base);
> -	if (err < 0)
> -		return err;
> +	drm_panel_add(&panel->base);
>  
>  	dev_set_drvdata(dev, panel);
>  
> diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> index b5d1977221a7..9727d3748034 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> @@ -326,7 +326,9 @@ static int sharp_panel_add(struct sharp_panel *sharp)
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&sharp->base);
> +	drm_panel_add(&sharp->base);
> +
> +	return 0;
>  }
>  
>  static void sharp_panel_del(struct sharp_panel *sharp)
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> index 1cf3f02435c1..be5cdadf5147 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> @@ -188,7 +188,9 @@ static int ls037v7dw01_probe(struct platform_device *pdev)
>  	drm_panel_init(&lcd->panel, &pdev->dev, &ls037v7dw01_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	return drm_panel_add(&lcd->panel);
> +	drm_panel_add(&lcd->panel);
> +
> +	return 0;
>  }
>  
>  static int ls037v7dw01_remove(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> index ce586c6d70c7..730efc3d6984 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> @@ -262,7 +262,9 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&sharp_nt->base);
> +	drm_panel_add(&sharp_nt->base);
> +
> +	return 0;
>  }
>  
>  static void sharp_nt_panel_del(struct sharp_nt_panel *sharp_nt)
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 4aeb960ccf15..b290b2b966c2 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -555,9 +555,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>  	if (err)
>  		goto free_ddc;
>  
> -	err = drm_panel_add(&panel->base);
> -	if (err < 0)
> -		goto free_ddc;
> +	drm_panel_add(&panel->base);
>  
>  	dev_set_drvdata(dev, panel);
>  
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> index 4b4f2558e3b4..66030978bcf9 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> @@ -380,9 +380,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&st7701->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&st7701->panel);
>  
>  	mipi_dsi_set_drvdata(dsi, st7701);
>  	st7701->dsi = dsi;
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index cc02c54c1b2e..6ed8c9823ee6 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -383,9 +383,7 @@ static int st7789v_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> -	ret = drm_panel_add(&ctx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&ctx->panel);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sony-acx424akp.c b/drivers/gpu/drm/panel/panel-sony-acx424akp.c
> index c91e55b2d7a3..4c46ed9b3f6d 100644
> --- a/drivers/gpu/drm/panel/panel-sony-acx424akp.c
> +++ b/drivers/gpu/drm/panel/panel-sony-acx424akp.c
> @@ -506,9 +506,7 @@ static int acx424akp_probe(struct mipi_dsi_device *dsi)
>  	acx->bl->props.brightness = 512;
>  	acx->bl->props.power = FB_BLANK_POWERDOWN;
>  
> -	ret = drm_panel_add(&acx->panel);
> -	if (ret < 0)
> -		return ret;
> +	drm_panel_add(&acx->panel);
>  
>  	ret = mipi_dsi_attach(dsi);
>  	if (ret < 0) {
> diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> index 5c4b6f6e5c2d..08442104dc43 100644
> --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> @@ -651,12 +651,7 @@ static int acx565akm_probe(struct spi_device *spi)
>  	drm_panel_init(&lcd->panel, &lcd->spi->dev, &acx565akm_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	ret = drm_panel_add(&lcd->panel);
> -	if (ret < 0) {
> -		if (lcd->has_bc)
> -			acx565akm_backlight_cleanup(lcd);
> -		return ret;
> -	}
> +	drm_panel_add(&lcd->panel);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> index aeca15dfeb3c..5f4001a21a04 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> @@ -351,7 +351,9 @@ static int td028ttec1_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> -	return drm_panel_add(&lcd->panel);
> +	drm_panel_add(&lcd->panel);
> +
> +	return 0;
>  }
>  
>  static int td028ttec1_remove(struct spi_device *spi)
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> index 75f1f1f1b6de..1d7a0df1680e 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> @@ -461,11 +461,7 @@ static int td043mtea1_probe(struct spi_device *spi)
>  	drm_panel_init(&lcd->panel, &lcd->spi->dev, &td043mtea1_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	ret = drm_panel_add(&lcd->panel);
> -	if (ret < 0) {
> -		sysfs_remove_group(&spi->dev.kobj, &td043mtea1_attr_group);
> -		return ret;
> -	}
> +	drm_panel_add(&lcd->panel);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> index 8472d018c16f..b54dfcc5b3ef 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> @@ -453,7 +453,9 @@ static int tpg110_probe(struct spi_device *spi)
>  
>  	spi_set_drvdata(spi, tpg);
>  
> -	return drm_panel_add(&tpg->panel);
> +	drm_panel_add(&tpg->panel);
> +
> +	return 0;
>  }
>  
>  static int tpg110_remove(struct spi_device *spi)
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 6193cb555acc..ff066524cb70 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -175,7 +175,7 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
>  		    const struct drm_panel_funcs *funcs,
>  		    int connector_type);
>  
> -int drm_panel_add(struct drm_panel *panel);
> +void drm_panel_add(struct drm_panel *panel);
>  void drm_panel_remove(struct drm_panel *panel);
>  
>  int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
> -- 
> 2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH] drm: Remove unnecessary drm_panel_attach and drm_panel_detach
  2020-08-02  7:07 ` Sam Ravnborg
@ 2020-08-02  8:00   ` Joe Perches
  2020-08-02  8:44     ` Sam Ravnborg
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2020-08-02  8:00 UTC (permalink / raw)
  To: Sam Ravnborg, Bernard Zhao
  Cc: dri-devel, opensource.kernel, Laurent Pinchart,
	Thomas Zimmermann, Stefan Mavrodiev, David Airlie, Jerry Han,
	linux-kernel, Thierry Reding, Jagan Teki, Robert Chiras,
	Icenowy Zheng

These functions are now empty and no longer
useful so remove the functions and their uses.

Signed-off-by: Joe Perches <joe@perches.com>
---

It's too tedious to break apart into multiple patches.
Done with coccinelle and typing.

Compiled allyesconfig x86-64 only.

 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 12 --------
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  9 ------
 drivers/gpu/drm/bridge/nxp-ptn3460.c               |  3 --
 drivers/gpu/drm/bridge/panel.c                     |  7 -----
 drivers/gpu/drm/bridge/parade-ps8622.c             |  3 --
 drivers/gpu/drm/bridge/tc358764.c                  |  2 --
 drivers/gpu/drm/bridge/tc358767.c                  |  3 --
 drivers/gpu/drm/bridge/ti-sn65dsi86.c              |  3 --
 drivers/gpu/drm/drm_panel.c                        | 36 ----------------------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c            |  6 ----
 drivers/gpu/drm/exynos/exynos_drm_dsi.c            |  7 ++---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |  7 -----
 drivers/gpu/drm/imx/imx-ldb.c                      | 10 ------
 drivers/gpu/drm/imx/parallel-display.c             |  6 ----
 .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |  7 +----
 drivers/gpu/drm/msm/dsi/dsi_manager.c              |  1 -
 drivers/gpu/drm/mxsfb/mxsfb_drv.c                  |  7 +----
 drivers/gpu/drm/mxsfb/mxsfb_out.c                  |  6 ----
 drivers/gpu/drm/omapdrm/omap_drv.c                 | 15 ---------
 drivers/gpu/drm/rcar-du/rcar_lvds.c                |  6 +---
 drivers/gpu/drm/rockchip/rockchip_lvds.c           |  9 ------
 drivers/gpu/drm/sti/sti_dvo.c                      |  2 --
 drivers/gpu/drm/sun4i/sun4i_lvds.c                 |  7 -----
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |  7 -----
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |  2 --
 drivers/gpu/drm/tegra/dsi.c                        |  4 +--
 drivers/gpu/drm/tegra/output.c                     | 10 ------
 include/drm/drm_panel.h                            |  3 --
 28 files changed, 6 insertions(+), 194 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
index f082b4ed4878..d9164fab044d 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -507,10 +507,6 @@ static const struct drm_connector_helper_funcs anx6345_connector_helper_funcs =
 static void
 anx6345_connector_destroy(struct drm_connector *connector)
 {
-	struct anx6345 *anx6345 = connector_to_anx6345(connector);
-
-	if (anx6345->panel)
-		drm_panel_detach(anx6345->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -575,14 +571,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge,
 		return err;
 	}
 
-	if (anx6345->panel) {
-		err = drm_panel_attach(anx6345->panel, &anx6345->connector);
-		if (err) {
-			DRM_ERROR("Failed to attach panel: %d\n", err);
-			return err;
-		}
-	}
-
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 76736fb8ed94..aa1bb86293fd 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1265,14 +1265,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
 		}
 	}
 
-	if (dp->plat_data->panel) {
-		ret = drm_panel_attach(dp->plat_data->panel, &dp->connector);
-		if (ret) {
-			DRM_ERROR("Failed to attach panel\n");
-			return ret;
-		}
-	}
-
 	return 0;
 }
 
@@ -1803,7 +1795,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp)
 	if (dp->plat_data->panel) {
 		if (drm_panel_unprepare(dp->plat_data->panel))
 			DRM_ERROR("failed to turnoff the panel\n");
-		drm_panel_detach(dp->plat_data->panel);
 	}
 
 	drm_dp_aux_unregister(&dp->aux);
diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
index 438e566ce0a4..d433902d97e5 100644
--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
+++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
@@ -265,9 +265,6 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge,
 	drm_connector_attach_encoder(&ptn_bridge->connector,
 							bridge->encoder);
 
-	if (ptn_bridge->panel)
-		drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);
-
 	drm_helper_hpd_irq_event(ptn_bridge->connector.dev);
 
 	return ret;
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 1e63ed6b18aa..0ddc37551194 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -82,18 +82,11 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
 	drm_connector_attach_encoder(&panel_bridge->connector,
 					  bridge->encoder);
 
-	ret = drm_panel_attach(panel_bridge->panel, &panel_bridge->connector);
-	if (ret < 0)
-		return ret;
-
 	return 0;
 }
 
 static void panel_bridge_detach(struct drm_bridge *bridge)
 {
-	struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
-
-	drm_panel_detach(panel_bridge->panel);
 }
 
 static void panel_bridge_pre_enable(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
index d789ea2a7fb9..c13ec77d858b 100644
--- a/drivers/gpu/drm/bridge/parade-ps8622.c
+++ b/drivers/gpu/drm/bridge/parade-ps8622.c
@@ -505,9 +505,6 @@ static int ps8622_attach(struct drm_bridge *bridge,
 	drm_connector_attach_encoder(&ps8622->connector,
 							bridge->encoder);
 
-	if (ps8622->panel)
-		drm_panel_attach(ps8622->panel, &ps8622->connector);
-
 	drm_helper_hpd_irq_event(ps8622->connector.dev);
 
 	return ret;
diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c
index 5ac1430fab04..c1e35bdf9232 100644
--- a/drivers/gpu/drm/bridge/tc358764.c
+++ b/drivers/gpu/drm/bridge/tc358764.c
@@ -373,7 +373,6 @@ static int tc358764_attach(struct drm_bridge *bridge,
 	drm_connector_helper_add(&ctx->connector,
 				 &tc358764_connector_helper_funcs);
 	drm_connector_attach_encoder(&ctx->connector, bridge->encoder);
-	drm_panel_attach(ctx->panel, &ctx->connector);
 	ctx->connector.funcs->reset(&ctx->connector);
 	drm_connector_register(&ctx->connector);
 
@@ -385,7 +384,6 @@ static void tc358764_detach(struct drm_bridge *bridge)
 	struct tc358764 *ctx = bridge_to_tc358764(bridge);
 
 	drm_connector_unregister(&ctx->connector);
-	drm_panel_detach(ctx->panel);
 	ctx->panel = NULL;
 	drm_connector_put(&ctx->connector);
 }
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index c2777b226c75..0746462ba0f6 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1435,9 +1435,6 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
 					       DRM_CONNECTOR_POLL_DISCONNECT;
 	}
 
-	if (tc->panel)
-		drm_panel_attach(tc->panel, &tc->connector);
-
 	drm_display_info_set_bus_formats(&tc->connector.display_info,
 					 &bus_format, 1);
 	tc->connector.display_info.bus_flags =
diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index 86b9f0f87a14..454544e0da7d 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -394,9 +394,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
 	}
 	pdata->dsi = dsi;
 
-	/* attach panel to bridge */
-	drm_panel_attach(pdata->panel, &pdata->connector);
-
 	return 0;
 
 err_dsi_attach:
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 8c7bac85a793..7804b9947fe8 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -97,42 +97,6 @@ void drm_panel_remove(struct drm_panel *panel)
 }
 EXPORT_SYMBOL(drm_panel_remove);
 
-/**
- * drm_panel_attach - attach a panel to a connector
- * @panel: DRM panel
- * @connector: DRM connector
- *
- * After obtaining a pointer to a DRM panel a display driver calls this
- * function to attach a panel to a connector.
- *
- * An error is returned if the panel is already attached to another connector.
- *
- * When unloading, the driver should detach from the panel by calling
- * drm_panel_detach().
- *
- * Return: 0 on success or a negative error code on failure.
- */
-int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
-{
-	return 0;
-}
-EXPORT_SYMBOL(drm_panel_attach);
-
-/**
- * drm_panel_detach - detach a panel from a connector
- * @panel: DRM panel
- *
- * Detaches a panel from the connector it is attached to. If a panel is not
- * attached to any connector this is effectively a no-op.
- *
- * This function should not be called by the panel device itself. It
- * is only for the drm device that called drm_panel_attach().
- */
-void drm_panel_detach(struct drm_panel *panel)
-{
-}
-EXPORT_SYMBOL(drm_panel_detach);
-
 /**
  * drm_panel_prepare - power on a panel
  * @panel: DRM panel
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 7ba5354e7d94..5f5ba64fc1ff 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -44,9 +44,6 @@ exynos_dpi_detect(struct drm_connector *connector, bool force)
 {
 	struct exynos_dpi *ctx = connector_to_dpi(connector);
 
-	if (ctx->panel)
-		drm_panel_attach(ctx->panel, &ctx->connector);
-
 	return connector_status_connected;
 }
 
@@ -249,8 +246,5 @@ int exynos_dpi_remove(struct drm_encoder *encoder)
 
 	exynos_dpi_disable(&ctx->encoder);
 
-	if (ctx->panel)
-		drm_panel_detach(ctx->panel);
-
 	return 0;
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 7a6f6df5e954..843dfcefc46a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1551,12 +1551,10 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 		}
 
 		dsi->panel = of_drm_find_panel(device->dev.of_node);
-		if (IS_ERR(dsi->panel)) {
+		if (IS_ERR(dsi->panel))
 			dsi->panel = NULL;
-		} else {
-			drm_panel_attach(dsi->panel, &dsi->connector);
+		else
 			dsi->connector.status = connector_status_connected;
-		}
 	}
 
 	/*
@@ -1596,7 +1594,6 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
 	if (dsi->panel) {
 		mutex_lock(&drm->mode_config.mutex);
 		exynos_dsi_disable(&dsi->encoder);
-		drm_panel_detach(dsi->panel);
 		dsi->panel = NULL;
 		dsi->connector.status = connector_status_disconnected;
 		mutex_unlock(&drm->mode_config.mutex);
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index 9b0c4736c21a..0a7071827533 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -43,7 +43,6 @@ static void fsl_dcu_drm_connector_destroy(struct drm_connector *connector)
 	struct fsl_dcu_drm_connector *fsl_con = to_fsl_dcu_connector(connector);
 
 	drm_connector_unregister(connector);
-	drm_panel_detach(fsl_con->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -101,12 +100,6 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev,
 	if (ret < 0)
 		goto err_sysfs;
 
-	ret = drm_panel_attach(panel, connector);
-	if (ret) {
-		dev_err(fsl_dev->dev, "failed to attach panel\n");
-		goto err_sysfs;
-	}
-
 	return 0;
 
 err_sysfs:
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 8791d60be92e..af757d1e21fe 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -455,13 +455,6 @@ static int imx_ldb_register(struct drm_device *drm,
 		drm_connector_attach_encoder(&imx_ldb_ch->connector, encoder);
 	}
 
-	if (imx_ldb_ch->panel) {
-		ret = drm_panel_attach(imx_ldb_ch->panel,
-				       &imx_ldb_ch->connector);
-		if (ret)
-			return ret;
-	}
-
 	return 0;
 }
 
@@ -702,9 +695,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
 	for (i = 0; i < 2; i++) {
 		struct imx_ldb_channel *channel = &imx_ldb->channel[i];
 
-		if (channel->panel)
-			drm_panel_detach(channel->panel);
-
 		kfree(channel->edid);
 		i2c_put_adapter(channel->ddc);
 	}
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index a831b5bd1613..8232f512b9ed 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -289,9 +289,6 @@ static int imx_pd_register(struct drm_device *drm,
 				   DRM_MODE_CONNECTOR_DPI);
 	}
 
-	if (imxpd->panel)
-		drm_panel_attach(imxpd->panel, &imxpd->connector);
-
 	if (imxpd->next_bridge) {
 		ret = drm_bridge_attach(encoder, imxpd->next_bridge,
 					&imxpd->bridge, 0);
@@ -357,9 +354,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master,
 {
 	struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
 
-	if (imxpd->panel)
-		drm_panel_detach(imxpd->panel);
-
 	kfree(imxpd->edid);
 }
 
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
index c7df71e2fafc..7288041dd86a 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
@@ -50,14 +50,9 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
 	struct drm_panel *panel = mdp4_lvds_connector->panel;
 	int ret = 0;
 
-	if (panel) {
-		drm_panel_attach(panel, connector);
-
+	if (panel)
 		ret = drm_panel_get_modes(panel, connector);
 
-		drm_panel_detach(panel);
-	}
-
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 4b363bd7ddff..1d28dfba2c9b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -328,7 +328,6 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
 	 * In dual DSI mode, we have one connector that can be
 	 * attached to the drm_panel.
 	 */
-	drm_panel_attach(panel, connector);
 	num = drm_panel_get_modes(panel, connector);
 	if (!num)
 		return 0;
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 508764fccd27..51da0e3de587 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -265,11 +265,7 @@ static int mxsfb_load(struct drm_device *drm)
 	 */
 
 	if (mxsfb->panel) {
-		ret = drm_panel_attach(mxsfb->panel, mxsfb->connector);
-		if (ret) {
-			dev_err(drm->dev, "Cannot connect panel: %d\n", ret);
-			goto err_vblank;
-		}
+		;
 	} else if (mxsfb->bridge) {
 		ret = drm_simple_display_pipe_attach_bridge(&mxsfb->pipe,
 							    mxsfb->bridge);
@@ -306,7 +302,6 @@ static int mxsfb_load(struct drm_device *drm)
 	return 0;
 
 err_irq:
-	drm_panel_detach(mxsfb->panel);
 err_vblank:
 	pm_runtime_disable(drm->dev);
 
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_out.c b/drivers/gpu/drm/mxsfb/mxsfb_out.c
index 9eca1605d11d..f93e7a4d4c15 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_out.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_out.c
@@ -55,12 +55,6 @@ mxsfb_panel_connector_detect(struct drm_connector *connector, bool force)
 
 static void mxsfb_panel_connector_destroy(struct drm_connector *connector)
 {
-	struct mxsfb_drm_private *mxsfb =
-			drm_connector_to_mxsfb_drm_private(connector);
-
-	if (mxsfb->panel)
-		drm_panel_detach(mxsfb->panel);
-
 	drm_connector_unregister(connector);
 	drm_connector_cleanup(connector);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 4526967978b7..db8106afd91f 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -349,13 +349,6 @@ static int omap_modeset_init(struct drm_device *dev)
 
 		drm_connector_attach_encoder(pipe->connector, encoder);
 
-		if (pipe->output->panel) {
-			ret = drm_panel_attach(pipe->output->panel,
-					       pipe->connector);
-			if (ret < 0)
-				return ret;
-		}
-
 		crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
 		if (IS_ERR(crtc))
 			return PTR_ERR(crtc);
@@ -395,17 +388,9 @@ static int omap_modeset_init(struct drm_device *dev)
 static void omap_modeset_fini(struct drm_device *ddev)
 {
 	struct omap_drm_private *priv = ddev->dev_private;
-	unsigned int i;
 
 	omap_drm_irq_uninstall(ddev);
 
-	for (i = 0; i < priv->num_pipes; i++) {
-		struct omap_drm_pipeline *pipe = &priv->pipes[i];
-
-		if (pipe->output->panel)
-			drm_panel_detach(pipe->output->panel);
-	}
-
 	drm_mode_config_cleanup(ddev);
 }
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index ab0d49618cf9..bced729a96fe 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -677,15 +677,11 @@ static int rcar_lvds_attach(struct drm_bridge *bridge,
 	if (ret < 0)
 		return ret;
 
-	return drm_panel_attach(lvds->panel, connector);
+	return 0;
 }
 
 static void rcar_lvds_detach(struct drm_bridge *bridge)
 {
-	struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
-
-	if (lvds->panel)
-		drm_panel_detach(lvds->panel);
 }
 
 static const struct drm_bridge_funcs rcar_lvds_bridge_ops = {
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 63f967902c2d..f292c6a6e20f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -634,13 +634,6 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
 				      "failed to attach encoder: %d\n", ret);
 			goto err_free_connector;
 		}
-
-		ret = drm_panel_attach(lvds->panel, connector);
-		if (ret < 0) {
-			DRM_DEV_ERROR(drm_dev->dev,
-				      "failed to attach panel: %d\n", ret);
-			goto err_free_connector;
-		}
 	} else {
 		ret = drm_bridge_attach(encoder, lvds->bridge, NULL, 0);
 		if (ret) {
@@ -676,8 +669,6 @@ static void rockchip_lvds_unbind(struct device *dev, struct device *master,
 
 	encoder_funcs = lvds->soc_data->helper_funcs;
 	encoder_funcs->disable(&lvds->encoder);
-	if (lvds->panel)
-		drm_panel_detach(lvds->panel);
 	pm_runtime_disable(dev);
 	drm_connector_cleanup(&lvds->connector);
 	drm_encoder_cleanup(&lvds->encoder);
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index de4af7735c46..ddb4184f0726 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -389,8 +389,6 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
 		dvo->panel = of_drm_find_panel(dvo->panel_node);
 		if (IS_ERR(dvo->panel))
 			dvo->panel = NULL;
-		else
-			drm_panel_attach(dvo->panel, connector);
 	}
 
 	if (dvo->panel)
diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c
index ffda3184aa12..f8a1ff4bf1bb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
+++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
@@ -56,7 +56,6 @@ sun4i_lvds_connector_destroy(struct drm_connector *connector)
 {
 	struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
 
-	drm_panel_detach(lvds->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -141,12 +140,6 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 
 		drm_connector_attach_encoder(&lvds->connector,
 						  &lvds->encoder);
-
-		ret = drm_panel_attach(lvds->panel, &lvds->connector);
-		if (ret) {
-			dev_err(drm->dev, "Couldn't attach our panel\n");
-			goto err_cleanup_connector;
-		}
 	}
 
 	if (bridge) {
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 5a7d43939ae6..e08afdffef50 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -147,7 +147,6 @@ sun4i_rgb_connector_destroy(struct drm_connector *connector)
 {
 	struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
 
-	drm_panel_detach(rgb->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -233,12 +232,6 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 
 		drm_connector_attach_encoder(&rgb->connector,
 						  &rgb->encoder);
-
-		ret = drm_panel_attach(rgb->panel, &rgb->connector);
-		if (ret) {
-			dev_err(drm->dev, "Couldn't attach our panel\n");
-			goto err_cleanup_connector;
-		}
 	}
 
 	if (rgb->bridge) {
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index aa67cb037e9d..128471b65f64 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -973,7 +973,6 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 	dsi->panel = panel;
 	dsi->device = device;
 
-	drm_panel_attach(dsi->panel, &dsi->connector);
 	drm_kms_helper_hotplug_event(dsi->drm);
 
 	dev_info(host->dev, "Attached device %s\n", device->name);
@@ -990,7 +989,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
 	dsi->panel = NULL;
 	dsi->device = NULL;
 
-	drm_panel_detach(panel);
 	drm_kms_helper_hotplug_event(dsi->drm);
 
 	return 0;
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 3820e8dff14b..3387de79718b 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1498,10 +1498,8 @@ static int tegra_dsi_host_attach(struct mipi_dsi_host *host,
 		if (IS_ERR(output->panel))
 			output->panel = NULL;
 
-		if (output->panel && output->connector.dev) {
-			drm_panel_attach(output->panel, &output->connector);
+		if (output->panel && output->connector.dev)
 			drm_helper_hpd_irq_event(output->connector.dev);
-		}
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index e36e5e7c2f69..a3adb9e4debf 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -179,13 +179,6 @@ void tegra_output_remove(struct tegra_output *output)
 int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
 {
 	int connector_type;
-	int err;
-
-	if (output->panel) {
-		err = drm_panel_attach(output->panel, &output->connector);
-		if (err < 0)
-			return err;
-	}
 
 	/*
 	 * The connector is now registered and ready to receive hotplug events
@@ -220,9 +213,6 @@ void tegra_output_exit(struct tegra_output *output)
 	 */
 	if (output->hpd_gpio)
 		disable_irq(output->hpd_irq);
-
-	if (output->panel)
-		drm_panel_detach(output->panel);
 }
 
 void tegra_output_find_possible_crtcs(struct tegra_output *output,
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 6193cb555acc..9b374f88fb76 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -178,9 +178,6 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
 int drm_panel_add(struct drm_panel *panel);
 void drm_panel_remove(struct drm_panel *panel);
 
-int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
-void drm_panel_detach(struct drm_panel *panel);
-
 int drm_panel_prepare(struct drm_panel *panel);
 int drm_panel_unprepare(struct drm_panel *panel);
 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm: Remove unnecessary drm_panel_attach and drm_panel_detach
  2020-08-02  8:00   ` [PATCH] drm: Remove unnecessary drm_panel_attach and drm_panel_detach Joe Perches
@ 2020-08-02  8:44     ` Sam Ravnborg
  2020-08-02 16:43       ` [PATCH V2] " Joe Perches
  0 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2020-08-02  8:44 UTC (permalink / raw)
  To: Joe Perches
  Cc: dri-devel, opensource.kernel, Laurent Pinchart, Stefan Mavrodiev,
	David Airlie, Bernard Zhao, Jerry Han, linux-kernel,
	Thierry Reding, Jagan Teki, Thomas Zimmermann, Robert Chiras,
	Icenowy Zheng

Hi Joe.

On Sun, Aug 02, 2020 at 01:00:11AM -0700, Joe Perches wrote:
> These functions are now empty and no longer
> useful so remove the functions and their uses.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> It's too tedious to break apart into multiple patches.
> Done with coccinelle and typing.
> 
> Compiled allyesconfig x86-64 only.

Thanks for doing this.
But patch fails to apply for drm-misc-next where we put this kind of
changes. I managed to apply it with some rejects.

There is several warnings like these when building for arm.
I did not build it all as my build failed too.

drivers/gpu/drm/omapdrm/omap_drv.c: In function ‘omap_modeset_fini’:
drivers/gpu/drm/omapdrm/omap_drv.c:390:27: warning: unused variable ‘priv’ [-Wunused-variable]
  struct omap_drm_private *priv = ddev->dev_private;

drivers/gpu/drm/exynos/exynos_drm_dpi.c: In function ‘exynos_dpi_detect’:
drivers/gpu/drm/exynos/exynos_drm_dpi.c:45:21: warning: unused variable ‘ctx’ [-Wunused-variable]
  struct exynos_dpi *ctx = connector_to_dpi(connector);
                     ^~~
drivers/gpu/drm/sun4i/sun4i_lvds.c: In function ‘sun4i_lvds_connector_destroy’:
drivers/gpu/drm/sun4i/sun4i_lvds.c:57:21: warning: unused variable ‘lvds’ [-Wunused-variable]
  struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
                     ^~~~

I know you can do better than this. Care to give it an extra spin?

	Sam
> 
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 12 --------
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  9 ------
>  drivers/gpu/drm/bridge/nxp-ptn3460.c               |  3 --
>  drivers/gpu/drm/bridge/panel.c                     |  7 -----
>  drivers/gpu/drm/bridge/parade-ps8622.c             |  3 --
>  drivers/gpu/drm/bridge/tc358764.c                  |  2 --
>  drivers/gpu/drm/bridge/tc358767.c                  |  3 --
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c              |  3 --
>  drivers/gpu/drm/drm_panel.c                        | 36 ----------------------
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c            |  6 ----
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c            |  7 ++---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |  7 -----
>  drivers/gpu/drm/imx/imx-ldb.c                      | 10 ------
>  drivers/gpu/drm/imx/parallel-display.c             |  6 ----
>  .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |  7 +----
>  drivers/gpu/drm/msm/dsi/dsi_manager.c              |  1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c                  |  7 +----
>  drivers/gpu/drm/mxsfb/mxsfb_out.c                  |  6 ----
>  drivers/gpu/drm/omapdrm/omap_drv.c                 | 15 ---------
>  drivers/gpu/drm/rcar-du/rcar_lvds.c                |  6 +---
>  drivers/gpu/drm/rockchip/rockchip_lvds.c           |  9 ------
>  drivers/gpu/drm/sti/sti_dvo.c                      |  2 --
>  drivers/gpu/drm/sun4i/sun4i_lvds.c                 |  7 -----
>  drivers/gpu/drm/sun4i/sun4i_rgb.c                  |  7 -----
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |  2 --
>  drivers/gpu/drm/tegra/dsi.c                        |  4 +--
>  drivers/gpu/drm/tegra/output.c                     | 10 ------
>  include/drm/drm_panel.h                            |  3 --
>  28 files changed, 6 insertions(+), 194 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index f082b4ed4878..d9164fab044d 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -507,10 +507,6 @@ static const struct drm_connector_helper_funcs anx6345_connector_helper_funcs =
>  static void
>  anx6345_connector_destroy(struct drm_connector *connector)
>  {
> -	struct anx6345 *anx6345 = connector_to_anx6345(connector);
> -
> -	if (anx6345->panel)
> -		drm_panel_detach(anx6345->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -575,14 +571,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge,
>  		return err;
>  	}
>  
> -	if (anx6345->panel) {
> -		err = drm_panel_attach(anx6345->panel, &anx6345->connector);
> -		if (err) {
> -			DRM_ERROR("Failed to attach panel: %d\n", err);
> -			return err;
> -		}
> -	}
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 76736fb8ed94..aa1bb86293fd 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1265,14 +1265,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
>  		}
>  	}
>  
> -	if (dp->plat_data->panel) {
> -		ret = drm_panel_attach(dp->plat_data->panel, &dp->connector);
> -		if (ret) {
> -			DRM_ERROR("Failed to attach panel\n");
> -			return ret;
> -		}
> -	}
> -
>  	return 0;
>  }
>  
> @@ -1803,7 +1795,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp)
>  	if (dp->plat_data->panel) {
>  		if (drm_panel_unprepare(dp->plat_data->panel))
>  			DRM_ERROR("failed to turnoff the panel\n");
> -		drm_panel_detach(dp->plat_data->panel);
>  	}
>  
>  	drm_dp_aux_unregister(&dp->aux);
> diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
> index 438e566ce0a4..d433902d97e5 100644
> --- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
> +++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
> @@ -265,9 +265,6 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge,
>  	drm_connector_attach_encoder(&ptn_bridge->connector,
>  							bridge->encoder);
>  
> -	if (ptn_bridge->panel)
> -		drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);
> -
>  	drm_helper_hpd_irq_event(ptn_bridge->connector.dev);
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index 1e63ed6b18aa..0ddc37551194 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -82,18 +82,11 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
>  	drm_connector_attach_encoder(&panel_bridge->connector,
>  					  bridge->encoder);
>  
> -	ret = drm_panel_attach(panel_bridge->panel, &panel_bridge->connector);
> -	if (ret < 0)
> -		return ret;
> -
>  	return 0;
>  }
>  
>  static void panel_bridge_detach(struct drm_bridge *bridge)
>  {
> -	struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
> -
> -	drm_panel_detach(panel_bridge->panel);
>  }
>  
>  static void panel_bridge_pre_enable(struct drm_bridge *bridge)
> diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
> index d789ea2a7fb9..c13ec77d858b 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8622.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8622.c
> @@ -505,9 +505,6 @@ static int ps8622_attach(struct drm_bridge *bridge,
>  	drm_connector_attach_encoder(&ps8622->connector,
>  							bridge->encoder);
>  
> -	if (ps8622->panel)
> -		drm_panel_attach(ps8622->panel, &ps8622->connector);
> -
>  	drm_helper_hpd_irq_event(ps8622->connector.dev);
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c
> index 5ac1430fab04..c1e35bdf9232 100644
> --- a/drivers/gpu/drm/bridge/tc358764.c
> +++ b/drivers/gpu/drm/bridge/tc358764.c
> @@ -373,7 +373,6 @@ static int tc358764_attach(struct drm_bridge *bridge,
>  	drm_connector_helper_add(&ctx->connector,
>  				 &tc358764_connector_helper_funcs);
>  	drm_connector_attach_encoder(&ctx->connector, bridge->encoder);
> -	drm_panel_attach(ctx->panel, &ctx->connector);
>  	ctx->connector.funcs->reset(&ctx->connector);
>  	drm_connector_register(&ctx->connector);
>  
> @@ -385,7 +384,6 @@ static void tc358764_detach(struct drm_bridge *bridge)
>  	struct tc358764 *ctx = bridge_to_tc358764(bridge);
>  
>  	drm_connector_unregister(&ctx->connector);
> -	drm_panel_detach(ctx->panel);
>  	ctx->panel = NULL;
>  	drm_connector_put(&ctx->connector);
>  }
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index c2777b226c75..0746462ba0f6 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -1435,9 +1435,6 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
>  					       DRM_CONNECTOR_POLL_DISCONNECT;
>  	}
>  
> -	if (tc->panel)
> -		drm_panel_attach(tc->panel, &tc->connector);
> -
>  	drm_display_info_set_bus_formats(&tc->connector.display_info,
>  					 &bus_format, 1);
>  	tc->connector.display_info.bus_flags =
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 86b9f0f87a14..454544e0da7d 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -394,9 +394,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
>  	}
>  	pdata->dsi = dsi;
>  
> -	/* attach panel to bridge */
> -	drm_panel_attach(pdata->panel, &pdata->connector);
> -
>  	return 0;
>  
>  err_dsi_attach:
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 8c7bac85a793..7804b9947fe8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -97,42 +97,6 @@ void drm_panel_remove(struct drm_panel *panel)
>  }
>  EXPORT_SYMBOL(drm_panel_remove);
>  
> -/**
> - * drm_panel_attach - attach a panel to a connector
> - * @panel: DRM panel
> - * @connector: DRM connector
> - *
> - * After obtaining a pointer to a DRM panel a display driver calls this
> - * function to attach a panel to a connector.
> - *
> - * An error is returned if the panel is already attached to another connector.
> - *
> - * When unloading, the driver should detach from the panel by calling
> - * drm_panel_detach().
> - *
> - * Return: 0 on success or a negative error code on failure.
> - */
> -int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
> -{
> -	return 0;
> -}
> -EXPORT_SYMBOL(drm_panel_attach);
> -
> -/**
> - * drm_panel_detach - detach a panel from a connector
> - * @panel: DRM panel
> - *
> - * Detaches a panel from the connector it is attached to. If a panel is not
> - * attached to any connector this is effectively a no-op.
> - *
> - * This function should not be called by the panel device itself. It
> - * is only for the drm device that called drm_panel_attach().
> - */
> -void drm_panel_detach(struct drm_panel *panel)
> -{
> -}
> -EXPORT_SYMBOL(drm_panel_detach);
> -
>  /**
>   * drm_panel_prepare - power on a panel
>   * @panel: DRM panel
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> index 7ba5354e7d94..5f5ba64fc1ff 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> @@ -44,9 +44,6 @@ exynos_dpi_detect(struct drm_connector *connector, bool force)
>  {
>  	struct exynos_dpi *ctx = connector_to_dpi(connector);
>  
> -	if (ctx->panel)
> -		drm_panel_attach(ctx->panel, &ctx->connector);
> -
>  	return connector_status_connected;
>  }
>  
> @@ -249,8 +246,5 @@ int exynos_dpi_remove(struct drm_encoder *encoder)
>  
>  	exynos_dpi_disable(&ctx->encoder);
>  
> -	if (ctx->panel)
> -		drm_panel_detach(ctx->panel);
> -
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 7a6f6df5e954..843dfcefc46a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1551,12 +1551,10 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>  		}
>  
>  		dsi->panel = of_drm_find_panel(device->dev.of_node);
> -		if (IS_ERR(dsi->panel)) {
> +		if (IS_ERR(dsi->panel))
>  			dsi->panel = NULL;
> -		} else {
> -			drm_panel_attach(dsi->panel, &dsi->connector);
> +		else
>  			dsi->connector.status = connector_status_connected;
> -		}
>  	}
>  
>  	/*
> @@ -1596,7 +1594,6 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
>  	if (dsi->panel) {
>  		mutex_lock(&drm->mode_config.mutex);
>  		exynos_dsi_disable(&dsi->encoder);
> -		drm_panel_detach(dsi->panel);
>  		dsi->panel = NULL;
>  		dsi->connector.status = connector_status_disconnected;
>  		mutex_unlock(&drm->mode_config.mutex);
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> index 9b0c4736c21a..0a7071827533 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> @@ -43,7 +43,6 @@ static void fsl_dcu_drm_connector_destroy(struct drm_connector *connector)
>  	struct fsl_dcu_drm_connector *fsl_con = to_fsl_dcu_connector(connector);
>  
>  	drm_connector_unregister(connector);
> -	drm_panel_detach(fsl_con->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -101,12 +100,6 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev,
>  	if (ret < 0)
>  		goto err_sysfs;
>  
> -	ret = drm_panel_attach(panel, connector);
> -	if (ret) {
> -		dev_err(fsl_dev->dev, "failed to attach panel\n");
> -		goto err_sysfs;
> -	}
> -
>  	return 0;
>  
>  err_sysfs:
> diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> index 8791d60be92e..af757d1e21fe 100644
> --- a/drivers/gpu/drm/imx/imx-ldb.c
> +++ b/drivers/gpu/drm/imx/imx-ldb.c
> @@ -455,13 +455,6 @@ static int imx_ldb_register(struct drm_device *drm,
>  		drm_connector_attach_encoder(&imx_ldb_ch->connector, encoder);
>  	}
>  
> -	if (imx_ldb_ch->panel) {
> -		ret = drm_panel_attach(imx_ldb_ch->panel,
> -				       &imx_ldb_ch->connector);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	return 0;
>  }
>  
> @@ -702,9 +695,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
>  	for (i = 0; i < 2; i++) {
>  		struct imx_ldb_channel *channel = &imx_ldb->channel[i];
>  
> -		if (channel->panel)
> -			drm_panel_detach(channel->panel);
> -
>  		kfree(channel->edid);
>  		i2c_put_adapter(channel->ddc);
>  	}
> diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
> index a831b5bd1613..8232f512b9ed 100644
> --- a/drivers/gpu/drm/imx/parallel-display.c
> +++ b/drivers/gpu/drm/imx/parallel-display.c
> @@ -289,9 +289,6 @@ static int imx_pd_register(struct drm_device *drm,
>  				   DRM_MODE_CONNECTOR_DPI);
>  	}
>  
> -	if (imxpd->panel)
> -		drm_panel_attach(imxpd->panel, &imxpd->connector);
> -
>  	if (imxpd->next_bridge) {
>  		ret = drm_bridge_attach(encoder, imxpd->next_bridge,
>  					&imxpd->bridge, 0);
> @@ -357,9 +354,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master,
>  {
>  	struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
>  
> -	if (imxpd->panel)
> -		drm_panel_detach(imxpd->panel);
> -
>  	kfree(imxpd->edid);
>  }
>  
> diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> index c7df71e2fafc..7288041dd86a 100644
> --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> @@ -50,14 +50,9 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
>  	struct drm_panel *panel = mdp4_lvds_connector->panel;
>  	int ret = 0;
>  
> -	if (panel) {
> -		drm_panel_attach(panel, connector);
> -
> +	if (panel)
>  		ret = drm_panel_get_modes(panel, connector);
>  
> -		drm_panel_detach(panel);
> -	}
> -
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index 4b363bd7ddff..1d28dfba2c9b 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -328,7 +328,6 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
>  	 * In dual DSI mode, we have one connector that can be
>  	 * attached to the drm_panel.
>  	 */
> -	drm_panel_attach(panel, connector);
>  	num = drm_panel_get_modes(panel, connector);
>  	if (!num)
>  		return 0;
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 508764fccd27..51da0e3de587 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -265,11 +265,7 @@ static int mxsfb_load(struct drm_device *drm)
>  	 */
>  
>  	if (mxsfb->panel) {
> -		ret = drm_panel_attach(mxsfb->panel, mxsfb->connector);
> -		if (ret) {
> -			dev_err(drm->dev, "Cannot connect panel: %d\n", ret);
> -			goto err_vblank;
> -		}
> +		;
>  	} else if (mxsfb->bridge) {
>  		ret = drm_simple_display_pipe_attach_bridge(&mxsfb->pipe,
>  							    mxsfb->bridge);
> @@ -306,7 +302,6 @@ static int mxsfb_load(struct drm_device *drm)
>  	return 0;
>  
>  err_irq:
> -	drm_panel_detach(mxsfb->panel);
>  err_vblank:
>  	pm_runtime_disable(drm->dev);
>  
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_out.c b/drivers/gpu/drm/mxsfb/mxsfb_out.c
> index 9eca1605d11d..f93e7a4d4c15 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_out.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_out.c
> @@ -55,12 +55,6 @@ mxsfb_panel_connector_detect(struct drm_connector *connector, bool force)
>  
>  static void mxsfb_panel_connector_destroy(struct drm_connector *connector)
>  {
> -	struct mxsfb_drm_private *mxsfb =
> -			drm_connector_to_mxsfb_drm_private(connector);
> -
> -	if (mxsfb->panel)
> -		drm_panel_detach(mxsfb->panel);
> -
>  	drm_connector_unregister(connector);
>  	drm_connector_cleanup(connector);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 4526967978b7..db8106afd91f 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -349,13 +349,6 @@ static int omap_modeset_init(struct drm_device *dev)
>  
>  		drm_connector_attach_encoder(pipe->connector, encoder);
>  
> -		if (pipe->output->panel) {
> -			ret = drm_panel_attach(pipe->output->panel,
> -					       pipe->connector);
> -			if (ret < 0)
> -				return ret;
> -		}
> -
>  		crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
>  		if (IS_ERR(crtc))
>  			return PTR_ERR(crtc);
> @@ -395,17 +388,9 @@ static int omap_modeset_init(struct drm_device *dev)
>  static void omap_modeset_fini(struct drm_device *ddev)
>  {
>  	struct omap_drm_private *priv = ddev->dev_private;
> -	unsigned int i;
>  
>  	omap_drm_irq_uninstall(ddev);
>  
> -	for (i = 0; i < priv->num_pipes; i++) {
> -		struct omap_drm_pipeline *pipe = &priv->pipes[i];
> -
> -		if (pipe->output->panel)
> -			drm_panel_detach(pipe->output->panel);
> -	}
> -
>  	drm_mode_config_cleanup(ddev);
>  }
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> index ab0d49618cf9..bced729a96fe 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -677,15 +677,11 @@ static int rcar_lvds_attach(struct drm_bridge *bridge,
>  	if (ret < 0)
>  		return ret;
>  
> -	return drm_panel_attach(lvds->panel, connector);
> +	return 0;
>  }
>  
>  static void rcar_lvds_detach(struct drm_bridge *bridge)
>  {
> -	struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
> -
> -	if (lvds->panel)
> -		drm_panel_detach(lvds->panel);
>  }
>  
>  static const struct drm_bridge_funcs rcar_lvds_bridge_ops = {
> diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
> index 63f967902c2d..f292c6a6e20f 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
> @@ -634,13 +634,6 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
>  				      "failed to attach encoder: %d\n", ret);
>  			goto err_free_connector;
>  		}
> -
> -		ret = drm_panel_attach(lvds->panel, connector);
> -		if (ret < 0) {
> -			DRM_DEV_ERROR(drm_dev->dev,
> -				      "failed to attach panel: %d\n", ret);
> -			goto err_free_connector;
> -		}
>  	} else {
>  		ret = drm_bridge_attach(encoder, lvds->bridge, NULL, 0);
>  		if (ret) {
> @@ -676,8 +669,6 @@ static void rockchip_lvds_unbind(struct device *dev, struct device *master,
>  
>  	encoder_funcs = lvds->soc_data->helper_funcs;
>  	encoder_funcs->disable(&lvds->encoder);
> -	if (lvds->panel)
> -		drm_panel_detach(lvds->panel);
>  	pm_runtime_disable(dev);
>  	drm_connector_cleanup(&lvds->connector);
>  	drm_encoder_cleanup(&lvds->encoder);
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index de4af7735c46..ddb4184f0726 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -389,8 +389,6 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
>  		dvo->panel = of_drm_find_panel(dvo->panel_node);
>  		if (IS_ERR(dvo->panel))
>  			dvo->panel = NULL;
> -		else
> -			drm_panel_attach(dvo->panel, connector);
>  	}
>  
>  	if (dvo->panel)
> diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c
> index ffda3184aa12..f8a1ff4bf1bb 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
> @@ -56,7 +56,6 @@ sun4i_lvds_connector_destroy(struct drm_connector *connector)
>  {
>  	struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
>  
> -	drm_panel_detach(lvds->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -141,12 +140,6 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  
>  		drm_connector_attach_encoder(&lvds->connector,
>  						  &lvds->encoder);
> -
> -		ret = drm_panel_attach(lvds->panel, &lvds->connector);
> -		if (ret) {
> -			dev_err(drm->dev, "Couldn't attach our panel\n");
> -			goto err_cleanup_connector;
> -		}
>  	}
>  
>  	if (bridge) {
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index 5a7d43939ae6..e08afdffef50 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -147,7 +147,6 @@ sun4i_rgb_connector_destroy(struct drm_connector *connector)
>  {
>  	struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
>  
> -	drm_panel_detach(rgb->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -233,12 +232,6 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  
>  		drm_connector_attach_encoder(&rgb->connector,
>  						  &rgb->encoder);
> -
> -		ret = drm_panel_attach(rgb->panel, &rgb->connector);
> -		if (ret) {
> -			dev_err(drm->dev, "Couldn't attach our panel\n");
> -			goto err_cleanup_connector;
> -		}
>  	}
>  
>  	if (rgb->bridge) {
> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> index aa67cb037e9d..128471b65f64 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> @@ -973,7 +973,6 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
>  	dsi->panel = panel;
>  	dsi->device = device;
>  
> -	drm_panel_attach(dsi->panel, &dsi->connector);
>  	drm_kms_helper_hotplug_event(dsi->drm);
>  
>  	dev_info(host->dev, "Attached device %s\n", device->name);
> @@ -990,7 +989,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
>  	dsi->panel = NULL;
>  	dsi->device = NULL;
>  
> -	drm_panel_detach(panel);
>  	drm_kms_helper_hotplug_event(dsi->drm);
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
> index 3820e8dff14b..3387de79718b 100644
> --- a/drivers/gpu/drm/tegra/dsi.c
> +++ b/drivers/gpu/drm/tegra/dsi.c
> @@ -1498,10 +1498,8 @@ static int tegra_dsi_host_attach(struct mipi_dsi_host *host,
>  		if (IS_ERR(output->panel))
>  			output->panel = NULL;
>  
> -		if (output->panel && output->connector.dev) {
> -			drm_panel_attach(output->panel, &output->connector);
> +		if (output->panel && output->connector.dev)
>  			drm_helper_hpd_irq_event(output->connector.dev);
> -		}
>  	}
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
> index e36e5e7c2f69..a3adb9e4debf 100644
> --- a/drivers/gpu/drm/tegra/output.c
> +++ b/drivers/gpu/drm/tegra/output.c
> @@ -179,13 +179,6 @@ void tegra_output_remove(struct tegra_output *output)
>  int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
>  {
>  	int connector_type;
> -	int err;
> -
> -	if (output->panel) {
> -		err = drm_panel_attach(output->panel, &output->connector);
> -		if (err < 0)
> -			return err;
> -	}
>  
>  	/*
>  	 * The connector is now registered and ready to receive hotplug events
> @@ -220,9 +213,6 @@ void tegra_output_exit(struct tegra_output *output)
>  	 */
>  	if (output->hpd_gpio)
>  		disable_irq(output->hpd_irq);
> -
> -	if (output->panel)
> -		drm_panel_detach(output->panel);
>  }
>  
>  void tegra_output_find_possible_crtcs(struct tegra_output *output,
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 6193cb555acc..9b374f88fb76 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -178,9 +178,6 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
>  int drm_panel_add(struct drm_panel *panel);
>  void drm_panel_remove(struct drm_panel *panel);
>  
> -int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
> -void drm_panel_detach(struct drm_panel *panel);
> -
>  int drm_panel_prepare(struct drm_panel *panel);
>  int drm_panel_unprepare(struct drm_panel *panel);
>  
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH V2] drm: Remove unnecessary drm_panel_attach and drm_panel_detach
  2020-08-02  8:44     ` Sam Ravnborg
@ 2020-08-02 16:43       ` Joe Perches
  2020-08-02 17:34         ` Sam Ravnborg
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2020-08-02 16:43 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: dri-devel, opensource.kernel, Laurent Pinchart, Stefan Mavrodiev,
	David Airlie, Bernard Zhao, Jerry Han, linux-kernel,
	Thierry Reding, Jagan Teki, Thomas Zimmermann, Robert Chiras,
	Icenowy Zheng

These functions are now empty and no longer
useful so remove the functions and their uses.

Signed-off-by: Joe Perches <joe@perches.com>
---

> > It's too tedious to break apart into multiple patches.
> > Done with coccinelle and typing.
> > 
> > Compiled allyesconfig x86-64 only.

V2: Removed 3 additional lines

drivers/gpu/drm/omapdrm/omap_drv.c:390:27: warning: unused variable ‘priv’ [-Wunused-variable]
drivers/gpu/drm/exynos/exynos_drm_dpi.c:45:21: warning: unused variable ‘ctx’ [-Wunused-variable]
drivers/gpu/drm/sun4i/sun4i_lvds.c:57:21: warning: unused variable ‘lvds’ [-Wunused-variable]

 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 12 --------
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  9 ------
 drivers/gpu/drm/bridge/nxp-ptn3460.c               |  3 --
 drivers/gpu/drm/bridge/panel.c                     |  7 -----
 drivers/gpu/drm/bridge/parade-ps8622.c             |  3 --
 drivers/gpu/drm/bridge/tc358764.c                  |  2 --
 drivers/gpu/drm/bridge/tc358767.c                  |  3 --
 drivers/gpu/drm/bridge/ti-sn65dsi86.c              |  3 --
 drivers/gpu/drm/drm_panel.c                        | 36 ----------------------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c            |  8 -----
 drivers/gpu/drm/exynos/exynos_drm_dsi.c            |  7 ++---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |  7 -----
 drivers/gpu/drm/imx/imx-ldb.c                      | 10 ------
 drivers/gpu/drm/imx/parallel-display.c             |  6 ----
 .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |  7 +----
 drivers/gpu/drm/msm/dsi/dsi_manager.c              |  1 -
 drivers/gpu/drm/mxsfb/mxsfb_drv.c                  |  7 +----
 drivers/gpu/drm/mxsfb/mxsfb_out.c                  |  6 ----
 drivers/gpu/drm/omapdrm/omap_drv.c                 | 17 ----------
 drivers/gpu/drm/rcar-du/rcar_lvds.c                |  6 +---
 drivers/gpu/drm/rockchip/rockchip_lvds.c           |  9 ------
 drivers/gpu/drm/sti/sti_dvo.c                      |  2 --
 drivers/gpu/drm/sun4i/sun4i_lvds.c                 |  9 ------
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |  7 -----
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |  2 --
 drivers/gpu/drm/tegra/dsi.c                        |  4 +--
 drivers/gpu/drm/tegra/output.c                     | 10 ------
 include/drm/drm_panel.h                            |  3 --
 28 files changed, 6 insertions(+), 200 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
index f082b4ed4878..d9164fab044d 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -507,10 +507,6 @@ static const struct drm_connector_helper_funcs anx6345_connector_helper_funcs =
 static void
 anx6345_connector_destroy(struct drm_connector *connector)
 {
-	struct anx6345 *anx6345 = connector_to_anx6345(connector);
-
-	if (anx6345->panel)
-		drm_panel_detach(anx6345->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -575,14 +571,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge,
 		return err;
 	}
 
-	if (anx6345->panel) {
-		err = drm_panel_attach(anx6345->panel, &anx6345->connector);
-		if (err) {
-			DRM_ERROR("Failed to attach panel: %d\n", err);
-			return err;
-		}
-	}
-
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 76736fb8ed94..aa1bb86293fd 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1265,14 +1265,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
 		}
 	}
 
-	if (dp->plat_data->panel) {
-		ret = drm_panel_attach(dp->plat_data->panel, &dp->connector);
-		if (ret) {
-			DRM_ERROR("Failed to attach panel\n");
-			return ret;
-		}
-	}
-
 	return 0;
 }
 
@@ -1803,7 +1795,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp)
 	if (dp->plat_data->panel) {
 		if (drm_panel_unprepare(dp->plat_data->panel))
 			DRM_ERROR("failed to turnoff the panel\n");
-		drm_panel_detach(dp->plat_data->panel);
 	}
 
 	drm_dp_aux_unregister(&dp->aux);
diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
index 438e566ce0a4..d433902d97e5 100644
--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
+++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
@@ -265,9 +265,6 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge,
 	drm_connector_attach_encoder(&ptn_bridge->connector,
 							bridge->encoder);
 
-	if (ptn_bridge->panel)
-		drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);
-
 	drm_helper_hpd_irq_event(ptn_bridge->connector.dev);
 
 	return ret;
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 1e63ed6b18aa..0ddc37551194 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -82,18 +82,11 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
 	drm_connector_attach_encoder(&panel_bridge->connector,
 					  bridge->encoder);
 
-	ret = drm_panel_attach(panel_bridge->panel, &panel_bridge->connector);
-	if (ret < 0)
-		return ret;
-
 	return 0;
 }
 
 static void panel_bridge_detach(struct drm_bridge *bridge)
 {
-	struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
-
-	drm_panel_detach(panel_bridge->panel);
 }
 
 static void panel_bridge_pre_enable(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
index d789ea2a7fb9..c13ec77d858b 100644
--- a/drivers/gpu/drm/bridge/parade-ps8622.c
+++ b/drivers/gpu/drm/bridge/parade-ps8622.c
@@ -505,9 +505,6 @@ static int ps8622_attach(struct drm_bridge *bridge,
 	drm_connector_attach_encoder(&ps8622->connector,
 							bridge->encoder);
 
-	if (ps8622->panel)
-		drm_panel_attach(ps8622->panel, &ps8622->connector);
-
 	drm_helper_hpd_irq_event(ps8622->connector.dev);
 
 	return ret;
diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c
index 5ac1430fab04..c1e35bdf9232 100644
--- a/drivers/gpu/drm/bridge/tc358764.c
+++ b/drivers/gpu/drm/bridge/tc358764.c
@@ -373,7 +373,6 @@ static int tc358764_attach(struct drm_bridge *bridge,
 	drm_connector_helper_add(&ctx->connector,
 				 &tc358764_connector_helper_funcs);
 	drm_connector_attach_encoder(&ctx->connector, bridge->encoder);
-	drm_panel_attach(ctx->panel, &ctx->connector);
 	ctx->connector.funcs->reset(&ctx->connector);
 	drm_connector_register(&ctx->connector);
 
@@ -385,7 +384,6 @@ static void tc358764_detach(struct drm_bridge *bridge)
 	struct tc358764 *ctx = bridge_to_tc358764(bridge);
 
 	drm_connector_unregister(&ctx->connector);
-	drm_panel_detach(ctx->panel);
 	ctx->panel = NULL;
 	drm_connector_put(&ctx->connector);
 }
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index c2777b226c75..0746462ba0f6 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1435,9 +1435,6 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
 					       DRM_CONNECTOR_POLL_DISCONNECT;
 	}
 
-	if (tc->panel)
-		drm_panel_attach(tc->panel, &tc->connector);
-
 	drm_display_info_set_bus_formats(&tc->connector.display_info,
 					 &bus_format, 1);
 	tc->connector.display_info.bus_flags =
diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index 86b9f0f87a14..454544e0da7d 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -394,9 +394,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
 	}
 	pdata->dsi = dsi;
 
-	/* attach panel to bridge */
-	drm_panel_attach(pdata->panel, &pdata->connector);
-
 	return 0;
 
 err_dsi_attach:
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 8c7bac85a793..7804b9947fe8 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -97,42 +97,6 @@ void drm_panel_remove(struct drm_panel *panel)
 }
 EXPORT_SYMBOL(drm_panel_remove);
 
-/**
- * drm_panel_attach - attach a panel to a connector
- * @panel: DRM panel
- * @connector: DRM connector
- *
- * After obtaining a pointer to a DRM panel a display driver calls this
- * function to attach a panel to a connector.
- *
- * An error is returned if the panel is already attached to another connector.
- *
- * When unloading, the driver should detach from the panel by calling
- * drm_panel_detach().
- *
- * Return: 0 on success or a negative error code on failure.
- */
-int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
-{
-	return 0;
-}
-EXPORT_SYMBOL(drm_panel_attach);
-
-/**
- * drm_panel_detach - detach a panel from a connector
- * @panel: DRM panel
- *
- * Detaches a panel from the connector it is attached to. If a panel is not
- * attached to any connector this is effectively a no-op.
- *
- * This function should not be called by the panel device itself. It
- * is only for the drm device that called drm_panel_attach().
- */
-void drm_panel_detach(struct drm_panel *panel)
-{
-}
-EXPORT_SYMBOL(drm_panel_detach);
-
 /**
  * drm_panel_prepare - power on a panel
  * @panel: DRM panel
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 7ba5354e7d94..741323a2e6c3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -42,11 +42,6 @@ static inline struct exynos_dpi *encoder_to_dpi(struct drm_encoder *e)
 static enum drm_connector_status
 exynos_dpi_detect(struct drm_connector *connector, bool force)
 {
-	struct exynos_dpi *ctx = connector_to_dpi(connector);
-
-	if (ctx->panel)
-		drm_panel_attach(ctx->panel, &ctx->connector);
-
 	return connector_status_connected;
 }
 
@@ -249,8 +244,5 @@ int exynos_dpi_remove(struct drm_encoder *encoder)
 
 	exynos_dpi_disable(&ctx->encoder);
 
-	if (ctx->panel)
-		drm_panel_detach(ctx->panel);
-
 	return 0;
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 7a6f6df5e954..843dfcefc46a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1551,12 +1551,10 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 		}
 
 		dsi->panel = of_drm_find_panel(device->dev.of_node);
-		if (IS_ERR(dsi->panel)) {
+		if (IS_ERR(dsi->panel))
 			dsi->panel = NULL;
-		} else {
-			drm_panel_attach(dsi->panel, &dsi->connector);
+		else
 			dsi->connector.status = connector_status_connected;
-		}
 	}
 
 	/*
@@ -1596,7 +1594,6 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
 	if (dsi->panel) {
 		mutex_lock(&drm->mode_config.mutex);
 		exynos_dsi_disable(&dsi->encoder);
-		drm_panel_detach(dsi->panel);
 		dsi->panel = NULL;
 		dsi->connector.status = connector_status_disconnected;
 		mutex_unlock(&drm->mode_config.mutex);
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index 9b0c4736c21a..0a7071827533 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -43,7 +43,6 @@ static void fsl_dcu_drm_connector_destroy(struct drm_connector *connector)
 	struct fsl_dcu_drm_connector *fsl_con = to_fsl_dcu_connector(connector);
 
 	drm_connector_unregister(connector);
-	drm_panel_detach(fsl_con->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -101,12 +100,6 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev,
 	if (ret < 0)
 		goto err_sysfs;
 
-	ret = drm_panel_attach(panel, connector);
-	if (ret) {
-		dev_err(fsl_dev->dev, "failed to attach panel\n");
-		goto err_sysfs;
-	}
-
 	return 0;
 
 err_sysfs:
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 8791d60be92e..af757d1e21fe 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -455,13 +455,6 @@ static int imx_ldb_register(struct drm_device *drm,
 		drm_connector_attach_encoder(&imx_ldb_ch->connector, encoder);
 	}
 
-	if (imx_ldb_ch->panel) {
-		ret = drm_panel_attach(imx_ldb_ch->panel,
-				       &imx_ldb_ch->connector);
-		if (ret)
-			return ret;
-	}
-
 	return 0;
 }
 
@@ -702,9 +695,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
 	for (i = 0; i < 2; i++) {
 		struct imx_ldb_channel *channel = &imx_ldb->channel[i];
 
-		if (channel->panel)
-			drm_panel_detach(channel->panel);
-
 		kfree(channel->edid);
 		i2c_put_adapter(channel->ddc);
 	}
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index a831b5bd1613..8232f512b9ed 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -289,9 +289,6 @@ static int imx_pd_register(struct drm_device *drm,
 				   DRM_MODE_CONNECTOR_DPI);
 	}
 
-	if (imxpd->panel)
-		drm_panel_attach(imxpd->panel, &imxpd->connector);
-
 	if (imxpd->next_bridge) {
 		ret = drm_bridge_attach(encoder, imxpd->next_bridge,
 					&imxpd->bridge, 0);
@@ -357,9 +354,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master,
 {
 	struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
 
-	if (imxpd->panel)
-		drm_panel_detach(imxpd->panel);
-
 	kfree(imxpd->edid);
 }
 
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
index c7df71e2fafc..7288041dd86a 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
@@ -50,14 +50,9 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
 	struct drm_panel *panel = mdp4_lvds_connector->panel;
 	int ret = 0;
 
-	if (panel) {
-		drm_panel_attach(panel, connector);
-
+	if (panel)
 		ret = drm_panel_get_modes(panel, connector);
 
-		drm_panel_detach(panel);
-	}
-
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 4b363bd7ddff..1d28dfba2c9b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -328,7 +328,6 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
 	 * In dual DSI mode, we have one connector that can be
 	 * attached to the drm_panel.
 	 */
-	drm_panel_attach(panel, connector);
 	num = drm_panel_get_modes(panel, connector);
 	if (!num)
 		return 0;
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 508764fccd27..51da0e3de587 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -265,11 +265,7 @@ static int mxsfb_load(struct drm_device *drm)
 	 */
 
 	if (mxsfb->panel) {
-		ret = drm_panel_attach(mxsfb->panel, mxsfb->connector);
-		if (ret) {
-			dev_err(drm->dev, "Cannot connect panel: %d\n", ret);
-			goto err_vblank;
-		}
+		;
 	} else if (mxsfb->bridge) {
 		ret = drm_simple_display_pipe_attach_bridge(&mxsfb->pipe,
 							    mxsfb->bridge);
@@ -306,7 +302,6 @@ static int mxsfb_load(struct drm_device *drm)
 	return 0;
 
 err_irq:
-	drm_panel_detach(mxsfb->panel);
 err_vblank:
 	pm_runtime_disable(drm->dev);
 
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_out.c b/drivers/gpu/drm/mxsfb/mxsfb_out.c
index 9eca1605d11d..f93e7a4d4c15 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_out.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_out.c
@@ -55,12 +55,6 @@ mxsfb_panel_connector_detect(struct drm_connector *connector, bool force)
 
 static void mxsfb_panel_connector_destroy(struct drm_connector *connector)
 {
-	struct mxsfb_drm_private *mxsfb =
-			drm_connector_to_mxsfb_drm_private(connector);
-
-	if (mxsfb->panel)
-		drm_panel_detach(mxsfb->panel);
-
 	drm_connector_unregister(connector);
 	drm_connector_cleanup(connector);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 4526967978b7..53d5e184ee77 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -349,13 +349,6 @@ static int omap_modeset_init(struct drm_device *dev)
 
 		drm_connector_attach_encoder(pipe->connector, encoder);
 
-		if (pipe->output->panel) {
-			ret = drm_panel_attach(pipe->output->panel,
-					       pipe->connector);
-			if (ret < 0)
-				return ret;
-		}
-
 		crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
 		if (IS_ERR(crtc))
 			return PTR_ERR(crtc);
@@ -394,18 +387,8 @@ static int omap_modeset_init(struct drm_device *dev)
 
 static void omap_modeset_fini(struct drm_device *ddev)
 {
-	struct omap_drm_private *priv = ddev->dev_private;
-	unsigned int i;
-
 	omap_drm_irq_uninstall(ddev);
 
-	for (i = 0; i < priv->num_pipes; i++) {
-		struct omap_drm_pipeline *pipe = &priv->pipes[i];
-
-		if (pipe->output->panel)
-			drm_panel_detach(pipe->output->panel);
-	}
-
 	drm_mode_config_cleanup(ddev);
 }
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index ab0d49618cf9..bced729a96fe 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -677,15 +677,11 @@ static int rcar_lvds_attach(struct drm_bridge *bridge,
 	if (ret < 0)
 		return ret;
 
-	return drm_panel_attach(lvds->panel, connector);
+	return 0;
 }
 
 static void rcar_lvds_detach(struct drm_bridge *bridge)
 {
-	struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
-
-	if (lvds->panel)
-		drm_panel_detach(lvds->panel);
 }
 
 static const struct drm_bridge_funcs rcar_lvds_bridge_ops = {
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 63f967902c2d..f292c6a6e20f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -634,13 +634,6 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
 				      "failed to attach encoder: %d\n", ret);
 			goto err_free_connector;
 		}
-
-		ret = drm_panel_attach(lvds->panel, connector);
-		if (ret < 0) {
-			DRM_DEV_ERROR(drm_dev->dev,
-				      "failed to attach panel: %d\n", ret);
-			goto err_free_connector;
-		}
 	} else {
 		ret = drm_bridge_attach(encoder, lvds->bridge, NULL, 0);
 		if (ret) {
@@ -676,8 +669,6 @@ static void rockchip_lvds_unbind(struct device *dev, struct device *master,
 
 	encoder_funcs = lvds->soc_data->helper_funcs;
 	encoder_funcs->disable(&lvds->encoder);
-	if (lvds->panel)
-		drm_panel_detach(lvds->panel);
 	pm_runtime_disable(dev);
 	drm_connector_cleanup(&lvds->connector);
 	drm_encoder_cleanup(&lvds->encoder);
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index de4af7735c46..ddb4184f0726 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -389,8 +389,6 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
 		dvo->panel = of_drm_find_panel(dvo->panel_node);
 		if (IS_ERR(dvo->panel))
 			dvo->panel = NULL;
-		else
-			drm_panel_attach(dvo->panel, connector);
 	}
 
 	if (dvo->panel)
diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c
index ffda3184aa12..d06dd313d3c0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
+++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
@@ -54,9 +54,6 @@ static struct drm_connector_helper_funcs sun4i_lvds_con_helper_funcs = {
 static void
 sun4i_lvds_connector_destroy(struct drm_connector *connector)
 {
-	struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
-
-	drm_panel_detach(lvds->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -141,12 +138,6 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 
 		drm_connector_attach_encoder(&lvds->connector,
 						  &lvds->encoder);
-
-		ret = drm_panel_attach(lvds->panel, &lvds->connector);
-		if (ret) {
-			dev_err(drm->dev, "Couldn't attach our panel\n");
-			goto err_cleanup_connector;
-		}
 	}
 
 	if (bridge) {
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 5a7d43939ae6..e08afdffef50 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -147,7 +147,6 @@ sun4i_rgb_connector_destroy(struct drm_connector *connector)
 {
 	struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
 
-	drm_panel_detach(rgb->panel);
 	drm_connector_cleanup(connector);
 }
 
@@ -233,12 +232,6 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 
 		drm_connector_attach_encoder(&rgb->connector,
 						  &rgb->encoder);
-
-		ret = drm_panel_attach(rgb->panel, &rgb->connector);
-		if (ret) {
-			dev_err(drm->dev, "Couldn't attach our panel\n");
-			goto err_cleanup_connector;
-		}
 	}
 
 	if (rgb->bridge) {
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index aa67cb037e9d..128471b65f64 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -973,7 +973,6 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 	dsi->panel = panel;
 	dsi->device = device;
 
-	drm_panel_attach(dsi->panel, &dsi->connector);
 	drm_kms_helper_hotplug_event(dsi->drm);
 
 	dev_info(host->dev, "Attached device %s\n", device->name);
@@ -990,7 +989,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
 	dsi->panel = NULL;
 	dsi->device = NULL;
 
-	drm_panel_detach(panel);
 	drm_kms_helper_hotplug_event(dsi->drm);
 
 	return 0;
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 3820e8dff14b..3387de79718b 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1498,10 +1498,8 @@ static int tegra_dsi_host_attach(struct mipi_dsi_host *host,
 		if (IS_ERR(output->panel))
 			output->panel = NULL;
 
-		if (output->panel && output->connector.dev) {
-			drm_panel_attach(output->panel, &output->connector);
+		if (output->panel && output->connector.dev)
 			drm_helper_hpd_irq_event(output->connector.dev);
-		}
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index e36e5e7c2f69..a3adb9e4debf 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -179,13 +179,6 @@ void tegra_output_remove(struct tegra_output *output)
 int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
 {
 	int connector_type;
-	int err;
-
-	if (output->panel) {
-		err = drm_panel_attach(output->panel, &output->connector);
-		if (err < 0)
-			return err;
-	}
 
 	/*
 	 * The connector is now registered and ready to receive hotplug events
@@ -220,9 +213,6 @@ void tegra_output_exit(struct tegra_output *output)
 	 */
 	if (output->hpd_gpio)
 		disable_irq(output->hpd_irq);
-
-	if (output->panel)
-		drm_panel_detach(output->panel);
 }
 
 void tegra_output_find_possible_crtcs(struct tegra_output *output,
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 6193cb555acc..9b374f88fb76 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -178,9 +178,6 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
 int drm_panel_add(struct drm_panel *panel);
 void drm_panel_remove(struct drm_panel *panel);
 
-int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
-void drm_panel_detach(struct drm_panel *panel);
-
 int drm_panel_prepare(struct drm_panel *panel);
 int drm_panel_unprepare(struct drm_panel *panel);
 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH V2] drm: Remove unnecessary drm_panel_attach and drm_panel_detach
  2020-08-02 16:43       ` [PATCH V2] " Joe Perches
@ 2020-08-02 17:34         ` Sam Ravnborg
  2020-08-08  8:10           ` Sam Ravnborg
  0 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2020-08-02 17:34 UTC (permalink / raw)
  To: Joe Perches
  Cc: dri-devel, opensource.kernel, Laurent Pinchart, Stefan Mavrodiev,
	David Airlie, Bernard Zhao, Jerry Han, linux-kernel,
	Thierry Reding, Jagan Teki, Thomas Zimmermann, Robert Chiras,
	Icenowy Zheng

Hi Joe.

On Sun, Aug 02, 2020 at 09:43:59AM -0700, Joe Perches wrote:
> These functions are now empty and no longer
> useful so remove the functions and their uses.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> > > It's too tedious to break apart into multiple patches.
> > > Done with coccinelle and typing.
> > > 
> > > Compiled allyesconfig x86-64 only.
> 
> V2: Removed 3 additional lines
> 
> drivers/gpu/drm/omapdrm/omap_drv.c:390:27: warning: unused variable ‘priv’ [-Wunused-variable]
> drivers/gpu/drm/exynos/exynos_drm_dpi.c:45:21: warning: unused variable ‘ctx’ [-Wunused-variable]
> drivers/gpu/drm/sun4i/sun4i_lvds.c:57:21: warning: unused variable ‘lvds’ [-Wunused-variable]

Thanks, better now.

I had to fix a few warnings and a build error to get it going on
drm-misc-next. I will keep it locally just to let anyone speak up.
I you do not see any mail from me until friday that it is applied please
ping me.

	Sam

> 
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 12 --------
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  9 ------
>  drivers/gpu/drm/bridge/nxp-ptn3460.c               |  3 --
>  drivers/gpu/drm/bridge/panel.c                     |  7 -----
>  drivers/gpu/drm/bridge/parade-ps8622.c             |  3 --
>  drivers/gpu/drm/bridge/tc358764.c                  |  2 --
>  drivers/gpu/drm/bridge/tc358767.c                  |  3 --
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c              |  3 --
>  drivers/gpu/drm/drm_panel.c                        | 36 ----------------------
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c            |  8 -----
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c            |  7 ++---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |  7 -----
>  drivers/gpu/drm/imx/imx-ldb.c                      | 10 ------
>  drivers/gpu/drm/imx/parallel-display.c             |  6 ----
>  .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |  7 +----
>  drivers/gpu/drm/msm/dsi/dsi_manager.c              |  1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c                  |  7 +----
>  drivers/gpu/drm/mxsfb/mxsfb_out.c                  |  6 ----
>  drivers/gpu/drm/omapdrm/omap_drv.c                 | 17 ----------
>  drivers/gpu/drm/rcar-du/rcar_lvds.c                |  6 +---
>  drivers/gpu/drm/rockchip/rockchip_lvds.c           |  9 ------
>  drivers/gpu/drm/sti/sti_dvo.c                      |  2 --
>  drivers/gpu/drm/sun4i/sun4i_lvds.c                 |  9 ------
>  drivers/gpu/drm/sun4i/sun4i_rgb.c                  |  7 -----
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |  2 --
>  drivers/gpu/drm/tegra/dsi.c                        |  4 +--
>  drivers/gpu/drm/tegra/output.c                     | 10 ------
>  include/drm/drm_panel.h                            |  3 --
>  28 files changed, 6 insertions(+), 200 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index f082b4ed4878..d9164fab044d 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -507,10 +507,6 @@ static const struct drm_connector_helper_funcs anx6345_connector_helper_funcs =
>  static void
>  anx6345_connector_destroy(struct drm_connector *connector)
>  {
> -	struct anx6345 *anx6345 = connector_to_anx6345(connector);
> -
> -	if (anx6345->panel)
> -		drm_panel_detach(anx6345->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -575,14 +571,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge,
>  		return err;
>  	}
>  
> -	if (anx6345->panel) {
> -		err = drm_panel_attach(anx6345->panel, &anx6345->connector);
> -		if (err) {
> -			DRM_ERROR("Failed to attach panel: %d\n", err);
> -			return err;
> -		}
> -	}
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 76736fb8ed94..aa1bb86293fd 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1265,14 +1265,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
>  		}
>  	}
>  
> -	if (dp->plat_data->panel) {
> -		ret = drm_panel_attach(dp->plat_data->panel, &dp->connector);
> -		if (ret) {
> -			DRM_ERROR("Failed to attach panel\n");
> -			return ret;
> -		}
> -	}
> -
>  	return 0;
>  }
>  
> @@ -1803,7 +1795,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp)
>  	if (dp->plat_data->panel) {
>  		if (drm_panel_unprepare(dp->plat_data->panel))
>  			DRM_ERROR("failed to turnoff the panel\n");
> -		drm_panel_detach(dp->plat_data->panel);
>  	}
>  
>  	drm_dp_aux_unregister(&dp->aux);
> diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
> index 438e566ce0a4..d433902d97e5 100644
> --- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
> +++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
> @@ -265,9 +265,6 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge,
>  	drm_connector_attach_encoder(&ptn_bridge->connector,
>  							bridge->encoder);
>  
> -	if (ptn_bridge->panel)
> -		drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);
> -
>  	drm_helper_hpd_irq_event(ptn_bridge->connector.dev);
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index 1e63ed6b18aa..0ddc37551194 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -82,18 +82,11 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
>  	drm_connector_attach_encoder(&panel_bridge->connector,
>  					  bridge->encoder);
>  
> -	ret = drm_panel_attach(panel_bridge->panel, &panel_bridge->connector);
> -	if (ret < 0)
> -		return ret;
> -
>  	return 0;
>  }
>  
>  static void panel_bridge_detach(struct drm_bridge *bridge)
>  {
> -	struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
> -
> -	drm_panel_detach(panel_bridge->panel);
>  }
>  
>  static void panel_bridge_pre_enable(struct drm_bridge *bridge)
> diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
> index d789ea2a7fb9..c13ec77d858b 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8622.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8622.c
> @@ -505,9 +505,6 @@ static int ps8622_attach(struct drm_bridge *bridge,
>  	drm_connector_attach_encoder(&ps8622->connector,
>  							bridge->encoder);
>  
> -	if (ps8622->panel)
> -		drm_panel_attach(ps8622->panel, &ps8622->connector);
> -
>  	drm_helper_hpd_irq_event(ps8622->connector.dev);
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c
> index 5ac1430fab04..c1e35bdf9232 100644
> --- a/drivers/gpu/drm/bridge/tc358764.c
> +++ b/drivers/gpu/drm/bridge/tc358764.c
> @@ -373,7 +373,6 @@ static int tc358764_attach(struct drm_bridge *bridge,
>  	drm_connector_helper_add(&ctx->connector,
>  				 &tc358764_connector_helper_funcs);
>  	drm_connector_attach_encoder(&ctx->connector, bridge->encoder);
> -	drm_panel_attach(ctx->panel, &ctx->connector);
>  	ctx->connector.funcs->reset(&ctx->connector);
>  	drm_connector_register(&ctx->connector);
>  
> @@ -385,7 +384,6 @@ static void tc358764_detach(struct drm_bridge *bridge)
>  	struct tc358764 *ctx = bridge_to_tc358764(bridge);
>  
>  	drm_connector_unregister(&ctx->connector);
> -	drm_panel_detach(ctx->panel);
>  	ctx->panel = NULL;
>  	drm_connector_put(&ctx->connector);
>  }
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index c2777b226c75..0746462ba0f6 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -1435,9 +1435,6 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
>  					       DRM_CONNECTOR_POLL_DISCONNECT;
>  	}
>  
> -	if (tc->panel)
> -		drm_panel_attach(tc->panel, &tc->connector);
> -
>  	drm_display_info_set_bus_formats(&tc->connector.display_info,
>  					 &bus_format, 1);
>  	tc->connector.display_info.bus_flags =
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 86b9f0f87a14..454544e0da7d 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -394,9 +394,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,
>  	}
>  	pdata->dsi = dsi;
>  
> -	/* attach panel to bridge */
> -	drm_panel_attach(pdata->panel, &pdata->connector);
> -
>  	return 0;
>  
>  err_dsi_attach:
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 8c7bac85a793..7804b9947fe8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -97,42 +97,6 @@ void drm_panel_remove(struct drm_panel *panel)
>  }
>  EXPORT_SYMBOL(drm_panel_remove);
>  
> -/**
> - * drm_panel_attach - attach a panel to a connector
> - * @panel: DRM panel
> - * @connector: DRM connector
> - *
> - * After obtaining a pointer to a DRM panel a display driver calls this
> - * function to attach a panel to a connector.
> - *
> - * An error is returned if the panel is already attached to another connector.
> - *
> - * When unloading, the driver should detach from the panel by calling
> - * drm_panel_detach().
> - *
> - * Return: 0 on success or a negative error code on failure.
> - */
> -int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
> -{
> -	return 0;
> -}
> -EXPORT_SYMBOL(drm_panel_attach);
> -
> -/**
> - * drm_panel_detach - detach a panel from a connector
> - * @panel: DRM panel
> - *
> - * Detaches a panel from the connector it is attached to. If a panel is not
> - * attached to any connector this is effectively a no-op.
> - *
> - * This function should not be called by the panel device itself. It
> - * is only for the drm device that called drm_panel_attach().
> - */
> -void drm_panel_detach(struct drm_panel *panel)
> -{
> -}
> -EXPORT_SYMBOL(drm_panel_detach);
> -
>  /**
>   * drm_panel_prepare - power on a panel
>   * @panel: DRM panel
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> index 7ba5354e7d94..741323a2e6c3 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
> @@ -42,11 +42,6 @@ static inline struct exynos_dpi *encoder_to_dpi(struct drm_encoder *e)
>  static enum drm_connector_status
>  exynos_dpi_detect(struct drm_connector *connector, bool force)
>  {
> -	struct exynos_dpi *ctx = connector_to_dpi(connector);
> -
> -	if (ctx->panel)
> -		drm_panel_attach(ctx->panel, &ctx->connector);
> -
>  	return connector_status_connected;
>  }
>  
> @@ -249,8 +244,5 @@ int exynos_dpi_remove(struct drm_encoder *encoder)
>  
>  	exynos_dpi_disable(&ctx->encoder);
>  
> -	if (ctx->panel)
> -		drm_panel_detach(ctx->panel);
> -
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 7a6f6df5e954..843dfcefc46a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1551,12 +1551,10 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>  		}
>  
>  		dsi->panel = of_drm_find_panel(device->dev.of_node);
> -		if (IS_ERR(dsi->panel)) {
> +		if (IS_ERR(dsi->panel))
>  			dsi->panel = NULL;
> -		} else {
> -			drm_panel_attach(dsi->panel, &dsi->connector);
> +		else
>  			dsi->connector.status = connector_status_connected;
> -		}
>  	}
>  
>  	/*
> @@ -1596,7 +1594,6 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
>  	if (dsi->panel) {
>  		mutex_lock(&drm->mode_config.mutex);
>  		exynos_dsi_disable(&dsi->encoder);
> -		drm_panel_detach(dsi->panel);
>  		dsi->panel = NULL;
>  		dsi->connector.status = connector_status_disconnected;
>  		mutex_unlock(&drm->mode_config.mutex);
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> index 9b0c4736c21a..0a7071827533 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
> @@ -43,7 +43,6 @@ static void fsl_dcu_drm_connector_destroy(struct drm_connector *connector)
>  	struct fsl_dcu_drm_connector *fsl_con = to_fsl_dcu_connector(connector);
>  
>  	drm_connector_unregister(connector);
> -	drm_panel_detach(fsl_con->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -101,12 +100,6 @@ static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev,
>  	if (ret < 0)
>  		goto err_sysfs;
>  
> -	ret = drm_panel_attach(panel, connector);
> -	if (ret) {
> -		dev_err(fsl_dev->dev, "failed to attach panel\n");
> -		goto err_sysfs;
> -	}
> -
>  	return 0;
>  
>  err_sysfs:
> diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
> index 8791d60be92e..af757d1e21fe 100644
> --- a/drivers/gpu/drm/imx/imx-ldb.c
> +++ b/drivers/gpu/drm/imx/imx-ldb.c
> @@ -455,13 +455,6 @@ static int imx_ldb_register(struct drm_device *drm,
>  		drm_connector_attach_encoder(&imx_ldb_ch->connector, encoder);
>  	}
>  
> -	if (imx_ldb_ch->panel) {
> -		ret = drm_panel_attach(imx_ldb_ch->panel,
> -				       &imx_ldb_ch->connector);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	return 0;
>  }
>  
> @@ -702,9 +695,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
>  	for (i = 0; i < 2; i++) {
>  		struct imx_ldb_channel *channel = &imx_ldb->channel[i];
>  
> -		if (channel->panel)
> -			drm_panel_detach(channel->panel);
> -
>  		kfree(channel->edid);
>  		i2c_put_adapter(channel->ddc);
>  	}
> diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
> index a831b5bd1613..8232f512b9ed 100644
> --- a/drivers/gpu/drm/imx/parallel-display.c
> +++ b/drivers/gpu/drm/imx/parallel-display.c
> @@ -289,9 +289,6 @@ static int imx_pd_register(struct drm_device *drm,
>  				   DRM_MODE_CONNECTOR_DPI);
>  	}
>  
> -	if (imxpd->panel)
> -		drm_panel_attach(imxpd->panel, &imxpd->connector);
> -
>  	if (imxpd->next_bridge) {
>  		ret = drm_bridge_attach(encoder, imxpd->next_bridge,
>  					&imxpd->bridge, 0);
> @@ -357,9 +354,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master,
>  {
>  	struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
>  
> -	if (imxpd->panel)
> -		drm_panel_detach(imxpd->panel);
> -
>  	kfree(imxpd->edid);
>  }
>  
> diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> index c7df71e2fafc..7288041dd86a 100644
> --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
> @@ -50,14 +50,9 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
>  	struct drm_panel *panel = mdp4_lvds_connector->panel;
>  	int ret = 0;
>  
> -	if (panel) {
> -		drm_panel_attach(panel, connector);
> -
> +	if (panel)
>  		ret = drm_panel_get_modes(panel, connector);
>  
> -		drm_panel_detach(panel);
> -	}
> -
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index 4b363bd7ddff..1d28dfba2c9b 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -328,7 +328,6 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
>  	 * In dual DSI mode, we have one connector that can be
>  	 * attached to the drm_panel.
>  	 */
> -	drm_panel_attach(panel, connector);
>  	num = drm_panel_get_modes(panel, connector);
>  	if (!num)
>  		return 0;
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 508764fccd27..51da0e3de587 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -265,11 +265,7 @@ static int mxsfb_load(struct drm_device *drm)
>  	 */
>  
>  	if (mxsfb->panel) {
> -		ret = drm_panel_attach(mxsfb->panel, mxsfb->connector);
> -		if (ret) {
> -			dev_err(drm->dev, "Cannot connect panel: %d\n", ret);
> -			goto err_vblank;
> -		}
> +		;
>  	} else if (mxsfb->bridge) {
>  		ret = drm_simple_display_pipe_attach_bridge(&mxsfb->pipe,
>  							    mxsfb->bridge);
> @@ -306,7 +302,6 @@ static int mxsfb_load(struct drm_device *drm)
>  	return 0;
>  
>  err_irq:
> -	drm_panel_detach(mxsfb->panel);
>  err_vblank:
>  	pm_runtime_disable(drm->dev);
>  
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_out.c b/drivers/gpu/drm/mxsfb/mxsfb_out.c
> index 9eca1605d11d..f93e7a4d4c15 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_out.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_out.c
> @@ -55,12 +55,6 @@ mxsfb_panel_connector_detect(struct drm_connector *connector, bool force)
>  
>  static void mxsfb_panel_connector_destroy(struct drm_connector *connector)
>  {
> -	struct mxsfb_drm_private *mxsfb =
> -			drm_connector_to_mxsfb_drm_private(connector);
> -
> -	if (mxsfb->panel)
> -		drm_panel_detach(mxsfb->panel);
> -
>  	drm_connector_unregister(connector);
>  	drm_connector_cleanup(connector);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 4526967978b7..53d5e184ee77 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -349,13 +349,6 @@ static int omap_modeset_init(struct drm_device *dev)
>  
>  		drm_connector_attach_encoder(pipe->connector, encoder);
>  
> -		if (pipe->output->panel) {
> -			ret = drm_panel_attach(pipe->output->panel,
> -					       pipe->connector);
> -			if (ret < 0)
> -				return ret;
> -		}
> -
>  		crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
>  		if (IS_ERR(crtc))
>  			return PTR_ERR(crtc);
> @@ -394,18 +387,8 @@ static int omap_modeset_init(struct drm_device *dev)
>  
>  static void omap_modeset_fini(struct drm_device *ddev)
>  {
> -	struct omap_drm_private *priv = ddev->dev_private;
> -	unsigned int i;
> -
>  	omap_drm_irq_uninstall(ddev);
>  
> -	for (i = 0; i < priv->num_pipes; i++) {
> -		struct omap_drm_pipeline *pipe = &priv->pipes[i];
> -
> -		if (pipe->output->panel)
> -			drm_panel_detach(pipe->output->panel);
> -	}
> -
>  	drm_mode_config_cleanup(ddev);
>  }
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> index ab0d49618cf9..bced729a96fe 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -677,15 +677,11 @@ static int rcar_lvds_attach(struct drm_bridge *bridge,
>  	if (ret < 0)
>  		return ret;
>  
> -	return drm_panel_attach(lvds->panel, connector);
> +	return 0;
>  }
>  
>  static void rcar_lvds_detach(struct drm_bridge *bridge)
>  {
> -	struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
> -
> -	if (lvds->panel)
> -		drm_panel_detach(lvds->panel);
>  }
>  
>  static const struct drm_bridge_funcs rcar_lvds_bridge_ops = {
> diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
> index 63f967902c2d..f292c6a6e20f 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
> @@ -634,13 +634,6 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
>  				      "failed to attach encoder: %d\n", ret);
>  			goto err_free_connector;
>  		}
> -
> -		ret = drm_panel_attach(lvds->panel, connector);
> -		if (ret < 0) {
> -			DRM_DEV_ERROR(drm_dev->dev,
> -				      "failed to attach panel: %d\n", ret);
> -			goto err_free_connector;
> -		}
>  	} else {
>  		ret = drm_bridge_attach(encoder, lvds->bridge, NULL, 0);
>  		if (ret) {
> @@ -676,8 +669,6 @@ static void rockchip_lvds_unbind(struct device *dev, struct device *master,
>  
>  	encoder_funcs = lvds->soc_data->helper_funcs;
>  	encoder_funcs->disable(&lvds->encoder);
> -	if (lvds->panel)
> -		drm_panel_detach(lvds->panel);
>  	pm_runtime_disable(dev);
>  	drm_connector_cleanup(&lvds->connector);
>  	drm_encoder_cleanup(&lvds->encoder);
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index de4af7735c46..ddb4184f0726 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -389,8 +389,6 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
>  		dvo->panel = of_drm_find_panel(dvo->panel_node);
>  		if (IS_ERR(dvo->panel))
>  			dvo->panel = NULL;
> -		else
> -			drm_panel_attach(dvo->panel, connector);
>  	}
>  
>  	if (dvo->panel)
> diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c
> index ffda3184aa12..d06dd313d3c0 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
> @@ -54,9 +54,6 @@ static struct drm_connector_helper_funcs sun4i_lvds_con_helper_funcs = {
>  static void
>  sun4i_lvds_connector_destroy(struct drm_connector *connector)
>  {
> -	struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
> -
> -	drm_panel_detach(lvds->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -141,12 +138,6 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  
>  		drm_connector_attach_encoder(&lvds->connector,
>  						  &lvds->encoder);
> -
> -		ret = drm_panel_attach(lvds->panel, &lvds->connector);
> -		if (ret) {
> -			dev_err(drm->dev, "Couldn't attach our panel\n");
> -			goto err_cleanup_connector;
> -		}
>  	}
>  
>  	if (bridge) {
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index 5a7d43939ae6..e08afdffef50 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -147,7 +147,6 @@ sun4i_rgb_connector_destroy(struct drm_connector *connector)
>  {
>  	struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
>  
> -	drm_panel_detach(rgb->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -233,12 +232,6 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  
>  		drm_connector_attach_encoder(&rgb->connector,
>  						  &rgb->encoder);
> -
> -		ret = drm_panel_attach(rgb->panel, &rgb->connector);
> -		if (ret) {
> -			dev_err(drm->dev, "Couldn't attach our panel\n");
> -			goto err_cleanup_connector;
> -		}
>  	}
>  
>  	if (rgb->bridge) {
> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> index aa67cb037e9d..128471b65f64 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> @@ -973,7 +973,6 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
>  	dsi->panel = panel;
>  	dsi->device = device;
>  
> -	drm_panel_attach(dsi->panel, &dsi->connector);
>  	drm_kms_helper_hotplug_event(dsi->drm);
>  
>  	dev_info(host->dev, "Attached device %s\n", device->name);
> @@ -990,7 +989,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
>  	dsi->panel = NULL;
>  	dsi->device = NULL;
>  
> -	drm_panel_detach(panel);
>  	drm_kms_helper_hotplug_event(dsi->drm);
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
> index 3820e8dff14b..3387de79718b 100644
> --- a/drivers/gpu/drm/tegra/dsi.c
> +++ b/drivers/gpu/drm/tegra/dsi.c
> @@ -1498,10 +1498,8 @@ static int tegra_dsi_host_attach(struct mipi_dsi_host *host,
>  		if (IS_ERR(output->panel))
>  			output->panel = NULL;
>  
> -		if (output->panel && output->connector.dev) {
> -			drm_panel_attach(output->panel, &output->connector);
> +		if (output->panel && output->connector.dev)
>  			drm_helper_hpd_irq_event(output->connector.dev);
> -		}
>  	}
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
> index e36e5e7c2f69..a3adb9e4debf 100644
> --- a/drivers/gpu/drm/tegra/output.c
> +++ b/drivers/gpu/drm/tegra/output.c
> @@ -179,13 +179,6 @@ void tegra_output_remove(struct tegra_output *output)
>  int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
>  {
>  	int connector_type;
> -	int err;
> -
> -	if (output->panel) {
> -		err = drm_panel_attach(output->panel, &output->connector);
> -		if (err < 0)
> -			return err;
> -	}
>  
>  	/*
>  	 * The connector is now registered and ready to receive hotplug events
> @@ -220,9 +213,6 @@ void tegra_output_exit(struct tegra_output *output)
>  	 */
>  	if (output->hpd_gpio)
>  		disable_irq(output->hpd_irq);
> -
> -	if (output->panel)
> -		drm_panel_detach(output->panel);
>  }
>  
>  void tegra_output_find_possible_crtcs(struct tegra_output *output,
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 6193cb555acc..9b374f88fb76 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -178,9 +178,6 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
>  int drm_panel_add(struct drm_panel *panel);
>  void drm_panel_remove(struct drm_panel *panel);
>  
> -int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
> -void drm_panel_detach(struct drm_panel *panel);
> -
>  int drm_panel_prepare(struct drm_panel *panel);
>  int drm_panel_unprepare(struct drm_panel *panel);
>  
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH V2] drm: Remove unnecessary drm_panel_attach and drm_panel_detach
  2020-08-02 17:34         ` Sam Ravnborg
@ 2020-08-08  8:10           ` Sam Ravnborg
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2020-08-08  8:10 UTC (permalink / raw)
  To: Joe Perches
  Cc: opensource.kernel, Stefan Mavrodiev, David Airlie, Bernard Zhao,
	Jerry Han, linux-kernel, dri-devel, Thierry Reding,
	Laurent Pinchart, Thomas Zimmermann, Robert Chiras,
	Icenowy Zheng, Jagan Teki

Hi Joe.

On Sun, Aug 02, 2020 at 07:34:13PM +0200, Sam Ravnborg wrote:
> Hi Joe.
> 
> On Sun, Aug 02, 2020 at 09:43:59AM -0700, Joe Perches wrote:
> > These functions are now empty and no longer
> > useful so remove the functions and their uses.
> > 
> > Signed-off-by: Joe Perches <joe@perches.com>
> > ---
> > 
> > > > It's too tedious to break apart into multiple patches.
> > > > Done with coccinelle and typing.
> > > > 
> > > > Compiled allyesconfig x86-64 only.
> > 
> > V2: Removed 3 additional lines
> > 
> > drivers/gpu/drm/omapdrm/omap_drv.c:390:27: warning: unused variable ‘priv’ [-Wunused-variable]
> > drivers/gpu/drm/exynos/exynos_drm_dpi.c:45:21: warning: unused variable ‘ctx’ [-Wunused-variable]
> > drivers/gpu/drm/sun4i/sun4i_lvds.c:57:21: warning: unused variable ‘lvds’ [-Wunused-variable]
> 
> Thanks, better now.
> 
> I had to fix a few warnings and a build error to get it going on
> drm-misc-next. I will keep it locally just to let anyone speak up.
> I you do not see any mail from me until friday that it is applied please
> ping me.
Thanks, Now applied to drm-misc-next. Will show up in -next sometimes after the
current merge window closes.

	Sam
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-08-08  8:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 12:02 [PATCH] drm/panel: remove return value of function drm_panel_add Bernard Zhao
2020-08-01 14:27 ` Linus Walleij
2020-08-02  7:07 ` Sam Ravnborg
2020-08-02  8:00   ` [PATCH] drm: Remove unnecessary drm_panel_attach and drm_panel_detach Joe Perches
2020-08-02  8:44     ` Sam Ravnborg
2020-08-02 16:43       ` [PATCH V2] " Joe Perches
2020-08-02 17:34         ` Sam Ravnborg
2020-08-08  8:10           ` Sam Ravnborg

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