From patchwork Fri Oct 6 21:38:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 149411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp608419vqo; Fri, 6 Oct 2023 14:39:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeffKgi01Oa540JOwyeSeqYnY3Hzf0EXxQryzzKvrrjv3798Ywo2gANNl3K7hm6GjvOYTk X-Received: by 2002:a92:c24a:0:b0:34f:6dbb:6a2a with SMTP id k10-20020a92c24a000000b0034f6dbb6a2amr11288735ilo.7.1696628343243; Fri, 06 Oct 2023 14:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696628343; cv=none; d=google.com; s=arc-20160816; b=HLibnP3e01Ot/MgIGbKBWUx96eL2YzzrLbxnLjf9TgAitqRWwm7N5I7YsyKvlbe5Uj q7icVcKbBEf/8ZwWMniwWo3dHTP6mjArBUYq28vsG3WxX2nXSYj+GvEC0wpjv4jyuq9m toT9iXGu0B1O6I/PDwtYIWShfdpM0oCjrxD73X8zZxuM+mQRiqrJ5mpkqsicPlg7mCHw bENUowv08bX71DfIpea5w+vqvJCUbsqIMr0UH+Rnz8zQrMPx+52Le9mYeYXqvBkk72PQ RD6YQDcYK5vMvLCRHzc9XWsZrlGjIyMGEaceXSeJbCzTte/DDsjLKdJO8AVviWQcNCAO hshg== 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=LSj74u87D7PxAJCIcGETKYRcKoQwDSXZdRbc8KP0yQk=; fh=tXsWQuoZHz8eYnrP7c+q2+gj0elviQW+MaDjd2jgJfo=; b=F1X6TvB+YRfQ7I4u2f6+XDqcjbF7ohLfGVWXHmkViFSkhW4dM/z4iBR1dNc0QA2m4n EQHXkIwjuTP+1mp5IFjukEqDhjp3pWHhqqwI4VBoPz5ggrFoo6lGfmMILw9rCdWOXnoq 5xzzmLh6W06ggWJ3K5Z3kXKvXWN8vtBQ7sNKiFqrfcAbsRCuEk7/xL4iG5syabwyCoTJ GRr+KIpYhoFkUyUwFN/pvsasgerynm6GiTrSQUDp1F5xKfhi+MdDqUcCX+00BWB74ccn Bd9QTBfUdPUDJ/e1Ls+X7r9ZC0SUVthESrzzhGx6Ifpwmhh/Ne6gZdU6AxS3dJZbMX7l Jm2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mdA3EliY; 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 q24-20020a63d618000000b00577f50580bbsi4351454pgg.299.2023.10.06.14.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 14:39:03 -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=mdA3EliY; 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 9729B80440FC; Fri, 6 Oct 2023 14:39:00 -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 S233542AbjJFVip (ORCPT + 18 others); Fri, 6 Oct 2023 17:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233277AbjJFVip (ORCPT ); Fri, 6 Oct 2023 17:38:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0BBCBD; Fri, 6 Oct 2023 14:38:43 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CC90C433C7; Fri, 6 Oct 2023 21:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696628323; bh=mtOK85aeQi5zxtQ5qxl21dr+kSNJG6tsBGqhON2xals=; h=From:To:Cc:Subject:Date:From; b=mdA3EliYhLBRpICdZsSU/iSXwksjuJCbPBVnMmVEXFlTNPi4yUhxf5ukz9QIMWj5W B2iCefR1QD8PN2ISKt18ovC8btGFvYO4HSXQhvNJagWYw+oI5iwUa6HROCmKqznthQ +dqEN11aHAySxDS7qK5Yk7YUIx+GMCAogv9FoTsJysUo8dSfshzP4Gn0dEv4OkjpSr /eeNZ1JrfFMt2AoYaw6+XsIpWrgFob+Cc8snCZaV25CNCUraZagwFw28wEBcmC8OFK g362ICGYQbYa1Z/hjCDITCmz2lXa9m/RCck7Pios36Fbw1WwljU8whA5WHZrTEsfex E1/8Qk4EMB2RQ== Received: (nullmailer pid 332965 invoked by uid 1000); Fri, 06 Oct 2023 21:38:40 -0000 From: Rob Herring To: Vinod Koul , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Maxime Coquelin , Alexandre Torgue Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH] dmaengine: Drop unnecessary of_match_device() calls Date: Fri, 6 Oct 2023 16:38:35 -0500 Message-Id: <20231006213835.332848-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:00 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779043761380189473 X-GMAIL-MSGID: 1779043761380189473 If probe is reached, we've already matched the device and in the case of DT matching, the struct device_node pointer will be set. Therefore, there is no need to call of_match_device() in probe. Signed-off-by: Rob Herring --- drivers/dma/k3dma.c | 25 ++++++++++--------------- drivers/dma/mmp_pdma.c | 5 +---- drivers/dma/pxa_dma.c | 7 ++----- drivers/dma/stm32-dma.c | 8 -------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 22b37b525a48..5de8c21d41e7 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -839,7 +838,6 @@ static int k3_dma_probe(struct platform_device *op) { const struct k3dma_soc_data *soc_data; struct k3_dma_dev *d; - const struct of_device_id *of_id; int i, ret, irq = 0; d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL); @@ -854,19 +852,16 @@ static int k3_dma_probe(struct platform_device *op) if (IS_ERR(d->base)) return PTR_ERR(d->base); - of_id = of_match_device(k3_pdma_dt_ids, &op->dev); - if (of_id) { - of_property_read_u32((&op->dev)->of_node, - "dma-channels", &d->dma_channels); - of_property_read_u32((&op->dev)->of_node, - "dma-requests", &d->dma_requests); - ret = of_property_read_u32((&op->dev)->of_node, - "dma-channel-mask", &d->dma_channel_mask); - if (ret) { - dev_warn(&op->dev, - "dma-channel-mask doesn't exist, considering all as available.\n"); - d->dma_channel_mask = (u32)~0UL; - } + of_property_read_u32((&op->dev)->of_node, + "dma-channels", &d->dma_channels); + of_property_read_u32((&op->dev)->of_node, + "dma-requests", &d->dma_requests); + ret = of_property_read_u32((&op->dev)->of_node, + "dma-channel-mask", &d->dma_channel_mask); + if (ret) { + dev_warn(&op->dev, + "dma-channel-mask doesn't exist, considering all as available.\n"); + d->dma_channel_mask = (u32)~0UL; } if (!(soc_data->flags & K3_FLAG_NOCLK)) { diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 492ec491a59b..136fcaeff8dd 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -1019,7 +1018,6 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec, static int mmp_pdma_probe(struct platform_device *op) { struct mmp_pdma_device *pdev; - const struct of_device_id *of_id; struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev); int i, ret, irq = 0; int dma_channels = 0, irq_num = 0; @@ -1039,8 +1037,7 @@ static int mmp_pdma_probe(struct platform_device *op) if (IS_ERR(pdev->base)) return PTR_ERR(pdev->base); - of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev); - if (of_id) { + if (pdev->dev->of_node) { /* Parse new and deprecated dma-channels properties */ if (of_property_read_u32(pdev->dev->of_node, "dma-channels", &dma_channels)) diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 3c574dc0613b..e260cadfc46f 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -15,9 +15,8 @@ #include #include #include -#include -#include #include +#include #include #include @@ -1342,7 +1341,6 @@ static int pxad_init_dmadev(struct platform_device *op, static int pxad_probe(struct platform_device *op) { struct pxad_device *pdev; - const struct of_device_id *of_id; const struct dma_slave_map *slave_map = NULL; struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev); int ret, dma_channels = 0, nb_requestors = 0, slave_map_cnt = 0; @@ -1360,8 +1358,7 @@ static int pxad_probe(struct platform_device *op) if (IS_ERR(pdev->base)) return PTR_ERR(pdev->base); - of_id = of_match_device(pxad_dt_ids, &op->dev); - if (of_id) { + if (op->dev.of_node) { /* Parse new and deprecated dma-channels properties */ if (of_property_read_u32(op->dev.of_node, "dma-channels", &dma_channels)) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index a732b3807b11..c8089e77c950 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -1561,17 +1560,10 @@ static int stm32_dma_probe(struct platform_device *pdev) struct stm32_dma_chan *chan; struct stm32_dma_device *dmadev; struct dma_device *dd; - const struct of_device_id *match; struct resource *res; struct reset_control *rst; int i, ret; - match = of_match_device(stm32_dma_of_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "Error: No device match found\n"); - return -ENODEV; - } - dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev), GFP_KERNEL); if (!dmadev) return -ENOMEM;