linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller
@ 2019-09-05 16:37 Colin King
  2019-09-25 20:43 ` Vinod Koul
  2019-10-14  8:28 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2019-09-05 16:37 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, dmaengine; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the array 'handler' on the stack but instead make it
static const. Makes the object code smaller by 80 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
  38225	   9084	     64	  47373	   b90d	drivers/dma/iop-adma.o

After:
   text	   data	    bss	    dec	    hex	filename
  38081	   9148	     64	  47293	   b8bd	drivers/dma/iop-adma.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/dma/iop-adma.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index a3f942a6a946..4dc5478fc156 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -1359,9 +1359,11 @@ static int iop_adma_probe(struct platform_device *pdev)
 	iop_adma_device_clear_err_status(iop_chan);
 
 	for (i = 0; i < 3; i++) {
-		irq_handler_t handler[] = { iop_adma_eot_handler,
-					iop_adma_eoc_handler,
-					iop_adma_err_handler };
+		static const irq_handler_t handler[] = {
+			iop_adma_eot_handler,
+			iop_adma_eoc_handler,
+			iop_adma_err_handler
+		};
 		int irq = platform_get_irq(pdev, i);
 		if (irq < 0) {
 			ret = -ENXIO;
-- 
2.20.1


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

* Re: [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller
  2019-09-05 16:37 [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller Colin King
@ 2019-09-25 20:43 ` Vinod Koul
  2019-09-25 20:46   ` Colin Ian King
  2019-10-14  8:28 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2019-09-25 20:43 UTC (permalink / raw)
  To: Colin King; +Cc: Dan Williams, dmaengine, kernel-janitors, linux-kernel

On 05-09-19, 17:37, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array 'handler' on the stack but instead make it
> static const. Makes the object code smaller by 80 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   38225	   9084	     64	  47373	   b90d	drivers/dma/iop-adma.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   38081	   9148	     64	  47293	   b8bd	drivers/dma/iop-adma.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/dma/iop-adma.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
> index a3f942a6a946..4dc5478fc156 100644
> --- a/drivers/dma/iop-adma.c
> +++ b/drivers/dma/iop-adma.c
> @@ -1359,9 +1359,11 @@ static int iop_adma_probe(struct platform_device *pdev)
>  	iop_adma_device_clear_err_status(iop_chan);
>  
>  	for (i = 0; i < 3; i++) {
> -		irq_handler_t handler[] = { iop_adma_eot_handler,
> -					iop_adma_eoc_handler,
> -					iop_adma_err_handler };
> +		static const irq_handler_t handler[] = {
> +			iop_adma_eot_handler,
> +			iop_adma_eoc_handler,
> +			iop_adma_err_handler

would it not be more apt to declare the handler outside the loop!

> +		};
>  		int irq = platform_get_irq(pdev, i);
>  		if (irq < 0) {
>  			ret = -ENXIO;
> -- 
> 2.20.1

-- 
~Vinod

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

* Re: [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller
  2019-09-25 20:43 ` Vinod Koul
@ 2019-09-25 20:46   ` Colin Ian King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2019-09-25 20:46 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Dan Williams, dmaengine, kernel-janitors, linux-kernel

On 25/09/2019 21:43, Vinod Koul wrote:
> On 05-09-19, 17:37, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Don't populate the array 'handler' on the stack but instead make it
>> static const. Makes the object code smaller by 80 bytes.
>>
>> Before:
>>    text	   data	    bss	    dec	    hex	filename
>>   38225	   9084	     64	  47373	   b90d	drivers/dma/iop-adma.o
>>
>> After:
>>    text	   data	    bss	    dec	    hex	filename
>>   38081	   9148	     64	  47293	   b8bd	drivers/dma/iop-adma.o
>>
>> (gcc version 9.2.1, amd64)
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/dma/iop-adma.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
>> index a3f942a6a946..4dc5478fc156 100644
>> --- a/drivers/dma/iop-adma.c
>> +++ b/drivers/dma/iop-adma.c
>> @@ -1359,9 +1359,11 @@ static int iop_adma_probe(struct platform_device *pdev)
>>  	iop_adma_device_clear_err_status(iop_chan);
>>  
>>  	for (i = 0; i < 3; i++) {
>> -		irq_handler_t handler[] = { iop_adma_eot_handler,
>> -					iop_adma_eoc_handler,
>> -					iop_adma_err_handler };
>> +		static const irq_handler_t handler[] = {
>> +			iop_adma_eot_handler,
>> +			iop_adma_eoc_handler,
>> +			iop_adma_err_handler
> 
> would it not be more apt to declare the handler outside the loop!

Originally yes, but now it's static, no.

> 
>> +		};
>>  		int irq = platform_get_irq(pdev, i);
>>  		if (irq < 0) {
>>  			ret = -ENXIO;
>> -- 
>> 2.20.1
> 


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

* Re: [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller
  2019-09-05 16:37 [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller Colin King
  2019-09-25 20:43 ` Vinod Koul
@ 2019-10-14  8:28 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2019-10-14  8:28 UTC (permalink / raw)
  To: Colin King; +Cc: Dan Williams, dmaengine, kernel-janitors, linux-kernel

On 05-09-19, 17:37, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array 'handler' on the stack but instead make it
> static const. Makes the object code smaller by 80 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   38225	   9084	     64	  47373	   b90d	drivers/dma/iop-adma.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   38081	   9148	     64	  47293	   b8bd	drivers/dma/iop-adma.o
> 
> (gcc version 9.2.1, amd64)

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2019-10-14  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 16:37 [PATCH] dmaengine: iop-adma: make array 'handler' static const, makes object smaller Colin King
2019-09-25 20:43 ` Vinod Koul
2019-09-25 20:46   ` Colin Ian King
2019-10-14  8:28 ` Vinod Koul

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).