Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] PCI/ACPI: make array pcie_to_hpx3_type static const, makes object smaller
@ 2020-02-10  8:52 Colin King
  2020-02-10 22:39 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-02-10  8:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, Bjorn Helgaas, linux-acpi, linux-pci
  Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
  19247	   3048	     64	  22359	   5757	drivers/pci/pci-acpi.o

After:
   text	   data	    bss	    dec	    hex	filename
  19177	   3112	     64	  22353	   5751	drivers/pci/pci-acpi.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pci/pci-acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 0c02d500158f..d914f8bc31ea 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -439,7 +439,7 @@ enum hpx_type3_dev_type {
 static u16 hpx3_device_type(struct pci_dev *dev)
 {
 	u16 pcie_type = pci_pcie_type(dev);
-	const int pcie_to_hpx3_type[] = {
+	static const int pcie_to_hpx3_type[] = {
 		[PCI_EXP_TYPE_ENDPOINT]    = HPX_TYPE_ENDPOINT,
 		[PCI_EXP_TYPE_LEG_END]     = HPX_TYPE_LEG_END,
 		[PCI_EXP_TYPE_RC_END]      = HPX_TYPE_RC_END,
-- 
2.25.0


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

* Re: [PATCH] PCI/ACPI: make array pcie_to_hpx3_type static const, makes object smaller
  2020-02-10  8:52 [PATCH] PCI/ACPI: make array pcie_to_hpx3_type static const, makes object smaller Colin King
@ 2020-02-10 22:39 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2020-02-10 22:39 UTC (permalink / raw)
  To: Colin King
  Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-pci,
	kernel-janitors, linux-kernel, Krzysztof Wilczynski

[+cc Krzysztof]

On Mon, Feb 10, 2020 at 08:52:56AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array pcie_to_hpx3_type on the stack but instead
> make it static const. Makes the object code smaller by 6 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   19247	   3048	     64	  22359	   5757	drivers/pci/pci-acpi.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   19177	   3112	     64	  22353	   5751	drivers/pci/pci-acpi.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Nice cleanup, thanks!  Applied to pci/misc for v5.7.

> ---
>  drivers/pci/pci-acpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 0c02d500158f..d914f8bc31ea 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -439,7 +439,7 @@ enum hpx_type3_dev_type {
>  static u16 hpx3_device_type(struct pci_dev *dev)
>  {
>  	u16 pcie_type = pci_pcie_type(dev);
> -	const int pcie_to_hpx3_type[] = {
> +	static const int pcie_to_hpx3_type[] = {
>  		[PCI_EXP_TYPE_ENDPOINT]    = HPX_TYPE_ENDPOINT,
>  		[PCI_EXP_TYPE_LEG_END]     = HPX_TYPE_LEG_END,
>  		[PCI_EXP_TYPE_RC_END]      = HPX_TYPE_RC_END,
> -- 
> 2.25.0
> 

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10  8:52 [PATCH] PCI/ACPI: make array pcie_to_hpx3_type static const, makes object smaller Colin King
2020-02-10 22:39 ` Bjorn Helgaas

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org
	public-inbox-index linux-acpi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git