linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][V2] ata: pata_artop: make arrays static const, makes object smaller
@ 2019-10-06 14:29 ` Colin King
  2019-11-08 14:06   ` Bartlomiej Zolnierkiewicz
  2019-11-08 14:26   ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-10-06 14:29 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Jens Axboe, linux-ide
  Cc: kernel-janitors, linux-kernel

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

Don't populate the const arrays on the stack but instead make them
static. Makes the object code smaller by 292 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
   6988	   3132	    128	  10248	   2808	drivers/ata/pata_artop.o

After:
   text	   data	    bss	    dec	    hex	filename
   6536	   3292	    128	   9956	   26e4	drivers/ata/pata_artop.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

V2: fix up commit message

---
 drivers/ata/pata_artop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 3aa006c5ed0c..6bd2228bb6ff 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -100,7 +100,7 @@ static void artop6210_load_piomode(struct ata_port *ap, struct ata_device *adev,
 {
 	struct pci_dev *pdev	= to_pci_dev(ap->host->dev);
 	int dn = adev->devno + 2 * ap->port_no;
-	const u16 timing[2][5] = {
+	static const u16 timing[2][5] = {
 		{ 0x0000, 0x000A, 0x0008, 0x0303, 0x0301 },
 		{ 0x0700, 0x070A, 0x0708, 0x0403, 0x0401 }
 
@@ -154,7 +154,7 @@ static void artop6260_load_piomode (struct ata_port *ap, struct ata_device *adev
 {
 	struct pci_dev *pdev	= to_pci_dev(ap->host->dev);
 	int dn = adev->devno + 2 * ap->port_no;
-	const u8 timing[2][5] = {
+	static const u8 timing[2][5] = {
 		{ 0x00, 0x0A, 0x08, 0x33, 0x31 },
 		{ 0x70, 0x7A, 0x78, 0x43, 0x41 }
 
-- 
2.20.1


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

* Re: [PATCH][V2] ata: pata_artop: make arrays static const, makes object smaller
  2019-10-06 14:29 ` [PATCH][V2] ata: pata_artop: make arrays static const, makes object smaller Colin King
@ 2019-11-08 14:06   ` Bartlomiej Zolnierkiewicz
  2019-11-08 14:26   ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-11-08 14:06 UTC (permalink / raw)
  To: Colin King, Jens Axboe; +Cc: linux-ide, kernel-janitors, linux-kernel


On 10/6/19 4:29 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const arrays on the stack but instead make them
> static. Makes the object code smaller by 292 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    6988	   3132	    128	  10248	   2808	drivers/ata/pata_artop.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    6536	   3292	    128	   9956	   26e4	drivers/ata/pata_artop.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
> 
> V2: fix up commit message
> 
> ---
>  drivers/ata/pata_artop.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
> index 3aa006c5ed0c..6bd2228bb6ff 100644
> --- a/drivers/ata/pata_artop.c
> +++ b/drivers/ata/pata_artop.c
> @@ -100,7 +100,7 @@ static void artop6210_load_piomode(struct ata_port *ap, struct ata_device *adev,
>  {
>  	struct pci_dev *pdev	= to_pci_dev(ap->host->dev);
>  	int dn = adev->devno + 2 * ap->port_no;
> -	const u16 timing[2][5] = {
> +	static const u16 timing[2][5] = {
>  		{ 0x0000, 0x000A, 0x0008, 0x0303, 0x0301 },
>  		{ 0x0700, 0x070A, 0x0708, 0x0403, 0x0401 }
>  
> @@ -154,7 +154,7 @@ static void artop6260_load_piomode (struct ata_port *ap, struct ata_device *adev
>  {
>  	struct pci_dev *pdev	= to_pci_dev(ap->host->dev);
>  	int dn = adev->devno + 2 * ap->port_no;
> -	const u8 timing[2][5] = {
> +	static const u8 timing[2][5] = {
>  		{ 0x00, 0x0A, 0x08, 0x33, 0x31 },
>  		{ 0x70, 0x7A, 0x78, 0x43, 0x41 }
>  

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

* Re: [PATCH][V2] ata: pata_artop: make arrays static const, makes object smaller
  2019-10-06 14:29 ` [PATCH][V2] ata: pata_artop: make arrays static const, makes object smaller Colin King
  2019-11-08 14:06   ` Bartlomiej Zolnierkiewicz
@ 2019-11-08 14:26   ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-11-08 14:26 UTC (permalink / raw)
  To: Colin King, Bartlomiej Zolnierkiewicz, linux-ide
  Cc: kernel-janitors, linux-kernel

On 10/6/19 8:29 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const arrays on the stack but instead make them
> static. Makes the object code smaller by 292 bytes.
> 
> Before:
>     text	   data	    bss	    dec	    hex	filename
>     6988	   3132	    128	  10248	   2808	drivers/ata/pata_artop.o
> 
> After:
>     text	   data	    bss	    dec	    hex	filename
>     6536	   3292	    128	   9956	   26e4	drivers/ata/pata_artop.o
> 
> (gcc version 9.2.1, amd64)

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2019-11-08 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20191006143000epcas2p168872c0c7b1e1879e31931d3244dfd4d@epcas2p1.samsung.com>
2019-10-06 14:29 ` [PATCH][V2] ata: pata_artop: make arrays static const, makes object smaller Colin King
2019-11-08 14:06   ` Bartlomiej Zolnierkiewicz
2019-11-08 14:26   ` Jens Axboe

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