From patchwork Fri Oct 6 21:38:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 149413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp608593vqo; Fri, 6 Oct 2023 14:39:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELgOCVwfbQArsUnZyG8NBP4muvMlRJfFeAUOmG4iUMfxlXQdd1IzAp7S15y0aWL/GJxWFl X-Received: by 2002:a17:902:c24d:b0:1bf:712:e4bd with SMTP id 13-20020a170902c24d00b001bf0712e4bdmr9119578plg.65.1696628365665; Fri, 06 Oct 2023 14:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696628365; cv=none; d=google.com; s=arc-20160816; b=R51km+8vZLK1i/YtVGn16dFb7m4iJCv4mOlQqVK04qWApfQPWc/hrEhU5D5zpGTVXW bL9mJK/nCdgYYKDCXYTI8NbmgK//7jKgVfVQMizSpLXC0pmjasMellvJjlgWLCyE2hg4 GBrX1RiP168YS98uEiaMLNrBFy55xrBsdHEFReXoZ22oI7sDbhr5R7f+CckaVipwbWBb E7P5qPiVBA3jd3GCAHkvQvS6v1tTfZcgp61AXFhKzdd3fOU4jl68ktjWQkpPme6P2tUv k//jtN9mUtBFvUDnUK6FAsmMRoPlvikoWBlpQjq+ISqEoO8DNIcyCuVMoWF1w1Gu6D5J 2G9Q== 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=f9kGUKGi8+RXn93UTzro+sgE3UZ2FrtK/py5I7zxUfc=; fh=TXwstXHkjIJSy4FpGoWt+sbIrthhmiy4uCsHbTpt6s0=; b=xdAmCgPsjDqJUaS//wnZ0Sub00ntiLaaFCwWfYUffOBgaD+PY6sL03VCDunAa0aJeN ezTNA+xwKpKq6Y9Mep4L9IxxHcol9CXauudpAOzdXaV1uKRXHYOAscqPzuBeCAG43f20 7oYtnYNGmMj8is1BHLDrUwpM+y7S9d8QozhBa7J15ztmvCLsm6+RqQK0FweuvBRBh0y1 To4eozMAx++2sp5ev1mGLuicAuuA+wH5QusroXRLvkX1Nfbwqm57YuJkyna9ASjiMhQE onQzJck5egKgZflUWcpW1C5JXgyVGm0zTTYBxlTkYwNRKX52OgV0D/hzXpjNGjdEVUfC ozfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uRGXMqrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k4-20020a170902d58400b001c73d73f163si4406662plh.505.2023.10.06.14.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 14:39:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uRGXMqrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id CD8D780440FC; Fri, 6 Oct 2023 14:39:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233651AbjJFVi4 (ORCPT + 18 others); Fri, 6 Oct 2023 17:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233277AbjJFViv (ORCPT ); Fri, 6 Oct 2023 17:38:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86605BD; Fri, 6 Oct 2023 14:38:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BA44C433C7; Fri, 6 Oct 2023 21:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696628330; bh=iArrLU+Z+tOWUtxgddvqoQCmYNdeqno+QP+vyryCqYs=; h=From:To:Cc:Subject:Date:From; b=uRGXMqrYu6XQj1f/L6XAiYU4O5gJ/Zt4o5paEhdll4QZdw9HA/gcBceCOBadQOTvq arfZOE1TOwGeEyGT0OD7EiVYVsHbdRW2bu0HX+efC7cR6oJqxxb7Fe1gjMC/aao/Kv OrbDuOYtLuoI6yjQjEkyHhzT27fWNwiyoHoeWklnIyoMxT03NBTwVgMStLSRW/BmDH gEmxSvERb0c5nqaxp7+d4vfqdf11G43doA5WqpICU75QBe7vk7YZyO1Y8Y4sx+wunb relDMSBD7D9m0QBoHf3d/UsuJkKExkSuXyZhtB2m1ToVfvn9sgxKAOBjTwTkPNZALy 3mQ4EEvFLl3Qg== Received: (nullmailer pid 333149 invoked by uid 1000); Fri, 06 Oct 2023 21:38:48 -0000 From: Rob Herring To: Vinod Koul , Patrice Chotard Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] dmaengine: Use device_get_match_data() Date: Fri, 6 Oct 2023 16:38:43 -0500 Message-Id: <20231006213844.333027-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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 06 Oct 2023 14:39:22 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779043784785495061 X-GMAIL-MSGID: 1779043784785495061 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/dma/fsl-edma-main.c | 9 ++------- drivers/dma/mmp_tdma.c | 29 +++++++---------------------- drivers/dma/mv_xor.c | 11 +++-------- drivers/dma/st_fdma.c | 12 +++--------- 4 files changed, 15 insertions(+), 46 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 5f8b71eb029c..e122ebb7c018 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -13,13 +13,11 @@ #include #include #include -#include -#include -#include #include #include #include #include +#include #include "fsl-edma-common.h" @@ -416,8 +414,6 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng static int fsl_edma_probe(struct platform_device *pdev) { - const struct of_device_id *of_id = - of_match_device(fsl_edma_dt_ids, &pdev->dev); struct device_node *np = pdev->dev.of_node; struct fsl_edma_engine *fsl_edma; const struct fsl_edma_drvdata *drvdata = NULL; @@ -426,8 +422,7 @@ static int fsl_edma_probe(struct platform_device *pdev) int chans; int ret, i; - if (of_id) - drvdata = of_id->data; + drvdata = device_get_match_data(&pdev->dev); if (!drvdata) { dev_err(&pdev->dev, "unable to find driver data\n"); return -EINVAL; diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index f039e07181f7..b76fe99e1151 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -14,9 +14,9 @@ #include #include #include +#include #include #include -#include #include #include "dmaengine.h" @@ -635,18 +635,13 @@ MODULE_DEVICE_TABLE(of, mmp_tdma_dt_ids); static int mmp_tdma_probe(struct platform_device *pdev) { enum mmp_tdma_type type; - const struct of_device_id *of_id; struct mmp_tdma_device *tdev; int i, ret; int irq = 0, irq_num = 0; int chan_num = TDMA_CHANNEL_NUM; struct gen_pool *pool = NULL; - of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); - if (of_id) - type = (enum mmp_tdma_type) of_id->data; - else - type = platform_get_device_id(pdev)->driver_data; + type = (enum mmp_tdma_type)device_get_match_data(&pdev->dev); /* always have couple channels */ tdev = devm_kzalloc(&pdev->dev, sizeof(*tdev), GFP_KERNEL); @@ -724,32 +719,22 @@ static int mmp_tdma_probe(struct platform_device *pdev) return ret; } - if (pdev->dev.of_node) { - ret = of_dma_controller_register(pdev->dev.of_node, - mmp_tdma_xlate, tdev); - if (ret) { - dev_err(tdev->device.dev, - "failed to register controller\n"); - return ret; - } + ret = of_dma_controller_register(pdev->dev.of_node, + mmp_tdma_xlate, tdev); + if (ret) { + dev_err(tdev->device.dev, "failed to register controller\n"); + return ret; } dev_info(tdev->device.dev, "initialized\n"); return 0; } -static const struct platform_device_id mmp_tdma_id_table[] = { - { "mmp-adma", MMP_AUD_TDMA }, - { "pxa910-squ", PXA910_SQU }, - { }, -}; - static struct platform_driver mmp_tdma_driver = { .driver = { .name = "mmp-tdma", .of_match_table = mmp_tdma_dt_ids, }, - .id_table = mmp_tdma_id_table, .probe = mmp_tdma_probe, .remove_new = mmp_tdma_remove, }; diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 23b232b57518..bcd3b623ac6c 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -1328,13 +1328,8 @@ static int mv_xor_probe(struct platform_device *pdev) * setting up. In non-dt case it can only be the legacy one. */ xordev->xor_type = XOR_ORION; - if (pdev->dev.of_node) { - const struct of_device_id *of_id = - of_match_device(mv_xor_dt_ids, - &pdev->dev); - - xordev->xor_type = (uintptr_t)of_id->data; - } + if (pdev->dev.of_node) + xordev->xor_type = (uintptr_t)device_get_match_data(&pdev->dev); /* * (Re-)program MBUS remapping windows if we are asked to. diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index 145bd0f2496e..8880b5e336f8 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -10,9 +10,10 @@ #include #include -#include +#include #include #include +#include #include #include #include @@ -739,18 +740,11 @@ static void st_fdma_free(struct st_fdma_dev *fdev) static int st_fdma_probe(struct platform_device *pdev) { struct st_fdma_dev *fdev; - const struct of_device_id *match; struct device_node *np = pdev->dev.of_node; const struct st_fdma_driverdata *drvdata; int ret, i; - match = of_match_device((st_fdma_match), &pdev->dev); - if (!match || !match->data) { - dev_err(&pdev->dev, "No device match found\n"); - return -ENODEV; - } - - drvdata = match->data; + drvdata = device_get_match_data(&pdev->dev); fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL); if (!fdev)