dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend] drm/panel: simple: Simplify matching using of_device_get_match_data()
@ 2023-07-17 13:34 Geert Uytterhoeven
  2023-07-17 15:24 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2023-07-17 13:34 UTC (permalink / raw)
  To: Neil Armstrong, Sam Ravnborg, David Airlie, Daniel Vetter
  Cc: linux-renesas-soc, Geert Uytterhoeven, dri-devel

Both the patform_driver and mipi_dsi_driver structures contain pointers
to the match table used, so the custom code to obtain match and match
data can be replaced by calls to of_device_get_match_data().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/panel/panel-simple.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 241243447b3e5c81..70326f335f44c295 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -4457,13 +4457,13 @@ MODULE_DEVICE_TABLE(of, platform_of_match);
 
 static int panel_simple_platform_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *id;
+	const struct panel_desc *desc;
 
-	id = of_match_node(platform_of_match, pdev->dev.of_node);
-	if (!id)
+	desc = of_device_get_match_data(&pdev->dev);
+	if (!desc)
 		return -ENODEV;
 
-	return panel_simple_probe(&pdev->dev, id->data);
+	return panel_simple_probe(&pdev->dev, desc);
 }
 
 static void panel_simple_platform_remove(struct platform_device *pdev)
@@ -4734,15 +4734,12 @@ MODULE_DEVICE_TABLE(of, dsi_of_match);
 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
 {
 	const struct panel_desc_dsi *desc;
-	const struct of_device_id *id;
 	int err;
 
-	id = of_match_node(dsi_of_match, dsi->dev.of_node);
-	if (!id)
+	desc = of_device_get_match_data(&dsi->dev);
+	if (!desc)
 		return -ENODEV;
 
-	desc = id->data;
-
 	err = panel_simple_probe(&dsi->dev, &desc->desc);
 	if (err < 0)
 		return err;
-- 
2.34.1


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

* Re: [PATCH resend] drm/panel: simple: Simplify matching using of_device_get_match_data()
  2023-07-17 13:34 [PATCH resend] drm/panel: simple: Simplify matching using of_device_get_match_data() Geert Uytterhoeven
@ 2023-07-17 15:24 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2023-07-17 15:24 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-renesas-soc, Neil Armstrong, dri-devel

On Mon, Jul 17, 2023 at 03:34:13PM +0200, Geert Uytterhoeven wrote:
> Both the patform_driver and mipi_dsi_driver structures contain pointers
> to the match table used, so the custom code to obtain match and match
> data can be replaced by calls to of_device_get_match_data().
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Simpler - nice.
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I expect someone else to pick it up.

	Sam

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

end of thread, other threads:[~2023-07-17 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 13:34 [PATCH resend] drm/panel: simple: Simplify matching using of_device_get_match_data() Geert Uytterhoeven
2023-07-17 15:24 ` 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).