From patchwork Mon Oct 9 17:29:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13414134 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DFC70CD6117 for ; Mon, 9 Oct 2023 17:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ijlNUZXUj090ToexoUbBh0MmYa7XA9QOxHi+Ow0kZb4=; b=nAOlz/NaVf4ISI 9YTW5YV9e8lnYiZki7OufVB6rFaj5b64aXnwXF66q0CwVssXDj6+87HeF6EwbVh92m6RbaJFSOpzV quRWwMJcR8nCRSNfb6OJF3MBPcbHkhodyvJbIMyU7unKM8+Yq9Gk12k+rwwdJsR1QlfIHmJYVxUcK n+fGPAcDjx8UwMMdHrrYQGryKkiGWiXKJMEqk1pApFqMr5tNg2DIg/kg2ncej/2AH5omZ08w3KjAY QDU+luHldkITe3YtuCuri5llZsUTUiGHL9uhkFHhI1xKrEkWOv4XGts72qKAYmzyx6Y1xU7eOYweM SKXP5MPNZ4uCD3Bqrl4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpu7K-00BIkb-1t; Mon, 09 Oct 2023 17:32:30 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpu7H-00BIji-0C for linux-arm-kernel@lists.infradead.org; Mon, 09 Oct 2023 17:32:30 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6D0A4CE180B; Mon, 9 Oct 2023 17:32:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97CF4C433C8; Mon, 9 Oct 2023 17:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696872744; bh=TJcaLAvlDM/rrjbQA5dPMPlECokIUSf7lD2UtWsTWBc=; h=From:To:Cc:Subject:Date:From; b=Z40JeD4ruBmtp+Dr0QAYPc1+X2CJDGfSG9nksOlkJmRghxJQpJ1zWHgtWndh6zvsp BnnZD60Gjwcuh5d0deXFyL4x+SC2Pr0p97i6Fhg9IDSsEYXtSFlJ9Lpi/AXeucRcYg FcYUgPxHIQuXB7k4w31EKLfwRhNdiHf7CEACnajmZAmB8Gk29w8f3o+DuIgwJ/mJ8T EpXOTWKl6uuOw8UO5r60zrMWy0BUEPEovnOOciXQGgFZ61166vfPlI7bAXLFmGf6kH JtrWcoThx3kR5fRpUr4J3L/celDzBQKxEkRvqa5wl+q6yd0Gx6kC5IaWnFGVd7la+I daYg5AP96EkFA== Received: (nullmailer pid 2524703 invoked by uid 1000); Mon, 09 Oct 2023 17:32:22 -0000 From: Rob Herring To: Srinivas Kandagatla , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Maxime Coquelin , Alexandre Torgue Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH] nvmem: Use device_get_match_data() Date: Mon, 9 Oct 2023 12:29:07 -0500 Message-ID: <20231009172923.2457844-12-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231009_103227_277030_ED0C5242 X-CRM114-Status: GOOD ( 13.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/nvmem/mxs-ocotp.c | 10 ++++------ drivers/nvmem/stm32-romem.c | 7 ++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c index 588ab56d75b7..7b78f18f9545 100644 --- a/drivers/nvmem/mxs-ocotp.c +++ b/drivers/nvmem/mxs-ocotp.c @@ -13,8 +13,9 @@ #include #include #include -#include +#include #include +#include #include #include @@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; const struct mxs_data *data; struct mxs_ocotp *otp; - const struct of_device_id *match; int ret; - match = of_match_device(dev->driver->of_match_table, dev); - if (!match || !match->data) + data = device_get_match_data(dev); + if (!data) return -EINVAL; otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); @@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platform_device *pdev) if (ret) return ret; - data = match->data; - ocotp_config.size = data->size; ocotp_config.priv = otp; ocotp_config.dev = dev; diff --git a/drivers/nvmem/stm32-romem.c b/drivers/nvmem/stm32-romem.c index 1541c20709d2..8a553b1799a8 100644 --- a/drivers/nvmem/stm32-romem.c +++ b/drivers/nvmem/stm32-romem.c @@ -10,7 +10,9 @@ #include #include #include -#include +#include +#include +#include #include #include "stm32-bsec-optee-ta.h" @@ -211,8 +213,7 @@ static int stm32_romem_probe(struct platform_device *pdev) priv->lower = 0; - cfg = (const struct stm32_romem_cfg *) - of_match_device(dev->driver->of_match_table, dev)->data; + cfg = device_get_match_data(dev); if (!cfg) { priv->cfg.read_only = true; priv->cfg.size = resource_size(res);