From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F15D8C35249 for ; Wed, 5 Feb 2020 06:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9CB021927 for ; Wed, 5 Feb 2020 06:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725875AbgBEG3L (ORCPT ); Wed, 5 Feb 2020 01:29:11 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:36640 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725468AbgBEG3L (ORCPT ); Wed, 5 Feb 2020 01:29:11 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F292495C73F429EEABCA; Wed, 5 Feb 2020 14:29:07 +0800 (CST) Received: from [127.0.0.1] (10.133.213.239) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Wed, 5 Feb 2020 14:29:05 +0800 Subject: Re: [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode' To: Chen-Yu Tsai , Stefan Mavrodiev References: <20200205044247.32496-1-yuehaibing@huawei.com> CC: Vinod Koul , Dan Williams , Maxime Ripard , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , linux-arm-kernel , linux-kernel From: Yuehaibing Message-ID: Date: Wed, 5 Feb 2020 14:29:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On 2020/2/5 12:56, Chen-Yu Tsai wrote: > Hi, > > On Wed, Feb 5, 2020 at 12:43 PM YueHaibing wrote: >> >> drivers/dma/sun4i-dma.c: In function sun4i_dma_prep_dma_cyclic: >> drivers/dma/sun4i-dma.c:672:24: warning: >> variable linear_mode set but not used [-Wunused-but-set-variable] >> >> commit ffc079a4accc ("dmaengine: sun4i: Add support for cyclic requests with dedicated DMA") >> involved this unused variable. >> >> Reported-by: Hulk Robot >> Signed-off-by: YueHaibing >> --- >> drivers/dma/sun4i-dma.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c >> index bbc2bda..501cd44 100644 >> --- a/drivers/dma/sun4i-dma.c >> +++ b/drivers/dma/sun4i-dma.c >> @@ -669,7 +669,7 @@ sun4i_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf, size_t len, >> dma_addr_t src, dest; >> u32 endpoints; >> int nr_periods, offset, plength, i; >> - u8 ram_type, io_mode, linear_mode; >> + u8 ram_type, io_mode; >> >> if (!is_slave_direction(dir)) { >> dev_err(chan2dev(chan), "Invalid DMA direction\n"); >> @@ -684,11 +684,9 @@ sun4i_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf, size_t len, >> >> if (vchan->is_dedicated) { >> io_mode = SUN4I_DDMA_ADDR_MODE_IO; >> - linear_mode = SUN4I_DDMA_ADDR_MODE_LINEAR; >> ram_type = SUN4I_DDMA_DRQ_TYPE_SDRAM; >> } else { >> io_mode = SUN4I_NDMA_ADDR_MODE_IO; >> - linear_mode = SUN4I_NDMA_ADDR_MODE_LINEAR; >> ram_type = SUN4I_NDMA_DRQ_TYPE_SDRAM; >> } > > I think it's better to actually use these values later when composing > the value for `endpoints`, as we do in sun4i_dma_prep_slave_sg(). > > The code currently works because SUN4I_DDMA_ADDR_MODE_LINEAR == 0. > However explicitly using the value makes the code more readable, > and doesn't require the reader to have implicit knowledge of default > values for parameters not specified in the composition of `endpoints`. Thanks, will send v2. > > ChenYu > > . >