linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode'
@ 2020-02-05  4:42 YueHaibing
  2020-02-05  4:56 ` Chen-Yu Tsai
  2020-02-07  2:44 ` [PATCH v2 -next] dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclic YueHaibing
  0 siblings, 2 replies; 4+ messages in thread
From: YueHaibing @ 2020-02-05  4:42 UTC (permalink / raw)
  To: vkoul, dan.j.williams, mripard, wens, stefan
  Cc: dmaengine, linux-arm-kernel, linux-kernel, YueHaibing

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 <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 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;
 	}
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode'
  2020-02-05  4:42 [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode' YueHaibing
@ 2020-02-05  4:56 ` Chen-Yu Tsai
  2020-02-05  6:29   ` Yuehaibing
  2020-02-07  2:44 ` [PATCH v2 -next] dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclic YueHaibing
  1 sibling, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2020-02-05  4:56 UTC (permalink / raw)
  To: YueHaibing, Stefan Mavrodiev
  Cc: Vinod Koul, Dan Williams, Maxime Ripard,
	open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM, linux-arm-kernel,
	linux-kernel

Hi,

On Wed, Feb 5, 2020 at 12:43 PM YueHaibing <yuehaibing@huawei.com> 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 <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  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`.

ChenYu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode'
  2020-02-05  4:56 ` Chen-Yu Tsai
@ 2020-02-05  6:29   ` Yuehaibing
  0 siblings, 0 replies; 4+ messages in thread
From: Yuehaibing @ 2020-02-05  6:29 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stefan Mavrodiev
  Cc: Vinod Koul, Dan Williams, Maxime Ripard,
	open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM, linux-arm-kernel,
	linux-kernel

On 2020/2/5 12:56, Chen-Yu Tsai wrote:
> Hi,
> 
> On Wed, Feb 5, 2020 at 12:43 PM YueHaibing <yuehaibing@huawei.com> 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 <hulkci@huawei.com>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  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
> 
> .
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 -next] dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclic
  2020-02-05  4:42 [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode' YueHaibing
  2020-02-05  4:56 ` Chen-Yu Tsai
@ 2020-02-07  2:44 ` YueHaibing
  1 sibling, 0 replies; 4+ messages in thread
From: YueHaibing @ 2020-02-07  2:44 UTC (permalink / raw)
  To: dan.j.williams, vkoul, mripard, wens, stefan
  Cc: dmaengine, linux-arm-kernel, linux-kernel, YueHaibing

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, explicitly using the value makes the code more readable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: use 'linear_mode' instead of removing
---
 drivers/dma/sun4i-dma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
index bbc2bda..e87fc7c4 100644
--- a/drivers/dma/sun4i-dma.c
+++ b/drivers/dma/sun4i-dma.c
@@ -698,10 +698,12 @@ sun4i_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf, size_t len,
 		endpoints = SUN4I_DMA_CFG_DST_DRQ_TYPE(vchan->endpoint) |
 			    SUN4I_DMA_CFG_DST_ADDR_MODE(io_mode) |
 			    SUN4I_DMA_CFG_SRC_DRQ_TYPE(ram_type);
+			    SUN4I_DMA_CFG_SRC_ADDR_MODE(linear_mode);
 	} else {
 		src = sconfig->src_addr;
 		dest = buf;
 		endpoints = SUN4I_DMA_CFG_DST_DRQ_TYPE(ram_type) |
+			    SUN4I_DMA_CFG_DST_ADDR_MODE(linear_mode) |
 			    SUN4I_DMA_CFG_SRC_DRQ_TYPE(vchan->endpoint) |
 			    SUN4I_DMA_CFG_SRC_ADDR_MODE(io_mode);
 	}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-07  2:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  4:42 [PATCH -next] dmaengine: sun4i: remove set but unused variable 'linear_mode' YueHaibing
2020-02-05  4:56 ` Chen-Yu Tsai
2020-02-05  6:29   ` Yuehaibing
2020-02-07  2:44 ` [PATCH v2 -next] dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclic YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).