[v2,5/5] drm/bridge/synopsys: dsi :remove is_panel_bridge

Message ID 1506936888-23844-6-git-send-email-benjamin.gaignard@linaro.org
State New
Headers show
Series
  • Simplify panel bridge cleanup
Related show

Commit Message

Benjamin Gaignard Oct. 2, 2017, 9:34 a.m.
When using drm_of_panel_bridge_remove() we can simplify the
code and remove is_panel_bridge from dw_mipi_dsi structure.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

Reviewed-by: Philippe Cornu <philippe.cornu@st.com>

Tested-by: Philippe Cornu <philippe.cornu@st.com>

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
2.7.4

Comments

Emil Velikov Oct. 3, 2017, 9:24 a.m. | #1
On 2 October 2017 at 10:34, Benjamin Gaignard
<benjamin.gaignard@linaro.org> wrote:
> When using drm_of_panel_bridge_remove() we can simplify the

> code and remove is_panel_bridge from dw_mipi_dsi structure.

>

As the previous patches remove the struct drm_bridge pointer, it might
be worth mentioning why that cannot be done here?

If you agree, please don't resent the patches - just amend before pushing.

Thanks
Emil
Benjamin Gaignard Oct. 3, 2017, 12:55 p.m. | #2
2017-10-03 11:24 GMT+02:00 Emil Velikov <emil.l.velikov@gmail.com>:
> On 2 October 2017 at 10:34, Benjamin Gaignard

> <benjamin.gaignard@linaro.org> wrote:

>> When using drm_of_panel_bridge_remove() we can simplify the

>> code and remove is_panel_bridge from dw_mipi_dsi structure.

>>

> As the previous patches remove the struct drm_bridge pointer, it might

> be worth mentioning why that cannot be done here?

>

> If you agree, please don't resent the patches - just amend before pushing.


Will add that:
Because drm_bridge pointer is used in attach and post_disable functions it can't
be removed from internal driver structure .

>

> Thanks

> Emil

Patch

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index f4f633a..d9cca4f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -221,7 +221,6 @@  struct dw_mipi_dsi {
 	struct drm_bridge bridge;
 	struct mipi_dsi_host dsi_host;
 	struct drm_bridge *panel_bridge;
-	bool is_panel_bridge;
 	struct device *dev;
 	void __iomem *base;
 
@@ -297,7 +296,6 @@  static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
 		bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_DSI);
 		if (IS_ERR(bridge))
 			return PTR_ERR(bridge);
-		dsi->is_panel_bridge = true;
 	}
 
 	dsi->panel_bridge = bridge;
@@ -312,8 +310,7 @@  static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
 {
 	struct dw_mipi_dsi *dsi = host_to_dsi(host);
 
-	if (dsi->is_panel_bridge)
-		drm_panel_bridge_remove(dsi->panel_bridge);
+	drm_of_panel_bridge_remove(host->dev->of_node, 1, 0);
 
 	drm_bridge_remove(&dsi->bridge);