diff mbox series

[1/3,v2] dmaengine: dw-edma: fix unnecessary stack usage

Message ID 20190722124457.1093886-1-arnd@arndb.de
State New
Headers show
Series [1/3,v2] dmaengine: dw-edma: fix unnecessary stack usage | expand

Commit Message

Arnd Bergmann July 22, 2019, 12:44 p.m. UTC
Putting large constant data on the stack causes unnecessary overhead
and stack usage:

drivers/dma/dw-edma/dw-edma-v0-debugfs.c:285:6: error: stack frame size of 1376 bytes in function 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than=]

Mark the variable 'static const' in order for the compiler to move it
into the .rodata section where it does no such harm.

Fixes: 305aebeff879 ("dmaengine: Add Synopsys eDMA IP version 0 debugfs support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
v2: unchanged
---
 drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.0

Comments

Gustavo Pimentel July 22, 2019, 1:33 p.m. UTC | #1
On Mon, Jul 22, 2019 at 13:44:43, Arnd Bergmann <arnd@arndb.de> wrote:

> Putting large constant data on the stack causes unnecessary overhead

> and stack usage:

> 

> drivers/dma/dw-edma/dw-edma-v0-debugfs.c:285:6: error: stack frame size of 1376 bytes in function 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than=]

> 

> Mark the variable 'static const' in order for the compiler to move it

> into the .rodata section where it does no such harm.

> 

> Fixes: 305aebeff879 ("dmaengine: Add Synopsys eDMA IP version 0 debugfs support")

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

> v2: unchanged

> ---

>  drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c

> index 3226f528cc11..5728b6fe938c 100644

> --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c

> +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c

> @@ -48,7 +48,7 @@ static struct {

>  } lim[2][EDMA_V0_MAX_NR_CH];

>  

>  struct debugfs_entries {

> -	char					name[24];

> +	const char				*name;

>  	dma_addr_t				*reg;

>  };

>  

> -- 

> 2.20.0



Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Vinod Koul July 22, 2019, 2:21 p.m. UTC | #2
On 22-07-19, 14:44, Arnd Bergmann wrote:
> Putting large constant data on the stack causes unnecessary overhead

> and stack usage:

> 

> drivers/dma/dw-edma/dw-edma-v0-debugfs.c:285:6: error: stack frame size of 1376 bytes in function 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than=]

> 

> Mark the variable 'static const' in order for the compiler to move it

> into the .rodata section where it does no such harm.


Applied all, thanks

Please do note the link was pointing to older rev, I have updated them
to this revision.

-- 
~Vinod
diff mbox series

Patch

diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
index 3226f528cc11..5728b6fe938c 100644
--- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
+++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
@@ -48,7 +48,7 @@  static struct {
 } lim[2][EDMA_V0_MAX_NR_CH];
 
 struct debugfs_entries {
-	char					name[24];
+	const char				*name;
 	dma_addr_t				*reg;
 };