From nobody Sat Feb 7 10:48:22 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 915F4E94136 for ; Fri, 6 Oct 2023 22:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbjJFWoY (ORCPT ); Fri, 6 Oct 2023 18:44:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbjJFWoX (ORCPT ); Fri, 6 Oct 2023 18:44:23 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60E63CE for ; Fri, 6 Oct 2023 15:44:20 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB5F2C433C7; Fri, 6 Oct 2023 22:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696632260; bh=PQz5UeW21b7XKeFrQQ5YTYUWOaEon50sFtfDEhbwZFI=; h=From:To:Cc:Subject:Date:From; b=ZRDSzcuXNkG2Ofz//hmBSWeq0rZAbbcZKXhCpHriAcLi3qCd/YN4FO+Fjfy4LOiKG E5AWxEVE6S47bMDfbQFnN6mup+VdTkS/JbG3WUjBit8ODYf5QigaDor3zThHM6wLP8 19RdhmlNluRo6yOlXY07THzReb8Eb5MfNMjWdHHm77B2UNzy2NbTqYSzG7xzGt5URy vH++CANyN5sWq8AYRO15bbLdyjFaLUupNu6B5jRvz1FjwO+0M+PSr9BYDx/jY8Rl45 ASBEWOvBpjZfz2MnypD4l66UaHe23GhsZkTZlQza0nwj02uuI8mYMaCNSVnsZeo1NZ J+rVp110FSnvg== Received: (nullmailer pid 442430 invoked by uid 1000); Fri, 06 Oct 2023 22:44:18 -0000 From: Rob Herring To: Jassi Brar Cc: linux-kernel@vger.kernel.org Subject: [PATCH] mailbox: Use device_get_match_data() Date: Fri, 6 Oct 2023 17:44:06 -0500 Message-Id: <20231006224407.442205-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- drivers/mailbox/bcm-pdc-mailbox.c | 10 +++------- drivers/mailbox/mailbox-sti.c | 8 +++----- drivers/mailbox/ti-msgmgr.c | 12 ++---------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-ma= ilbox.c index d67db63b482d..778faeced81e 100644 --- a/drivers/mailbox/bcm-pdc-mailbox.c +++ b/drivers/mailbox/bcm-pdc-mailbox.c @@ -33,10 +33,9 @@ #include #include #include +#include #include #include -#include -#include #include #include #include @@ -1494,7 +1493,6 @@ static int pdc_dt_read(struct platform_device *pdev, = struct pdc_state *pdcs) { struct device *dev =3D &pdev->dev; struct device_node *dn =3D pdev->dev.of_node; - const struct of_device_id *match; const int *hw_type; int err; =20 @@ -1509,11 +1507,9 @@ static int pdc_dt_read(struct platform_device *pdev,= struct pdc_state *pdcs) =20 pdcs->hw_type =3D PDC_HW; =20 - match =3D of_match_device(of_match_ptr(pdc_mbox_of_match), dev); - if (match !=3D NULL) { - hw_type =3D match->data; + hw_type =3D device_get_match_data(dev); + if (hw_type) pdcs->hw_type =3D *hw_type; - } =20 return 0; } diff --git a/drivers/mailbox/mailbox-sti.c b/drivers/mailbox/mailbox-sti.c index 823061dd8c8e..b4b5bdd503cf 100644 --- a/drivers/mailbox/mailbox-sti.c +++ b/drivers/mailbox/mailbox-sti.c @@ -17,8 +17,8 @@ #include #include #include -#include #include +#include #include =20 #include "mailbox.h" @@ -403,7 +403,6 @@ MODULE_DEVICE_TABLE(of, sti_mailbox_match); =20 static int sti_mbox_probe(struct platform_device *pdev) { - const struct of_device_id *match; struct mbox_controller *mbox; struct sti_mbox_device *mdev; struct device_node *np =3D pdev->dev.of_node; @@ -411,12 +410,11 @@ static int sti_mbox_probe(struct platform_device *pde= v) int irq; int ret; =20 - match =3D of_match_device(sti_mailbox_match, &pdev->dev); - if (!match) { + pdev->dev.platform_data =3D (struct sti_mbox_pdata *)device_get_match_dat= a(&pdev->dev); + if (!pdev->dev.platform_data) { dev_err(&pdev->dev, "No configuration found\n"); return -ENODEV; } - pdev->dev.platform_data =3D (struct sti_mbox_pdata *) match->data; =20 mdev =3D devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); if (!mdev) diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c index a94577f16a47..9d2d4ff6cda4 100644 --- a/drivers/mailbox/ti-msgmgr.c +++ b/drivers/mailbox/ti-msgmgr.c @@ -15,10 +15,10 @@ #include #include #include -#include #include #include #include +#include #include =20 #define Q_DATA_OFFSET(proxy, queue, reg) \ @@ -810,7 +810,6 @@ MODULE_DEVICE_TABLE(of, ti_msgmgr_of_match); static int ti_msgmgr_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - const struct of_device_id *of_id; struct device_node *np; const struct ti_msgmgr_desc *desc; struct ti_msgmgr_inst *inst; @@ -828,19 +827,12 @@ static int ti_msgmgr_probe(struct platform_device *pd= ev) } np =3D dev->of_node; =20 - of_id =3D of_match_device(ti_msgmgr_of_match, dev); - if (!of_id) { - dev_err(dev, "OF data missing\n"); - return -EINVAL; - } - desc =3D of_id->data; - inst =3D devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); if (!inst) return -ENOMEM; =20 inst->dev =3D dev; - inst->desc =3D desc; + inst->desc =3D desc =3D device_get_match_data(dev); =20 inst->queue_proxy_region =3D devm_platform_ioremap_resource_byname(pdev, desc->data_region_name); --=20 2.40.1