From nobody Fri Jan 2 17:09:11 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 32602CD6138 for ; Mon, 9 Oct 2023 21:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378707AbjJIVPZ (ORCPT ); Mon, 9 Oct 2023 17:15:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378785AbjJIVOw (ORCPT ); Mon, 9 Oct 2023 17:14:52 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D905C1A1 for ; Mon, 9 Oct 2023 14:14:33 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A26EC433C8; Mon, 9 Oct 2023 21:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696886073; bh=X1cH/h9NDVZrOok4vly/3g9sh+E04rVkCkSlfXlWOkc=; h=From:To:Cc:Subject:Date:From; b=UX5AlFcsmSNuOATqpTq/hIGo5FVEW6AOvZIzMyjgNvPnEIMxc0WKvQu08BweMdCFw 0zCmWnxuIchvRaQE/rVjCjZwq4po/w6dpkLmCDkI9D1Na1t0515QYR2RidgCz5Rd90 gdYcXPc0XrMJCb1s2LWdURita5X6F46xykVT0w25UhELnABfNrQ8xod18E3DeOgYAx tyXN6j/t9dhuK06eMT4UBk+nV+3s6U149ln3ThjasbJeCwtIcBTfCwWOtYlzuYrlxe mdEFlKV9cyMp0wjIPJUQGKLMKwkMzrWWijwCSKm7L6KNtXaN/x83pdrstCq1bDtYU1 EWK50UVpWY+/g== Received: (nullmailer pid 3246487 invoked by uid 1000); Mon, 09 Oct 2023 21:14:15 -0000 From: Rob Herring To: Peter Chen , Greg Kroah-Hartman , Minas Harutyunyan , Li Yang , Matthias Kaehlcke Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] usb: Use device_get_match_data() Date: Mon, 9 Oct 2023 16:13:46 -0500 Message-ID: <20231009211356.3242037-16-robh@kernel.org> X-Mailer: git-send-email 2.42.0 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/usb/chipidea/ci_hdrc_usb2.c | 11 +++++------ drivers/usb/dwc2/params.c | 21 ++++++--------------- drivers/usb/gadget/udc/fsl_qe_udc.c | 10 +++------- drivers/usb/misc/onboard_usb_hub.c | 7 +------ 4 files changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_= hdrc_usb2.c index 1321ee67f3b8..180a632dd7ba 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -9,9 +9,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -51,8 +51,8 @@ static int ci_hdrc_usb2_probe(struct platform_device *pde= v) struct device *dev =3D &pdev->dev; struct ci_hdrc_usb2_priv *priv; struct ci_hdrc_platform_data *ci_pdata =3D dev_get_platdata(dev); + const struct ci_hdrc_platform_data *data; int ret; - const struct of_device_id *match; =20 if (!ci_pdata) { ci_pdata =3D devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); @@ -61,11 +61,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *p= dev) *ci_pdata =3D ci_default_pdata; /* struct copy */ } =20 - match =3D of_match_device(ci_hdrc_usb2_of_match, &pdev->dev); - if (match && match->data) { + data =3D device_get_match_data(&pdev->dev); + if (data) /* struct copy */ - *ci_pdata =3D *(struct ci_hdrc_platform_data *)match->data; - } + *ci_pdata =3D *data; =20 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 93f52e371cdd..fb03162ae9b7 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -5,7 +5,7 @@ =20 #include #include -#include +#include #include #include #include @@ -968,26 +968,17 @@ typedef void (*set_params_cb)(struct dwc2_hsotg *data= ); =20 int dwc2_init_params(struct dwc2_hsotg *hsotg) { - const struct of_device_id *match; set_params_cb set_params; =20 dwc2_set_default_params(hsotg); dwc2_get_device_properties(hsotg); =20 - match =3D of_match_device(dwc2_of_match_table, hsotg->dev); - if (match && match->data) { - set_params =3D match->data; + set_params =3D device_get_match_data(hsotg->dev); + if (set_params) { set_params(hsotg); - } else if (!match) { - const struct acpi_device_id *amatch; - const struct pci_device_id *pmatch =3D NULL; - - amatch =3D acpi_match_device(dwc2_acpi_match, hsotg->dev); - if (amatch && amatch->driver_data) { - set_params =3D (set_params_cb)amatch->driver_data; - set_params(hsotg); - } else if (!amatch) - pmatch =3D pci_match_id(dwc2_pci_ids, to_pci_dev(hsotg->dev->parent)); + } else { + const struct pci_device_id *pmatch =3D + pci_match_id(dwc2_pci_ids, to_pci_dev(hsotg->dev->parent)); =20 if (pmatch && pmatch->driver_data) { set_params =3D (set_params_cb)pmatch->driver_data; diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/f= sl_qe_udc.c index 4aae86b47edf..4e88681a79b6 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -27,9 +27,10 @@ #include #include #include +#include #include #include -#include +#include #include #include #include @@ -2471,17 +2472,12 @@ static const struct of_device_id qe_udc_match[]; static int qe_udc_probe(struct platform_device *ofdev) { struct qe_udc *udc; - const struct of_device_id *match; struct device_node *np =3D ofdev->dev.of_node; struct qe_ep *ep; unsigned int ret =3D 0; unsigned int i; const void *prop; =20 - match =3D of_match_device(qe_udc_match, &ofdev->dev); - if (!match) - return -EINVAL; - prop =3D of_get_property(np, "mode", NULL); if (!prop || strcmp(prop, "peripheral")) return -ENODEV; @@ -2493,7 +2489,7 @@ static int qe_udc_probe(struct platform_device *ofdev) return -ENOMEM; } =20 - udc->soc_type =3D (unsigned long)match->data; + udc->soc_type =3D (unsigned long)device_get_match_data(&ofdev->dev); udc->usb_regs =3D of_iomap(np, 0); if (!udc->usb_regs) { ret =3D -ENOMEM; diff --git a/drivers/usb/misc/onboard_usb_hub.c b/drivers/usb/misc/onboard_= usb_hub.c index 57bbe1309094..a341b2fbb7b4 100644 --- a/drivers/usb/misc/onboard_usb_hub.c +++ b/drivers/usb/misc/onboard_usb_hub.c @@ -240,7 +240,6 @@ static void onboard_hub_attach_usb_driver(struct work_s= truct *work) =20 static int onboard_hub_probe(struct platform_device *pdev) { - const struct of_device_id *of_id; struct device *dev =3D &pdev->dev; struct onboard_hub *hub; unsigned int i; @@ -250,11 +249,7 @@ static int onboard_hub_probe(struct platform_device *p= dev) if (!hub) return -ENOMEM; =20 - of_id =3D of_match_device(onboard_hub_match, &pdev->dev); - if (!of_id) - return -ENODEV; - - hub->pdata =3D of_id->data; + hub->pdata =3D device_get_match_data(&pdev->dev); if (!hub->pdata) return -EINVAL; =20 --=20 2.42.0