From patchwork Mon Jul 17 13:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13315785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24A11EB64DC for ; Mon, 17 Jul 2023 13:34:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D3E510E253; Mon, 17 Jul 2023 13:34:19 +0000 (UTC) Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by gabe.freedesktop.org (Postfix) with ESMTPS id 338C110E257 for ; Mon, 17 Jul 2023 13:34:16 +0000 (UTC) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:5803:2d6d:5bbc:e252]) by laurent.telenet-ops.be with bizsmtp id NDaE2A0030ucMBo01DaEsE; Mon, 17 Jul 2023 15:34:14 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qLOMX-001fzk-83; Mon, 17 Jul 2023 15:34:14 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qLOMg-007RAi-4y; Mon, 17 Jul 2023 15:34:14 +0200 From: Geert Uytterhoeven To: Neil Armstrong , Sam Ravnborg , David Airlie , Daniel Vetter Subject: [PATCH resend] drm/panel: simple: Simplify matching using of_device_get_match_data() Date: Mon, 17 Jul 2023 15:34:13 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "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 Reviewed-by: Sam Ravnborg --- 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;