linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] PCI: ibmphp: make read-only arrays static
@ 2023-06-27 12:56 Colin Ian King
  2023-07-18 21:53 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2023-06-27 12:56 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci; +Cc: kernel-janitors, linux-kernel

Don't populate the arrays on the stack, instead make them static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/pci/hotplug/ibmphp_pci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
index 754c3f23282e..50038e5f9ca4 100644
--- a/drivers/pci/hotplug/ibmphp_pci.c
+++ b/drivers/pci/hotplug/ibmphp_pci.c
@@ -329,7 +329,7 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno)
 static int configure_device(struct pci_func *func)
 {
 	u32 bar[6];
-	u32 address[] = {
+	static const u32 address[] = {
 		PCI_BASE_ADDRESS_0,
 		PCI_BASE_ADDRESS_1,
 		PCI_BASE_ADDRESS_2,
@@ -564,7 +564,7 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
 	struct resource_node *pfmem = NULL;
 	struct resource_node *bus_pfmem[2] = {NULL, NULL};
 	struct bus_node *bus;
-	u32 address[] = {
+	static const u32 address[] = {
 		PCI_BASE_ADDRESS_0,
 		PCI_BASE_ADDRESS_1,
 		0
@@ -1053,7 +1053,7 @@ static struct res_needed *scan_behind_bridge(struct pci_func *func, u8 busno)
 	int howmany = 0;	/*this is to see if there are any devices behind the bridge */
 
 	u32 bar[6], class;
-	u32 address[] = {
+	static const u32 address[] = {
 		PCI_BASE_ADDRESS_0,
 		PCI_BASE_ADDRESS_1,
 		PCI_BASE_ADDRESS_2,
@@ -1182,7 +1182,7 @@ static struct res_needed *scan_behind_bridge(struct pci_func *func, u8 busno)
 static int unconfigure_boot_device(u8 busno, u8 device, u8 function)
 {
 	u32 start_address;
-	u32 address[] = {
+	static const u32 address[] = {
 		PCI_BASE_ADDRESS_0,
 		PCI_BASE_ADDRESS_1,
 		PCI_BASE_ADDRESS_2,
@@ -1310,7 +1310,7 @@ static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function)
 	struct resource_node *mem = NULL;
 	struct resource_node *pfmem = NULL;
 	struct bus_node *bus;
-	u32 address[] = {
+	static const u32 address[] = {
 		PCI_BASE_ADDRESS_0,
 		PCI_BASE_ADDRESS_1,
 		0
-- 
2.39.2


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

* Re: [PATCH][next] PCI: ibmphp: make read-only arrays static
  2023-06-27 12:56 [PATCH][next] PCI: ibmphp: make read-only arrays static Colin Ian King
@ 2023-07-18 21:53 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2023-07-18 21:53 UTC (permalink / raw)
  To: Colin Ian King; +Cc: Bjorn Helgaas, linux-pci, kernel-janitors, linux-kernel

On Tue, Jun 27, 2023 at 01:56:12PM +0100, Colin Ian King wrote:
> Don't populate the arrays on the stack, instead make them static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Applied to pci/hotplug for v6.6, thanks!

> ---
>  drivers/pci/hotplug/ibmphp_pci.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
> index 754c3f23282e..50038e5f9ca4 100644
> --- a/drivers/pci/hotplug/ibmphp_pci.c
> +++ b/drivers/pci/hotplug/ibmphp_pci.c
> @@ -329,7 +329,7 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno)
>  static int configure_device(struct pci_func *func)
>  {
>  	u32 bar[6];
> -	u32 address[] = {
> +	static const u32 address[] = {
>  		PCI_BASE_ADDRESS_0,
>  		PCI_BASE_ADDRESS_1,
>  		PCI_BASE_ADDRESS_2,
> @@ -564,7 +564,7 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
>  	struct resource_node *pfmem = NULL;
>  	struct resource_node *bus_pfmem[2] = {NULL, NULL};
>  	struct bus_node *bus;
> -	u32 address[] = {
> +	static const u32 address[] = {
>  		PCI_BASE_ADDRESS_0,
>  		PCI_BASE_ADDRESS_1,
>  		0
> @@ -1053,7 +1053,7 @@ static struct res_needed *scan_behind_bridge(struct pci_func *func, u8 busno)
>  	int howmany = 0;	/*this is to see if there are any devices behind the bridge */
>  
>  	u32 bar[6], class;
> -	u32 address[] = {
> +	static const u32 address[] = {
>  		PCI_BASE_ADDRESS_0,
>  		PCI_BASE_ADDRESS_1,
>  		PCI_BASE_ADDRESS_2,
> @@ -1182,7 +1182,7 @@ static struct res_needed *scan_behind_bridge(struct pci_func *func, u8 busno)
>  static int unconfigure_boot_device(u8 busno, u8 device, u8 function)
>  {
>  	u32 start_address;
> -	u32 address[] = {
> +	static const u32 address[] = {
>  		PCI_BASE_ADDRESS_0,
>  		PCI_BASE_ADDRESS_1,
>  		PCI_BASE_ADDRESS_2,
> @@ -1310,7 +1310,7 @@ static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function)
>  	struct resource_node *mem = NULL;
>  	struct resource_node *pfmem = NULL;
>  	struct bus_node *bus;
> -	u32 address[] = {
> +	static const u32 address[] = {
>  		PCI_BASE_ADDRESS_0,
>  		PCI_BASE_ADDRESS_1,
>  		0
> -- 
> 2.39.2
> 

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

end of thread, other threads:[~2023-07-18 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-27 12:56 [PATCH][next] PCI: ibmphp: make read-only arrays static Colin Ian King
2023-07-18 21:53 ` Bjorn Helgaas

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