Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp677171rdb; Fri, 6 Oct 2023 15:45:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAVUBPShLP7Avz3uw+fZAWldnIbT07PfPg4U2g0E1U64Q5GYvhVVBvlNsjv+2/7vPkHmMW X-Received: by 2002:a05:6a00:3981:b0:68f:c078:b0c9 with SMTP id fi1-20020a056a00398100b0068fc078b0c9mr10340493pfb.11.1696632306792; Fri, 06 Oct 2023 15:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696632306; cv=none; d=google.com; s=arc-20160816; b=wT32C2QQE/XXKxPweaaqOB5trm6RN7Q0Vmw3R97toajvmV90w8WTcUY8t44wT5dbXg EdqUDCv7JRL8gFZVTxk8rMSRU6p1kDhfYedGsqesr5LPW8CqRrvkOdfEUas7qPqvsJhy ZqiASZ1r9ooln15TWbmZ7Si848bAJ0CyOEXIqcUKLy0KJ7cVWfZOFMrwo5P2sfVuKvNK BazgRifBAUZzUMyO+LHc6bJw6pJq+JIavpGb1ZOWMxidMzfnUoGRTKbnEZsGOQDPDE+y 29VdGH7GUMotf1dpxszWKWQG8JYBcCIe+C1g086kkPbNEcGGEh9mm2QN1FV09eNuGGOt SsdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AOKqjSWAw1haG/bSxHi8eIlgjP9wVw2PPabgaV3gT4E=; fh=6c5cBzcMbuygyUtU8BVQdmuag7d2UnABxzQxfZfZ810=; b=dIubm0oPF4V0fmNmjscoGJkw4bh4cXuvmjiR8Bad4KWw766QD3TK6mqABIFNDywuu6 V3AWrbJKVdTWgh2w7clwB2b+BHOTFe3uCk/a/ruNKimBdY4PE7IzrX0u5m0mvh8j9hNF wkNv4I8vPt/FICX7pvSITbOBX9FYLsJyBPYDQCiFvuZ7nHCjd5/ZkauEArANXlhIhCRL fpIwT2kqJExVpb/SXlfq0b4VevXZWX4f+ThErKicdoxP43c5hPGRIWURQpkVdjjseQDR d2tRfON1UEuAHvIRbf9Y9JZQS1QN2JZSab47ZyH+25QS8p49tDrS4HjLN/5BZpNoO3zL 1cnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uRiT5kH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x5-20020a654145000000b00584b6c0d62csi2210271pgp.356.2023.10.06.15.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 15:45:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uRiT5kH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2E1EA80A5311; Fri, 6 Oct 2023 15:45:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233810AbjJFWos (ORCPT + 99 others); Fri, 6 Oct 2023 18:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233807AbjJFWor (ORCPT ); Fri, 6 Oct 2023 18:44:47 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C9D6CF; Fri, 6 Oct 2023 15:44:46 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 074E7C433C8; Fri, 6 Oct 2023 22:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696632286; bh=TaVUWW2YTgz1B33ifPyvUZYuaUBkl9iBtWnuXF2mdhs=; h=From:To:Cc:Subject:Date:From; b=uRiT5kH4bdp40A3cDGW0oXog1gkh12AvzHEgfdNlavwYU2jRLTDQY0q5xYMi7g6MQ Jg+l16bcw++Efvwke6cJADUqw+Lym4Mt/yYQxzP9slQ/UY++kNy1OLspFRPg0u/NyW NSYAd+SwqD/aBp07cbwMjl6ClfLscYW6x3PPO/1UWyuduRtLYdpnaUDwrjwpJJ0j5n QpjyEg3jD33KsbM80Bd0YKDVGx0gQy9HzYjtieVwKeORANQGx1FVWE7i3dQMiQopUU pOpiOzW5M1w1hxpgQ3iS35GENwGhn8W8k3Ha+2dlvccUzjtyHctE2H9DMxNC5vgGLN 5+E+XLDSBaKeA== Received: (nullmailer pid 442980 invoked by uid 1000); Fri, 06 Oct 2023 22:44:44 -0000 From: Rob Herring To: Jonathan Cameron , Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue Cc: linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: Use device_get_match_data() Date: Fri, 6 Oct 2023 17:44:39 -0500 Message-Id: <20231006224440.442864-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 06 Oct 2023 15:45:03 -0700 (PDT) X-Spam-Level: ** 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/iio/adc/stm32-adc-core.c | 11 +++-------- drivers/iio/adc/twl6030-gpadc.c | 10 ++++------ drivers/iio/dac/stm32-dac-core.c | 9 ++++----- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index c19506b0aac8..616dd729666a 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -17,10 +17,11 @@ #include #include #include -#include +#include #include #include #include +#include #include #include #include @@ -708,8 +709,6 @@ static int stm32_adc_probe(struct platform_device *pdev) struct stm32_adc_priv *priv; struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; - const struct of_device_id *of_id; - struct resource *res; u32 max_rate; int ret; @@ -722,11 +721,7 @@ static int stm32_adc_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, &priv->common); - of_id = of_match_device(dev->driver->of_match_table, dev); - if (!of_id) - return -ENODEV; - - priv->cfg = (const struct stm32_adc_priv_cfg *)of_id->data; + priv->cfg = device_get_match_data(dev); priv->nb_adc_max = priv->cfg->num_adcs; spin_lock_init(&priv->common.lock); diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index 224e9cb5e147..78bf55438b2c 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -16,9 +16,10 @@ */ #include #include +#include #include #include -#include +#include #include #include #include @@ -879,17 +880,14 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct twl6030_gpadc_data *gpadc; const struct twl6030_gpadc_platform_data *pdata; - const struct of_device_id *match; struct iio_dev *indio_dev; int irq; int ret; - match = of_match_device(of_twl6030_match_tbl, dev); - if (!match) + pdata = device_get_match_data(&pdev->dev); + if (!pdata) return -EINVAL; - pdata = match->data; - indio_dev = devm_iio_device_alloc(dev, sizeof(*gpadc)); if (!indio_dev) return -ENOMEM; diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c index 15abe048729e..e150ac729154 100644 --- a/drivers/iio/dac/stm32-dac-core.c +++ b/drivers/iio/dac/stm32-dac-core.c @@ -9,9 +9,12 @@ #include #include +#include #include #include +#include #include +#include #include #include @@ -94,16 +97,12 @@ static int stm32_dac_probe(struct platform_device *pdev) struct reset_control *rst; int ret; - if (!dev->of_node) - return -ENODEV; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; platform_set_drvdata(pdev, &priv->common); - cfg = (const struct stm32_dac_cfg *) - of_match_device(dev->driver->of_match_table, dev)->data; + cfg = device_get_match_data(dev); mmio = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(mmio)) -- 2.40.1