Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1108051iog; Sat, 25 Jun 2022 00:46:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6G0Lvje4J/Y4tkVzkZL4ehsb3jne4oi2WwZVNIllOo3oNevHK3hMxfKpjP45i4Zdii1e2 X-Received: by 2002:a63:d751:0:b0:401:9f40:3fcb with SMTP id w17-20020a63d751000000b004019f403fcbmr2566044pgi.311.1656143207494; Sat, 25 Jun 2022 00:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656143207; cv=none; d=google.com; s=arc-20160816; b=dyIC9Mte9SAjbn6/NgbYbilJ8vnRKDmZ2eRWTp6u38vwFiL3J1bCAmaQogdtW4FtVk WcNjHyhO9MWBG9OGTJAzZahtKoVw42LlmfhS+cN0gXcqtaRlnV67bQRY+vfeVjaMBi+R MN5y4xcYnqfNur9HcHBO3/v/NeV267+fHdrX54GdusgwWxxv3aOTxRnS44+ryMq8V5Ou 1bmAdRQVwqTXZ5ZcLXheNRLv/D91pqV5V8zuxZtCaRiLRXyJGJTaui21bt8tGL/OkQek ddns8nyBxyWsMcPvyMU893sjO5pUHWcr+MztYSx4ncvWiYvbRVW4CGgnlgF8o+M4BUZw Ky9Q== 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=Vfg6Zh4ffj7PNzqi5aq/KCgfkYS+j2hvufb9zi6HTr8=; b=ka1BCIFfEHH4LEHuZlmuuggLGrKDYhoBY4FDBpzv3wIrzYWsD4GyuueqxrfsFWOmWM xnETQ4oNmXsdyuDHdnJk2G02Nikhvmh7IfFbZByBfYfUmIkF3ELDc0SIKLOH9vQpAsqR HUSmEmqWRZ5vIwQIazLlOQuMH6tBL9VF6J2apOlVK5Vwh3xNn2vqclv/VGakN1zUFfdf q7V/1FX+hsZWLj9WDIRligEF3txcIBBoQfs9fXBkOOlWtZnlqu//go6S74fK90YKFmdJ o96NsOeHbqBLZJPr1hvhR3fvfmdh7q8cPjH0E9P9x9eNsyxjyzSyvi9Vo2eQi44OEn1w f5tw== 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 f1-20020a63de01000000b0040d4ea0274fsi5532326pgg.697.2022.06.25.00.46.35; Sat, 25 Jun 2022 00:46: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 S232294AbiFYHpU (ORCPT + 99 others); Sat, 25 Jun 2022 03:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232120AbiFYHo5 (ORCPT ); Sat, 25 Jun 2022 03:44:57 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AFA3473BD; Sat, 25 Jun 2022 00:44:54 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LVQwt5SqzzDsS8; Sat, 25 Jun 2022 15:44:14 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 25 Jun 2022 15:44:51 +0800 Received: from localhost.localdomain (10.67.165.2) 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; Sat, 25 Jun 2022 15:44:50 +0800 From: Jie Hai To: , CC: , Subject: [PATCH 4/8] dmaengine: hisilicon: Use macros instead of magic number Date: Sat, 25 Jun 2022 15:44:18 +0800 Message-ID: <20220625074422.3479591-5-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20220625074422.3479591-1-haijie1@huawei.com> References: <20220625074422.3479591-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 --- drivers/dma/hisi_dma.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 0385419be8d5..d69a73272467 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,20 @@ 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_Q_OFFSET; + + ret = readl_relaxed_poll_timeout(addr, tmp, + FIELD_GET(HISI_DMA_Q_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 +216,10 @@ 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_Q_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