Received: by 10.223.185.116 with SMTP id b49csp8449601wrg; Fri, 2 Mar 2018 01:53:50 -0800 (PST) X-Google-Smtp-Source: AG47ELvFzGFLFRPZsRzjDDajSr3DLgCS/QIVJewGEkHIBwTNjjIt+hm+aKGS0TEthexj0/MF73Do X-Received: by 2002:a17:902:506:: with SMTP id 6-v6mr4862479plf.365.1519984430618; Fri, 02 Mar 2018 01:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519984430; cv=none; d=google.com; s=arc-20160816; b=CVaE9pKU87AWN+ZoBEr27U91oPfO3WyCTRUV7R9YU6QdaJDgWIdpx1WH9twsIvfSUY x3ro7WKrZ/Fd1XnpOOp51HheKRcDfevjM8UGsIINFVWB7us1L9XA2FpnFMMtVQLHgVT1 N3BftVcz9iXEHCOEkQ+U0IViA/JoMAWZzJ7APTqVOF0jtJhhkvo1PGwyPsUSSsZvhOL5 wj0Y104YMhz1/5rFXjUrjpwBe0JmcxNvZTsvSwWJcGwKIsqoIlVLFiz31i+5KTat/wT0 UXwATOVejghdLe+Zm88HaSoyHNWC4BcKzr+g8xdXDZ1/g5VT7naWRspUKLH8miYTQNxU a0GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=XlH2+LYA/5yv5Pvh4MluzFlOTlmhcoWXpJMgpj47eZU=; b=yj5VcDIKfSmN5eGfOv6BsGQgeek13KBe7871Oj31/tBtYhqQ935BjfEazOROI/Gn1d zGfgw57G573F3OGlXQ7hctpKP8ST+bGpJqo80TS2kYRyWJdWxnrPQR8ezX8hm7qJThsl 9Jh6Rx2Lv/yXZ/bMb4FTjTWnvpqB+7dVDI/Hk81LpAIryqLktWGiPfRR/in5tItXxQBT zADFp1KREfWNeX28qyVyGRP9pg7t4L0lyzUlYjW4WfgXtaYnytH7AA3ptGRL4/SNa6bM I/FdegwiGP7iV62RzmntrzfhEHNGcqo5uMemmzzAnM5gkfYM170N0HJTuU06DnoE9q7e 4QBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10-v6si1898775plj.360.2018.03.02.01.53.36; Fri, 02 Mar 2018 01:53:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425995AbeCBJwF (ORCPT + 99 others); Fri, 2 Mar 2018 04:52:05 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:51175 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1424708AbeCBJva (ORCPT ); Fri, 2 Mar 2018 04:51:30 -0500 X-UUID: 914360f5fe16491a84a004b762a6cd43-20180302 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1278972132; Fri, 02 Mar 2018 17:51:25 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 2 Mar 2018 17:51:24 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkcas07.mediatek.inc (172.21.101.84) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 2 Mar 2018 17:51:23 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 2 Mar 2018 17:51:23 +0800 Message-ID: <1519984283.8089.182.camel@mtkswgap22> Subject: Re: [PATCH v5 2/3] dmaengine: mediatek: Add MediaTek High-Speed DMA controller for MT7622 and MT7623 SoC From: Sean Wang To: Vinod Koul CC: , , , , , , , , Randy Dunlap , Fengguang Wu , Julia Lawall Date: Fri, 2 Mar 2018 17:51:23 +0800 In-Reply-To: <20180302081706.GL15443@localhost> References: <20180301082329.GD15443@localhost> <1519900021.8089.136.camel@mtkswgap22> <20180301125649.GH15443@localhost> <1519973271.8089.166.camel@mtkswgap22> <20180302081706.GL15443@localhost> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-03-02 at 13:47 +0530, Vinod Koul wrote: > On Fri, Mar 02, 2018 at 02:47:51PM +0800, Sean Wang wrote: > > Hi, Vinod > > > > On Thu, 2018-03-01 at 18:26 +0530, Vinod Koul wrote: > > > On Thu, Mar 01, 2018 at 06:27:01PM +0800, Sean Wang wrote: > > > > On Thu, 2018-03-01 at 13:53 +0530, Vinod Koul wrote: > > > > > On Sun, Feb 18, 2018 at 03:08:30AM +0800, sean.wang@mediatek.com wrote: > > > > > > > > > > > @@ -0,0 +1,1054 @@ > > > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > > // Copyright ... > > > > > > > > > > The copyright line needs to follow SPDX tag line > > > > > > > > > > > > > okay, I will make it reorder and be something like that > > > > > > > > // SPDX-License-Identifier: GPL-2.0 > > > > /* > > > > * Copyright (c) 2017-2018 MediaTek Inc. > > > > * Author: Sean Wang > > > > * > > > > * Driver for MediaTek High-Speed DMA Controller > > > > * > > > > */ > > > > > > It needs to be: > > > > > > // SPDX-License-Identifier: GPL-2.0 > > > // Copyright (c) 2017-2018 MediaTek Inc. > > > > > > /* > > > * whatever else you want > > > */ > > > > > > The first two lines are in C99 style comment and need to have SPDX tag and > > > Copyright info > > > > Sure, I can do it using C99 style comments at the first two lines. > > > > In addition, I'm really curious where we can find a reference to the > > rule and if it 's a strict rule for all the drivers. > > > > Because I'm considering whether I should turn other driver into using > > the same rule. > > Yes that seems to be the rule now https://lkml.org/lkml/2017/11/2/715 > Where could I find the rule for the copyright line needed to follow SPDX tag line ? currently, I still seen tons of drivers putting its copyright inside /* ... * */ > > > > > > +#define MTK_HSDMA_USEC_POLL 20 > > > > > > +#define MTK_HSDMA_TIMEOUT_POLL 200000 > > > > > > +#define MTK_HSDMA_DMA_BUSWIDTHS BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) > > > > > > > > > > Undefined buswidth?? > > > > > > ?? > > > > Sorry for I didn't answer the question in the short time. > > > > After spending some time on a confirmation with design, it is > > DMA_SLAVE_BUSWIDTH_4_BYTES and not be configurable. > > Then it should be DMA_SLAVE_BUSWIDTH_4_BYTES and not > DMA_SLAVE_BUSWIDTH_UNDEFINED... > understood, I will do it. > > > > > shouldn't we check if next is in range, we can crash if we get bad value > > > > > from hardware.. > > > > > > > > okay, there are checks for next with ddone bit check and null check in > > > > the corresponding descriptor as the following. > > > > > > what if you get bad next value > > > > > > > next is not hardware value. it's maintained by software which is always > > between 0 to MTK_DMA_SIZE - 1, and definitely doesn't get a bad value. > > > > > > > > > > > > + rxd = &pc->ring.rxd[next]; > > > > > > resulting in bad ref here > > > > rxd is also definitely a good ref > > not if next is out of range, say you read -1 or 200000? > next must be in range because next is calculated by MTK_HSDMA_NEXT_DESP_IDX macro which is just a modulo operation with MTK_DMA_SIZE. Currently, MTK_DMA_SIZE is equal to 64 and thus next must be 0 to 63 and wraparound. As to MTK_HSDMA_NEXT_DESP_IDX , it is defined as the following #define MTK_HSDMA_NEXT_DESP_IDX(x, y) (((x) + 1) & ((y) - 1))