Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3871793rwe; Mon, 29 Aug 2022 23:28:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7oKeoMrrNfeJouAacZqBEAt+nFDBQbfZJGf3aQeCMqnyo9rdUJ0eKxKZ2tgvc40x6XOHZa X-Received: by 2002:a17:907:6095:b0:731:87a0:b9e8 with SMTP id ht21-20020a170907609500b0073187a0b9e8mr16318517ejc.124.1661840927597; Mon, 29 Aug 2022 23:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661840927; cv=none; d=google.com; s=arc-20160816; b=y0Bh3x75sq2aWINO5T8miX7rj3tguoj1aJ6IRkK+cBltxqsAyL9eLTlSRrEM1zD2ak S7pPbRk1BviOvRPN0uYfa3XT4/O4cyvxYESkogfX/5d8atIqPPppa7h7HqT789Zei5RZ ALWAyBj+UQ0PePbJ25tBqibloosii4WOKCK1wCR7b3vklOqHBZqWm+QA0JQfjVpk9lSd 9s6K8HkEAL4rltgjPcPD4BsEZNgXA1vcgdzyxm4yqWr/BJq9Xu+1hFY2tliP4TMYoWOd FTpfOqoPSmHgdVpjGsVfSfXup7xuOHKB3YkhZJKgQyyf4rWjnB0yHJlOsWNNg+AmbW7J Sh7g== 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=EMgBJA0L9lD2NMmMVd3UJd4Knk+3wLpjA8Jxea99O3Iu9Uop/JzmCI07KlpeOCMJpz 0Bs9yNDNeV3Pq7N3dhGFwKBxJhmkRe6kXgjOGxZFUoDD6aU2StoaNf/+iiY7cVIyQoMd tCRnfIlq2ixg8Zykq7UAy06TYSiHPLU4/B11gNPHeDmpwuc/8R41kN47aAu5Q6PAJo72 7lct8xbaUwC5hBilN3kzRc+qy6o1n1AWHNjQQWkRQGVFhdrZoYlmGpqlKBlVjBZcpeiJ zgN41igkanelutlH7iTRL9RbvI5Dy/gjmwEU5R5rutY71em2aR7FqAJqs7nQBWSKOnM3 VVZg== 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 k5-20020a17090666c500b00722fcbbb636si7256710ejp.138.2022.08.29.23.28.21; Mon, 29 Aug 2022 23:28:47 -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 S230145AbiH3G0J (ORCPT + 99 others); Tue, 30 Aug 2022 02:26:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiH3GZe (ORCPT ); Tue, 30 Aug 2022 02:25:34 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA49C53012; Mon, 29 Aug 2022 23:25:32 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MGy0m5g42znTr4; Tue, 30 Aug 2022 14:23:04 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 30 Aug 2022 14:25:30 +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, 30 Aug 2022 14:25:29 +0800 From: Jie Hai To: , CC: , Subject: [RESEND PATCH v5 4/7] dmaengine: hisilicon: Use macros instead of magic number Date: Tue, 30 Aug 2022 14:22:48 +0800 Message-ID: <20220830062251.52993-5-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220830062251.52993-1-haijie1@huawei.com> References: <20220830062251.52993-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: dggems702-chm.china.huawei.com (10.3.19.179) 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,T_SCC_BODY_TEXT_LINE 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