Skip to contentSkip to conversation

drm/bridge: tc358762: use devm for bridge registration and DSI attach

PATCH Applied Osama Abdelkader 2 participants 6 messages May 21 – Jul 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/bridge: tc358762: use devm for bridge registration and DSI attach

Replace manual drm_bridge_remove()/mipi_dsi_detach() in remove with devm_drm_bridge_add() and devm_mipi_dsi_attach() in probe. Also check the return value from bridge registration.

---
 drivers/gpu/drm/bridge/tc358762.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/bridge/tc358762.c +5 -14
index 3d75d9cfa45e..3a021ca895f1 100644
@@ -293,25 +293,17 @@ static int tc358762_probe(struct mipi_dsi_device *dsi)
 	ctx->bridge.of_node = dev->of_node;
 	ctx->bridge.pre_enable_prev_first = true;
 
-	drm_bridge_add(&ctx->bridge);
+	ret = devm_drm_bridge_add(dev, &ctx->bridge);
+	if (ret < 0)
+		return ret;
 
-	ret = mipi_dsi_attach(dsi);
-	if (ret < 0) {
-		drm_bridge_remove(&ctx->bridge);
+	ret = devm_mipi_dsi_attach(dev, dsi);
+	if (ret < 0)
 		dev_err(dev, "failed to attach dsi\n");
-	}
 
 	return ret;
 }
 
-static void tc358762_remove(struct mipi_dsi_device *dsi)
-{
-	struct tc358762 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
-	drm_bridge_remove(&ctx->bridge);
-}
-
 static const struct of_device_id tc358762_of_match[] = {
 	{ .compatible = "toshiba,tc358762" },
 	{ }
@@ -320,7 +312,6 @@ MODULE_DEVICE_TABLE(of, tc358762_of_match);
 
 static struct mipi_dsi_driver tc358762_driver = {
 	.probe = tc358762_probe,
-	.remove = tc358762_remove,
 	.driver = {
 		.name = "tc358762",
 		.of_match_table = tc358762_of_match,
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 drm/bridge: tc358764: use devm for bridge registration and DSI attach

Replace manual drm_bridge_remove()/mipi_dsi_detach() in remove with devm_drm_bridge_add() and devm_mipi_dsi_attach() in probe. Also check the return value from bridge registration.

---
 drivers/gpu/drm/bridge/tc358764.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/bridge/tc358764.c +5 -14
index 084e9d898e22..ae652f2eef1b 100644
@@ -372,25 +372,17 @@ static int tc358764_probe(struct mipi_dsi_device *dsi)
 	ctx->bridge.of_node = dev->of_node;
 	ctx->bridge.pre_enable_prev_first = true;
 
-	drm_bridge_add(&ctx->bridge);
+	ret = devm_drm_bridge_add(dev, &ctx->bridge);
+	if (ret < 0)
+		return ret;
 
-	ret = mipi_dsi_attach(dsi);
-	if (ret < 0) {
-		drm_bridge_remove(&ctx->bridge);
+	ret = devm_mipi_dsi_attach(dev, dsi);
+	if (ret < 0)
 		dev_err(dev, "failed to attach dsi\n");
-	}
 
 	return ret;
 }
 
-static void tc358764_remove(struct mipi_dsi_device *dsi)
-{
-	struct tc358764 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
-	drm_bridge_remove(&ctx->bridge);
-}
-
 static const struct of_device_id tc358764_of_match[] = {
 	{ .compatible = "toshiba,tc358764" },
 	{ }
@@ -399,7 +391,6 @@ MODULE_DEVICE_TABLE(of, tc358764_of_match);
 
 static struct mipi_dsi_driver tc358764_driver = {
 	.probe = tc358764_probe,
-	.remove = tc358764_remove,
 	.driver = {
 		.name = "tc358764",
 		.of_match_table = tc358764_of_match,
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/bridge: tc358764: use devm for bridge registration and DSI attach

Quoted 5 lines · Osama Abdelkader

Replace manual drm_bridge_remove()/mipi_dsi_detach() in remove with devm_drm_bridge_add() and devm_mipi_dsi_attach() in probe. Also check the return value from bridge registration.

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#3 lore raw
In reply to Osama Abdelkader
Quoted 55 lines · Osama Abdelkader

Replace manual drm_bridge_remove()/mipi_dsi_detach() in remove with devm_drm_bridge_add() and devm_mipi_dsi_attach() in probe. Also check the return value from bridge registration.

---
 drivers/gpu/drm/bridge/tc358762.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/bridge/tc358762.c +5 -14
index 3d75d9cfa45e..3a021ca895f1 100644
@@ -293,25 +293,17 @@ static int tc358762_probe(struct mipi_dsi_device *dsi)
 	ctx->bridge.of_node = dev->of_node;
 	ctx->bridge.pre_enable_prev_first = true;
 
-	drm_bridge_add(&ctx->bridge);
+	ret = devm_drm_bridge_add(dev, &ctx->bridge);
+	if (ret < 0)
+		return ret;
 
-	ret = mipi_dsi_attach(dsi);
-	if (ret < 0) {
-		drm_bridge_remove(&ctx->bridge);
+	ret = devm_mipi_dsi_attach(dev, dsi);
+	if (ret < 0)
 		dev_err(dev, "failed to attach dsi\n");
-	}
 
 	return ret;
 }
 
-static void tc358762_remove(struct mipi_dsi_device *dsi)
-{
-	struct tc358762 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
-	drm_bridge_remove(&ctx->bridge);
-}
-
 static const struct of_device_id tc358762_of_match[] = {
 	{ .compatible = "toshiba,tc358762" },
 	{ }
@@ -320,7 +312,6 @@ MODULE_DEVICE_TABLE(of, tc358762_of_match);
 
 static struct mipi_dsi_driver tc358762_driver = {
 	.probe = tc358762_probe,
-	.remove = tc358762_remove,
 	.driver = {
 		.name = "tc358762",
 		.of_match_table = tc358762_of_match,
Signature · 1 line
2.43.0

ping.

reviewer Reviewed-by on v1 1/2
#4 lore raw
In reply to Osama Abdelkader
Quoted 5 lines · Osama Abdelkader

Replace manual drm_bridge_remove()/mipi_dsi_detach() in remove with devm_drm_bridge_add() and devm_mipi_dsi_attach() in probe. Also check the return value from bridge registration.

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

reviewer Applied
#5 lore raw
In reply to Osama Abdelkader
Quoted 3 lines · Osama Abdelkader

Replace manual drm_bridge_remove()/mipi_dsi_detach() in remove with devm_drm_bridge_add() and devm_mipi_dsi_attach() in probe. Also check the return value from bridge registration.

Applied, thanks!

[1/2] drm/bridge: tc358762: use devm for bridge registration and DSI attach

      commit: 19ff4e174fe5d5bdf0985a670549c02b7eb84c68
[2/2] drm/bridge: tc358764: use devm for bridge registration and DSI attach
      commit: 05271b55f1cd9c1e2472c3be58474490a29c39c8

Best regards,

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com