drm: Remove unnecessary drm_panel_attach and drm_panel_detach
authorJoe Perches <joe@perches.com>
Sun, 2 Aug 2020 16:43:59 +0000 (09:43 -0700)
committerSam Ravnborg <sam@ravnborg.org>
Sat, 8 Aug 2020 07:06:33 +0000 (09:06 +0200)
These functions are now empty and no longer
useful so remove the functions and their uses.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Bernard Zhao <bernard@vivo.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>,
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Icenowy Zheng <icenowy@aosc.io>,
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: dri-devel@lists.freedesktop.org,
Cc: linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> # Fixed build and a few warnings
Link: https://patchwork.freedesktop.org/patch/msgid/9e13761020750b1ce2f1fabee23ef6e2a2942882.camel@perches.com
23 files changed:
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
drivers/gpu/drm/bridge/panel.c
drivers/gpu/drm/bridge/ti-sn65dsi86.c
drivers/gpu/drm/drm_panel.c
drivers/gpu/drm/exynos/exynos_drm_dpi.c
drivers/gpu/drm/exynos/exynos_drm_dsi.c
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
drivers/gpu/drm/imx/imx-ldb.c
drivers/gpu/drm/imx/parallel-display.c
drivers/gpu/drm/mediatek/mtk_dsi.c
drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
drivers/gpu/drm/msm/dsi/dsi_manager.c
drivers/gpu/drm/omapdrm/omap_drv.c
drivers/gpu/drm/rcar-du/rcar_lvds.c
drivers/gpu/drm/rockchip/rockchip_lvds.c
drivers/gpu/drm/sti/sti_dvo.c
drivers/gpu/drm/sun4i/sun4i_lvds.c
drivers/gpu/drm/sun4i/sun4i_rgb.c
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
drivers/gpu/drm/tegra/dsi.c
drivers/gpu/drm/tegra/output.c
include/drm/drm_panel.h

index f082b4e..d9164fa 100644 (file)
@@ -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;
 }
 
index 76736fb..aa1bb86 100644 (file)
@@ -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);
index 1e63ed6..0ddc375 100644 (file)
@@ -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)
index 86b9f0f..454544e 100644 (file)
@@ -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:
index b8e9abb..ba11c36 100644 (file)
@@ -93,42 +93,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
index 7ba5354..741323a 100644 (file)
@@ -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;
 }
index ee96a95..db0eab5 100644 (file)
@@ -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);
index 9b0c473..4d4a715 100644 (file)
@@ -40,10 +40,7 @@ int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device *fsl_dev,
 
 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 +98,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:
index 66ea68e..35a6bad 100644 (file)
@@ -463,13 +463,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;
 }
 
@@ -718,9 +711,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);
        }
index ac916c8..cba2abb 100644 (file)
@@ -298,9 +298,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);
@@ -369,9 +366,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);
 }
 
index 270bf22..e4e56e5 100644 (file)
@@ -861,19 +861,7 @@ static int mtk_dsi_create_connector(struct drm_device *drm, struct mtk_dsi *dsi)
        dsi->conn.dpms = DRM_MODE_DPMS_OFF;
        drm_connector_attach_encoder(&dsi->conn, &dsi->encoder);
 
-       if (dsi->panel) {
-               ret = drm_panel_attach(dsi->panel, &dsi->conn);
-               if (ret) {
-                       DRM_ERROR("Failed to attach panel to drm\n");
-                       goto err_connector_cleanup;
-               }
-       }
-
        return 0;
-
-err_connector_cleanup:
-       drm_connector_cleanup(&dsi->conn);
-       return ret;
 }
 
 static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
@@ -921,8 +909,6 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi)
        /* Skip connector cleanup if creation was delegated to the bridge */
        if (dsi->conn.dev)
                drm_connector_cleanup(&dsi->conn);
-       if (dsi->panel)
-               drm_panel_detach(dsi->panel);
 }
 
 static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp)
index c7df71e..7288041 100644 (file)
@@ -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;
 }
 
index 4b363bd..1d28dfb 100644 (file)
@@ -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;
index 4526967..53d5e18 100644 (file)
@@ -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);
 }
 
index ab0d496..bced729 100644 (file)
@@ -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 = {
index 63f9679..f292c6a 100644 (file)
@@ -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);
index de4af77..ddb4184 100644 (file)
@@ -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)
index ffda318..d06dd31 100644 (file)
@@ -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) {
index 5a7d439..23df1ec 100644 (file)
@@ -145,9 +145,6 @@ static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
 static void
 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 +230,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) {
index aa67cb0..a78aebf 100644 (file)
@@ -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);
@@ -985,12 +984,10 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
                            struct mipi_dsi_device *device)
 {
        struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
-       struct drm_panel *panel = dsi->panel;
 
        dsi->panel = NULL;
        dsi->device = NULL;
 
-       drm_panel_detach(panel);
        drm_kms_helper_hotplug_event(dsi->drm);
 
        return 0;
index 38beab9..37b89c3 100644 (file)
@@ -1493,10 +1493,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;
index e36e5e7..a3adb9e 100644 (file)
@@ -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,
index ff06652..45a1b5a 100644 (file)
@@ -178,9 +178,6 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
 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);
-void drm_panel_detach(struct drm_panel *panel);
-
 int drm_panel_prepare(struct drm_panel *panel);
 int drm_panel_unprepare(struct drm_panel *panel);