Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2449954imn; Tue, 2 Aug 2022 03:20:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5jojVrK501f4f+kDuW3E7R0mwRziLj7QDLLAaLjBdFuNuvEqFAZTii462bSM4A9KZ4P9xh X-Received: by 2002:a63:90c1:0:b0:41b:d351:f338 with SMTP id a184-20020a6390c1000000b0041bd351f338mr10962601pge.228.1659435649683; Tue, 02 Aug 2022 03:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659435649; cv=none; d=google.com; s=arc-20160816; b=Ap9k0KLCDcB5n4DaKdiIG3lJdlNdK2gRvJJIiJrQwKJQCgmnHcnycKe+u+bO6nN9nq Per4zq4NANY2ypDMQ0w/HgqvojdRqTJYpUQOxFZ2DjgeNYxRfXZXoPU+3DJpny6YkpHP b+YPzpf0O6bS14L6OtRdRhJ3rKtsmnozle5HImn9JUcdN0zhkY93CrtU+XyWgAJTBfXL fWmPyJrXs84I6vR8F+LJ4Py0Yeb+aQFjv8Acu79Ck28FVSzSjutOuqyrtRvR2pzQEg0I rmbioyQAqop5qnh9Kkmxy51e3DoVHgx17NS/D8AQSyDkdB3DtatFLRuOxATZUhmzLf98 PbMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nXGpqdGPGyCYVuQ+B43jdqoicYYEyOnXKAphx96uUCk=; b=e6YXep07ZexYXVM8px/nuoCQIZ17V3ZZYYYtyNEAvrwNjz/97Lz9V3+v3q64spPhEI 6ucv+/xVyRravEmjTknoPR06gSg6fiLRrW8am4FVLvKr8SiZWSlaxUSa/kYa+W3SSOoO ytn+zhDqRFmU2/T2OamlKr/JTi0BTZo7CS9E3BPryKNMYZ1ZQ3hjmtsrOrh5VY9QF1oF AYs+1HPhJtd/JE1b8wSVNyZQ4hkZp28H79MbBmIdXN98OSOTFvtXthF4rskLf0ixcro6 pUeY8uLPONm2VgcnKdI00eSp9YwheWS/lgHMZl7/6FSata8rSdagIGltZDik+U78+Ger bOiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a634e07000000b00419b2729e7csi624415pgb.27.2022.08.02.03.20.35; Tue, 02 Aug 2022 03:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236568AbiHBKP6 (ORCPT + 99 others); Tue, 2 Aug 2022 06:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236567AbiHBKPe (ORCPT ); Tue, 2 Aug 2022 06:15:34 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F1E21E36; Tue, 2 Aug 2022 03:15:33 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LxrQQ3v2Wz1M8JS; Tue, 2 Aug 2022 18:12:30 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 2 Aug 2022 18:15:31 +0800 Received: from localhost.localdomain (10.69.192.56) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 2 Aug 2022 18:15:28 +0800 From: Jie Hai To: , CC: , , , Subject: [PATCH v4 4/7] dmaengine: hisilicon: Use macros instead of magic number Date: Tue, 2 Aug 2022 18:12:23 +0800 Message-ID: <20220802101226.9005-5-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220802101226.9005-1-haijie1@huawei.com> References: <20220625074422.3479591-1-haijie1@huawei.com> <20220802101226.9005-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org readl_relaxed_poll_timeout() uses magic numbers 10 and 1000, which indicate maximum time to sleep between reads in us and timeout in us, respectively. Use macros HISI_DMA_POLL_Q_STS_DELAY_US and HISI_DMA_POLL_Q_STS_TIME_OUT_US instead of these two numbers. Signed-off-by: Jie Hai Acked-by: Zhou Wang --- drivers/dma/hisi_dma.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 0233b42143c7..5d62fe62ba00 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -36,6 +36,9 @@ #define PCI_BAR_2 2 +#define HISI_DMA_POLL_Q_STS_DELAY_US 10 +#define HISI_DMA_POLL_Q_STS_TIME_OUT_US 1000 + enum hisi_dma_mode { EP = 0, RC, @@ -185,15 +188,19 @@ static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan, { struct hisi_dma_dev *hdma_dev = chan->hdma_dev; u32 index = chan->qp_num, tmp; + void __iomem *addr; int ret; hisi_dma_pause_dma(hdma_dev, index, true); hisi_dma_enable_dma(hdma_dev, index, false); hisi_dma_mask_irq(hdma_dev, index); - ret = readl_relaxed_poll_timeout(hdma_dev->base + - HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp, - FIELD_GET(HISI_DMA_FSM_STS_MASK, tmp) != RUN, 10, 1000); + addr = hdma_dev->base + + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET; + + ret = readl_relaxed_poll_timeout(addr, tmp, + FIELD_GET(HISI_DMA_FSM_STS_MASK, tmp) != RUN, + HISI_DMA_POLL_Q_STS_DELAY_US, HISI_DMA_POLL_Q_STS_TIME_OUT_US); if (ret) { dev_err(&hdma_dev->pdev->dev, "disable channel timeout!\n"); WARN_ON(1); @@ -208,9 +215,9 @@ static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan, hisi_dma_unmask_irq(hdma_dev, index); } - ret = readl_relaxed_poll_timeout(hdma_dev->base + - HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp, - FIELD_GET(HISI_DMA_FSM_STS_MASK, tmp) == IDLE, 10, 1000); + ret = readl_relaxed_poll_timeout(addr, tmp, + FIELD_GET(HISI_DMA_FSM_STS_MASK, tmp) == IDLE, + HISI_DMA_POLL_Q_STS_DELAY_US, HISI_DMA_POLL_Q_STS_TIME_OUT_US); if (ret) { dev_err(&hdma_dev->pdev->dev, "reset channel timeout!\n"); WARN_ON(1); -- 2.33.0