drm/panel: Remove drm_panel_detach() calls from all panel drivers
authorJyri Sarha <jsarha@ti.com>
Thu, 26 Apr 2018 08:06:59 +0000 (11:06 +0300)
committerThierry Reding <treding@nvidia.com>
Fri, 18 May 2018 09:22:06 +0000 (11:22 +0200)
Remove all drm_panel_detach() calls from all panel drivers and update
the kerneldoc for drm_panel_detach().

Setting the connector and drm to NULL when the DRM panel device is going
away hardly serves any purpose. Usually the whole memory structure is
freed right after the remove call. However, calling the detach function
from the master DRM device, and setting the connector pointer to NULL,
has the logic of marking the panel again as available for another DRM
master to attach. The usual situation would be the same DRM master
device binding again.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/464b8d330d6b4c94cfb5aad2ca9ea7eb2c52d934.1524727888.git.jsarha@ti.com
drivers/gpu/drm/drm_panel.c
drivers/gpu/drm/panel/panel-innolux-p079zca.c
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
drivers/gpu/drm/panel/panel-lvds.c
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
drivers/gpu/drm/panel/panel-simple.c
drivers/gpu/drm/panel/panel-sitronix-st7789v.c

index 308d442a531b2dda2145dd296ee309ccda88e214..71e407574276be7b4af4945082a516394c117013 100644 (file)
@@ -94,6 +94,9 @@ EXPORT_SYMBOL(drm_panel_remove);
  *
  * 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)
@@ -115,6 +118,9 @@ EXPORT_SYMBOL(drm_panel_attach);
  * 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().
+ *
  * Return: 0 on success or a negative error code on failure.
  */
 int drm_panel_detach(struct drm_panel *panel)
index 57df39b5c5899cd3caaffb51d8dbf5d7b2a2eea2..bb53e085076435df1376b1fd191a49815841638e 100644 (file)
@@ -292,7 +292,6 @@ static int innolux_panel_remove(struct mipi_dsi_device *dsi)
                DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
                              err);
 
-       drm_panel_detach(&innolux->base);
        innolux_panel_del(innolux);
 
        return 0;
index 0a94ab79a6c0f768227a3c273751913ef5bc512e..99caa7835e7b11d0be01b6aa5a0bbb3268cbd4ba 100644 (file)
@@ -500,7 +500,6 @@ static int jdi_panel_remove(struct mipi_dsi_device *dsi)
                dev_err(&dsi->dev, "failed to detach from DSI host: %d\n",
                        ret);
 
-       drm_panel_detach(&jdi->base);
        jdi_panel_del(jdi);
 
        return 0;
index 5185819c5b797c0d834d64fa4d8951b56c01f4f7..8a1687887ae912f310b7214de6ef779d905179ae 100644 (file)
@@ -282,7 +282,6 @@ static int panel_lvds_remove(struct platform_device *pdev)
 {
        struct panel_lvds *lvds = dev_get_drvdata(&pdev->dev);
 
-       drm_panel_detach(&lvds->panel);
        drm_panel_remove(&lvds->panel);
 
        panel_lvds_disable(&lvds->panel);
index 74a806121f80e58a42149cdd45a2536a1f6d8d70..cb4dfb98be0f11819f27183282f7d713895b1ba9 100644 (file)
@@ -299,7 +299,6 @@ static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi)
        if (ret < 0)
                dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
-       drm_panel_detach(&wuxga_nt->base);
        wuxga_nt_panel_del(wuxga_nt);
 
        return 0;
index 71c09ed436ae46d652e4a7dfe0c51277d57df12f..75f92539055104c14aba1fa9e42f39b71c1f3467 100644 (file)
@@ -292,7 +292,6 @@ static int seiko_panel_remove(struct platform_device *pdev)
 {
        struct seiko_panel *panel = dev_get_drvdata(&pdev->dev);
 
-       drm_panel_detach(&panel->base);
        drm_panel_remove(&panel->base);
 
        seiko_panel_disable(&panel->base);
index 6bf8730f1a2115068e82b5fdc6c4694d9acdb9fb..02fc0f5423d40e585dd8d12002c2bfc98a5c4717 100644 (file)
@@ -418,7 +418,6 @@ static int sharp_panel_remove(struct mipi_dsi_device *dsi)
        if (err < 0)
                dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
 
-       drm_panel_detach(&sharp->base);
        sharp_panel_del(sharp);
 
        return 0;
index 494aa9b1628a7275210e9a657522287a76c0e385..e5cae0050f52d45a1c0c8fd387efb893d521196f 100644 (file)
@@ -327,7 +327,6 @@ static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
        if (ret < 0)
                dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
-       drm_panel_detach(&sharp_nt->base);
        sharp_nt_panel_del(sharp_nt);
 
        return 0;
index cbf1ab404ee77316ac6edd504df143bdb1cd39ef..062b6b416b896866a4e082f860dd7276720e6cd2 100644 (file)
@@ -364,7 +364,6 @@ static int panel_simple_remove(struct device *dev)
 {
        struct panel_simple *panel = dev_get_drvdata(dev);
 
-       drm_panel_detach(&panel->base);
        drm_panel_remove(&panel->base);
 
        panel_simple_disable(&panel->base);
index 358c64ef192223e40e6a72b27e5b287aab5147ed..74284e5afc5d9f78b6746554ecc124f641b89276 100644 (file)
@@ -419,7 +419,6 @@ static int st7789v_remove(struct spi_device *spi)
 {
        struct st7789v *ctx = spi_get_drvdata(spi);
 
-       drm_panel_detach(&ctx->panel);
        drm_panel_remove(&ctx->panel);
 
        if (ctx->backlight)