From patchwork Fri Oct 6 22:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 149440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp634732vqo; Fri, 6 Oct 2023 15:44:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6icf92IRVmHB4wwUxCpnEoNlgu20SPgs/ccGIZQt7FBJ4B95oqcCGTxinKoguw/Fs5XL7 X-Received: by 2002:a05:6a20:9146:b0:15e:dc75:66af with SMTP id x6-20020a056a20914600b0015edc7566afmr10694210pzc.59.1696632279078; Fri, 06 Oct 2023 15:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696632279; cv=none; d=google.com; s=arc-20160816; b=Nh2EFC/oiNISOe1fYsh6n98LH1GuOULOAYdQzvo/ji/b3CiTv7pIAo+PMeFglL9uac jo/bL8H58y6qVziptf51ptvEJC+kXuchOIf9tyqTPXXngTZTXFSdIeCtNtVhZi6pgZ4m yg1RBmfzLRUEFYOrDKCUd3E0eQnJgzdFRMUiILdWyaJcougL4jXEcCzvTD2VYgPYESaq HoJZtRcfiJ5jGRU+NxUvaTmF+kHxDBCY5YYXlkbqraS68/rwyg5/g2fQ5QAI5Nc3hc24 42RTOxeufXHByAnQvb8CuqfYiOme4X9qffaveYsroEl2a6gzZUXO5ItnXipuWXRtm3mW lbBQ== 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=+1Y2S/PomOz2GJcFOK8GyUkJ2mfvjYG3ljv8xw7L28c=; fh=0YwAOEEe0rbaoCPPtJ1HDh7n9PLUZpzT9Z7sMkSvz+g=; b=i5ali/9SKjXMg842M6741hjjFh6A9Atk8zu9wuAbxTMPWKgGcY1nseshIVDnND0M6L yFwn0+bLOl73SYvJ07P26LyNEmNa2nj9VicZX7e+zakD3sjlj+UzPfg9nYhOsU6RNBz+ n9y3ih51duV9z/4QhoWiLtidgas9ORC68fGGESK3xZsDTbuK7buI8nlJjElK5+tOa9kN A/H/rUqMu068XtrNmqzntXpQLqSiNDajMRbaHDhTRq9dadNWpLzFlEpwbDv2tXvMNvYX KT2yw7uL7Pce6wXpz5HK4z+mCp8duRK7iKN9kYvlIpmdkyYo7qHWKtjvo1H6OzSd3saW rUzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L1shalJm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k66-20020a636f45000000b00588fa0def2bsi2616476pgc.768.2023.10.06.15.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 15:44:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L1shalJm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id B05CF836525A; Fri, 6 Oct 2023 15:44:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233522AbjJFWoJ (ORCPT + 18 others); Fri, 6 Oct 2023 18:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233726AbjJFWoH (ORCPT ); Fri, 6 Oct 2023 18:44:07 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9C3A2 for ; Fri, 6 Oct 2023 15:44:06 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840CEC433C8; Fri, 6 Oct 2023 22:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696632246; bh=dnirAMJtell24Xii/tGE5TPebFmYLUGZvNx2LSkG0CE=; h=From:To:Cc:Subject:Date:From; b=L1shalJmrPTSFqzG8WwKnc2FFJ5EbudW62Hyu9km14/lsK/LDkhVfPgd/iObyRi7C pcxIGgNp4xeJyeSC4SWg6Ii94FsPueKK5AStZqHXan4NuMWU3IOJFroY0kM9RpvLnL +VrYLSJskkPXsGq2HBEBvRkba9nRwWoCA5AAU3RKwhGzMTwWzWqk8UM+aruNjSO5zA hLV1orJTpKHq+IDn8DpZBSnZvb50hDG54NFnTgYMdvmkemMyk2f5bLmp42/WvZvzP8 mW+G1oeZX6yK8QTNOPOspnLBuYNvbWx8E0H816749AwlJKTveATWaWqsKKQ46YINj5 lr39oKS6BPTyw== Received: (nullmailer pid 442177 invoked by uid 1000); Fri, 06 Oct 2023 22:44:04 -0000 From: Rob Herring To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Florian Fainelli , Broadcom internal kernel review list Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] memory: Use device_get_match_data() Date: Fri, 6 Oct 2023 17:44:01 -0500 Message-Id: <20231006224402.442078-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 06 Oct 2023 15:44:35 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779047888813749463 X-GMAIL-MSGID: 1779047888813749463 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 Reviewed-by: Florian Fainelli --- drivers/memory/atmel-ebi.c | 14 +++++++------- drivers/memory/brcmstb_memc.c | 9 +++------ drivers/memory/fsl-corenet-cf.c | 11 ++--------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index ec6100bc94c5..e8bb5f37f5cb 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -12,7 +12,10 @@ #include #include #include -#include +#include +#include +#include +#include #include #include @@ -515,16 +518,11 @@ static int atmel_ebi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *child, *np = dev->of_node, *smc_np; - const struct of_device_id *match; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; u32 val; - match = of_match_device(atmel_ebi_id_table, dev); - if (!match || !match->data) - return -EINVAL; - ebi = devm_kzalloc(dev, sizeof(*ebi), GFP_KERNEL); if (!ebi) return -ENOMEM; @@ -532,7 +530,9 @@ static int atmel_ebi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ebi); INIT_LIST_HEAD(&ebi->devs); - ebi->caps = match->data; + ebi->caps = device_get_match_data(dev); + if (!ebi->caps) + return -EINVAL; ebi->dev = dev; clk = devm_clk_get(dev, NULL); diff --git a/drivers/memory/brcmstb_memc.c b/drivers/memory/brcmstb_memc.c index 233a53f5bce1..a6ea51996522 100644 --- a/drivers/memory/brcmstb_memc.c +++ b/drivers/memory/brcmstb_memc.c @@ -8,8 +8,9 @@ #include #include #include -#include +#include #include +#include #define REG_MEMC_CNTRLR_CONFIG 0x00 #define CNTRLR_CONFIG_LPDDR4_SHIFT 5 @@ -121,12 +122,9 @@ static struct attribute_group dev_attr_group = { .attrs = dev_attrs, }; -static const struct of_device_id brcmstb_memc_of_match[]; - static int brcmstb_memc_probe(struct platform_device *pdev) { const struct brcmstb_memc_data *memc_data; - const struct of_device_id *of_id; struct device *dev = &pdev->dev; struct brcmstb_memc *memc; int ret; @@ -137,8 +135,7 @@ static int brcmstb_memc_probe(struct platform_device *pdev) dev_set_drvdata(dev, memc); - of_id = of_match_device(brcmstb_memc_of_match, dev); - memc_data = of_id->data; + memc_data = device_get_match_data(dev); memc->srpd_offset = memc_data->srpd_offset; memc->ddr_ctrl = devm_platform_ioremap_resource(pdev, 0); diff --git a/drivers/memory/fsl-corenet-cf.c b/drivers/memory/fsl-corenet-cf.c index 7fc9f57ae278..8096c4f33303 100644 --- a/drivers/memory/fsl-corenet-cf.c +++ b/drivers/memory/fsl-corenet-cf.c @@ -10,10 +10,8 @@ #include #include #include -#include -#include -#include #include +#include enum ccf_version { CCF1, @@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id) static int ccf_probe(struct platform_device *pdev) { struct ccf_private *ccf; - const struct of_device_id *match; u32 errinten; int ret, irq; - match = of_match_device(ccf_matches, &pdev->dev); - if (WARN_ON(!match)) - return -ENODEV; - ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL); if (!ccf) return -ENOMEM; @@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev) return PTR_ERR(ccf->regs); ccf->dev = &pdev->dev; - ccf->info = match->data; + ccf->info = device_get_match_data(&pdev->dev); ccf->err_regs = ccf->regs + ccf->info->err_reg_offs; if (ccf->info->has_brr) {