Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp350763imn; Mon, 25 Jul 2022 19:00:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1seXow7UZo6WE/pESJ/R56HTjf/qtN45WJmGb1eblJ/IwAKxZwUCIA0SkrazRouBjevPu1b X-Received: by 2002:a05:6a00:1da9:b0:52a:c339:c520 with SMTP id z41-20020a056a001da900b0052ac339c520mr15183544pfw.70.1658800833014; Mon, 25 Jul 2022 19:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658800833; cv=none; d=google.com; s=arc-20160816; b=VlsEODKCX5YC0tukOa9dYz021DwVdfWNvQKkWFJ3WQPUnBwVnNgW3fD+GjLcIPNfL7 eWQh6arDsjBeyXRFL0NgY2eushwccEx5t7sQNC5mO0ygofTr8UzDEud15qWbwIKK7bm5 /18D7DIoD02oSrZFJiZR6HaGo26500RTrBeLXOA6XB+NT2Ww3qyPWO7ihR2FCFGWj2bO MAb/L3bSuI73S8g8Ta5K9PCifnWyq3xgMCrIWoujUOFIGIhTmVxk/h5fiGvKU0wZA3VG gOeL03dNRfQ+7hZw8ctv6ZXVlnuHMu9p995b4ryavjmX7GVSv8L6ZPNPeT/+elv7mSuf y3+w== 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=HHL7XE3RPHW/cX6rlYRVuyx7y2GnfbLwzwmye7Atl3s=; b=kJ469dCFlucq0f64ouXF3IJa5MJz5O77y4CZYPCdRlOsZ499wp+t4ledELGhtSdP5A CgnpvHbuoAEKv8gzAG7m8Ynyx3wxO6o39415XME7SmcrpfuANdDdmZ3P/o7oSD3BJISP /s6YEFwzP2QxTjqsPertN6SyD6nIKt9Ey8HMKjdJ+gFyC3vTsHytUPBPlBzPnp7phvN4 /+S7wamkiYJf8c5X/I3YWfB0gH+m2cMcTSbv1tHi7OPjfxCerYrwJ8tfLXfLv4afbk0B jpCZaMWbz+FBKc+8ZNTzWDZK5RKVOoVornYq83w6H/lwupKWSnyqZ8mDdOpp8mS2D4QQ 0nXg== 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 f12-20020a170902ce8c00b0016aa0ab8fb6si12254986plg.595.2022.07.25.19.00.18; Mon, 25 Jul 2022 19:00:32 -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 S237338AbiGZBiz (ORCPT + 99 others); Mon, 25 Jul 2022 21:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237396AbiGZBiv (ORCPT ); Mon, 25 Jul 2022 21:38:51 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32EA428721; Mon, 25 Jul 2022 18:38:50 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LsKKb2XJkz9sv4; Tue, 26 Jul 2022 09:37:39 +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, 26 Jul 2022 09:38:08 +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, 26 Jul 2022 09:38:08 +0800 From: Jie Hai To: , CC: , , , Subject: [PATCH v3 4/7] dmaengine: hisilicon: Use macros instead of magic number Date: Tue, 26 Jul 2022 09:35:22 +0800 Message-ID: <20220726013525.13059-5-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220726013525.13059-1-haijie1@huawei.com> References: <20220625074422.3479591-1-haijie1@huawei.com> <20220726013525.13059-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 --- 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