Skip to contentSkip to conversation

powerpc: Make some functions static

PATCH Superseded Mathieu Malaterre 5 participants 9 messages Mar 12, 2019 – Apr 21, 2019 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Make some functions static

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since these functions can be made static, make it so. While doing so, it turns out that holly_power_off and holly_halt are unused, so remove them.

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:47:5: error: no previous prototype for 'holly_exclude_device' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:190:6: error: no previous prototype for 'holly_show_cpuinfo' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:196:17: error: no previous prototype for 'holly_restart' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:236:6: error: no previous prototype for 'holly_power_off' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:243:6: error: no previous prototype for 'holly_halt' [-Werror=missing-prototypes]

---
 arch/powerpc/platforms/embedded6xx/holly.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +4 -15
index 0409714e8070..829bf3697dc9 100644
@@ -44,7 +44,8 @@
 
 #define HOLLY_PCI_CFG_PHYS 0x7c000000
 
-int holly_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
+static int holly_exclude_device(struct pci_controller *hose, u_char bus,
+				u_char devfn)
 {
 	if (bus == 0 && PCI_SLOT(devfn) == 0)
 		return PCIBIOS_DEVICE_NOT_FOUND;
@@ -187,13 +188,13 @@ static void __init holly_init_IRQ(void)
 	tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
 }
 
-void holly_show_cpuinfo(struct seq_file *m)
+static void holly_show_cpuinfo(struct seq_file *m)
 {
 	seq_printf(m, "vendor\t\t: IBM\n");
 	seq_printf(m, "machine\t\t: PPC750 GX/CL\n");
 }
 
-void __noreturn holly_restart(char *cmd)
+static void __noreturn holly_restart(char *cmd)
 {
 	__be32 __iomem *ocn_bar1 = NULL;
 	unsigned long bar;
@@ -233,18 +234,6 @@ void __noreturn holly_restart(char *cmd)
 	for (;;) ;
 }
 
-void holly_power_off(void)
-{
-	local_irq_disable();
-	/* No way to shut power off with software */
-	for (;;) ;
-}
-
-void holly_halt(void)
-{
-	holly_power_off();
-}
-
 /*
  * Called very early, device-tree isn't unflattened
  */
Signature · 1 line
2.20.1
#1 lore raw

Le 12/03/2019 à 21:31, Mathieu Malaterre a écrit :

Quoted 4 lines

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since these functions can be made static, make it so. While doing so, it turns out that holly_power_off and holly_halt are unused, so remove them.

I would have said 'since these functions are only used in this C file, make them static'.

I think this could be split in two patches:
1/ Remove unused functions, ie holly_halt() and holly_power_off(). 2/ Make the other ones static.

Christophe

Quoted 64 lines

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:47:5: error: no previous prototype for 'holly_exclude_device' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:190:6: error: no previous prototype for 'holly_show_cpuinfo' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:196:17: error: no previous prototype for 'holly_restart' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:236:6: error: no previous prototype for 'holly_power_off' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:243:6: error: no previous prototype for 'holly_halt' [-Werror=missing-prototypes]

---
  arch/powerpc/platforms/embedded6xx/holly.c | 19 ++++---------------
  1 file changed, 4 insertions(+), 15 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +4 -15
index 0409714e8070..829bf3697dc9 100644
@@ -44,7 +44,8 @@
 
  #define HOLLY_PCI_CFG_PHYS 0x7c000000
 
-int holly_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
+static int holly_exclude_device(struct pci_controller *hose, u_char bus,
+				u_char devfn)
  {
  	if (bus == 0 && PCI_SLOT(devfn) == 0)
  		return PCIBIOS_DEVICE_NOT_FOUND;
@@ -187,13 +188,13 @@ static void __init holly_init_IRQ(void)
  	tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
  }
 
-void holly_show_cpuinfo(struct seq_file *m)
+static void holly_show_cpuinfo(struct seq_file *m)
  {
  	seq_printf(m, "vendor\t\t: IBM\n");
  	seq_printf(m, "machine\t\t: PPC750 GX/CL\n");
  }
 
-void __noreturn holly_restart(char *cmd)
+static void __noreturn holly_restart(char *cmd)
  {
  	__be32 __iomem *ocn_bar1 = NULL;
  	unsigned long bar;
@@ -233,18 +234,6 @@ void __noreturn holly_restart(char *cmd)
  	for (;;) ;
  }
 
-void holly_power_off(void)
-{
-	local_irq_disable();
-	/* No way to shut power off with software */
-	for (;;) ;
-}
-
-void holly_halt(void)
-{
-	holly_power_off();
-}
-
  /*
   * Called very early, device-tree isn't unflattened
   */
#2 lore raw
Quoted 9 lines · Christophe Leroy
Quoted 4 lines · Mathieu Malaterre

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since these functions can be made static, make it so. While doing so, it turns out that holly_power_off and holly_halt are unused, so remove them.

Quoted 6 lines

I would have said 'since these functions are only used in this C file, make them static'.

I think this could be split in two patches:
1/ Remove unused functions, ie holly_halt() and holly_power_off(). 2/ Make the other ones static.

Michael do you want two patches ?

Quoted 66 lines

Christophe

Quoted 64 lines

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:47:5: error: no previous prototype for 'holly_exclude_device' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:190:6: error: no previous prototype for 'holly_show_cpuinfo' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:196:17: error: no previous prototype for 'holly_restart' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:236:6: error: no previous prototype for 'holly_power_off' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:243:6: error: no previous prototype for 'holly_halt' [-Werror=missing-prototypes]

---
  arch/powerpc/platforms/embedded6xx/holly.c | 19 ++++---------------
  1 file changed, 4 insertions(+), 15 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +4 -15
index 0409714e8070..829bf3697dc9 100644
@@ -44,7 +44,8 @@
 
  #define HOLLY_PCI_CFG_PHYS 0x7c000000
 
-int holly_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
+static int holly_exclude_device(struct pci_controller *hose, u_char bus,
+                             u_char devfn)
  {
      if (bus == 0 && PCI_SLOT(devfn) == 0)
              return PCIBIOS_DEVICE_NOT_FOUND;
@@ -187,13 +188,13 @@ static void __init holly_init_IRQ(void)
      tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
  }
 
-void holly_show_cpuinfo(struct seq_file *m)
+static void holly_show_cpuinfo(struct seq_file *m)
  {
      seq_printf(m, "vendor\t\t: IBM\n");
      seq_printf(m, "machine\t\t: PPC750 GX/CL\n");
  }
 
-void __noreturn holly_restart(char *cmd)
+static void __noreturn holly_restart(char *cmd)
  {
      __be32 __iomem *ocn_bar1 = NULL;
      unsigned long bar;
@@ -233,18 +234,6 @@ void __noreturn holly_restart(char *cmd)
      for (;;) ;
  }
 
-void holly_power_off(void)
-{
-     local_irq_disable();
-     /* No way to shut power off with software */
-     for (;;) ;
-}
-
-void holly_halt(void)
-{
-     holly_power_off();
-}
-
  /*
   * Called very early, device-tree isn't unflattened
   */
#3 lore raw
Quoted 11 lines · Mathieu Malaterre
Quoted 9 lines · Christophe Leroy
Quoted 4 lines · Mathieu Malaterre

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since these functions can be made static, make it so. While doing so, it turns out that holly_power_off and holly_halt are unused, so remove them.

Quoted 8 lines
Quoted 6 lines

I would have said 'since these functions are only used in this C file, make them static'.

I think this could be split in two patches:
1/ Remove unused functions, ie holly_halt() and holly_power_off(). 2/ Make the other ones static.

Michael do you want two patches ?

That would be better if it's not too much trouble. A patch with a title of "Make some functions static" shouldn't really be deleting functions entirely.

cheers

#4 lore raw

PATCH v2 1/2 powerpc: Make some functions static

In reply to Mathieu Malaterre

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since most of these functions can be made static, make it so.

Both holly_power_off and holly_halt functions were not changed since they are unused, making them static would have triggered the following warning (treated as error):

arch/powerpc/platforms/embedded6xx/holly.c:244:13: error: 'holly_halt' defined but not used [-Werror=unused-function]

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:47:5: error: no previous prototype for 'holly_exclude_device' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:190:6: error: no previous prototype for 'holly_show_cpuinfo' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:196:17: error: no previous prototype for 'holly_restart' [-Werror=missing-prototypes]

---
v2: Split the patch in two operations

 arch/powerpc/platforms/embedded6xx/holly.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +4 -3
index 0409714e8070..9d2eefef7b7b 100644
@@ -44,7 +44,8 @@
 
 #define HOLLY_PCI_CFG_PHYS 0x7c000000
 
-int holly_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
+static int holly_exclude_device(struct pci_controller *hose, u_char bus,
+				u_char devfn)
 {
 	if (bus == 0 && PCI_SLOT(devfn) == 0)
 		return PCIBIOS_DEVICE_NOT_FOUND;
@@ -187,13 +188,13 @@ static void __init holly_init_IRQ(void)
 	tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
 }
 
-void holly_show_cpuinfo(struct seq_file *m)
+static void holly_show_cpuinfo(struct seq_file *m)
 {
 	seq_printf(m, "vendor\t\t: IBM\n");
 	seq_printf(m, "machine\t\t: PPC750 GX/CL\n");
 }
 
-void __noreturn holly_restart(char *cmd)
+static void __noreturn holly_restart(char *cmd)
 {
 	__be32 __iomem *ocn_bar1 = NULL;
 	unsigned long bar;
Signature · 1 line
2.20.1
#5 lore raw

PATCH v2 2/2 Remove functions holly_power_off and holly_halt since unused

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:236:6: error: no previous prototype for 'holly_power_off' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:243:6: error: no previous prototype for 'holly_halt' [-Werror=missing-prototypes]

---
 arch/powerpc/platforms/embedded6xx/holly.c | 12 ------------
 1 file changed, 12 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +0 -12
index 9d2eefef7b7b..829bf3697dc9 100644
@@ -234,18 +234,6 @@ static void __noreturn holly_restart(char *cmd)
 	for (;;) ;
 }
 
-void holly_power_off(void)
-{
-	local_irq_disable();
-	/* No way to shut power off with software */
-	for (;;) ;
-}
-
-void holly_halt(void)
-{
-	holly_power_off();
-}
-
 /*
  * Called very early, device-tree isn't unflattened
  */
Signature · 1 line
2.20.1
Reviewed-by on v2 2/2
#6 lore raw

Re: [PATCH v2 2/2] Remove functions holly_power_off and holly_halt since unused

Quoted 6 lines · Mathieu Malaterre

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:236:6: error: no previous prototype for 'holly_power_off' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:243:6: error: no previous prototype for 'holly_halt' [-Werror=missing-prototypes]

-Mukesh

Quoted 27 lines
---
  arch/powerpc/platforms/embedded6xx/holly.c | 12 ------------
  1 file changed, 12 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +0 -12
index 9d2eefef7b7b..829bf3697dc9 100644
@@ -234,18 +234,6 @@ static void __noreturn holly_restart(char *cmd)
  	for (;;) ;
  }
 
-void holly_power_off(void)
-{
-	local_irq_disable();
-	/* No way to shut power off with software */
-	for (;;) ;
-}
-
-void holly_halt(void)
-{
-	holly_power_off();
-}
-
  /*
   * Called very early, device-tree isn't unflattened
   */
Reviewed-by on v2 1/2
#7 lore raw
In reply to Mathieu Malaterre
Quoted 10 lines · Mathieu Malaterre

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since most of these functions can be made static, make it so.

Both holly_power_off and holly_halt functions were not changed since they are unused, making them static would have triggered the following warning (treated as error):

arch/powerpc/platforms/embedded6xx/holly.c:244:13: error: 'holly_halt' defined but not used [-Werror=unused-function]

Quoted 7 lines

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:47:5: error: no previous prototype for 'holly_exclude_device' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:190:6: error: no previous prototype for 'holly_show_cpuinfo' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:196:17: error: no previous prototype for 'holly_restart' [-Werror=missing-prototypes]

Quoted 36 lines

---
v2: Split the patch in two operations

  arch/powerpc/platforms/embedded6xx/holly.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +4 -3
index 0409714e8070..9d2eefef7b7b 100644
@@ -44,7 +44,8 @@
 
  #define HOLLY_PCI_CFG_PHYS 0x7c000000
 
-int holly_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
+static int holly_exclude_device(struct pci_controller *hose, u_char bus,
+				u_char devfn)
  {
  	if (bus == 0 && PCI_SLOT(devfn) == 0)
  		return PCIBIOS_DEVICE_NOT_FOUND;
@@ -187,13 +188,13 @@ static void __init holly_init_IRQ(void)
  	tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
  }
 
-void holly_show_cpuinfo(struct seq_file *m)
+static void holly_show_cpuinfo(struct seq_file *m)
  {
  	seq_printf(m, "vendor\t\t: IBM\n");
  	seq_printf(m, "machine\t\t: PPC750 GX/CL\n");
  }
 
-void __noreturn holly_restart(char *cmd)
+static void __noreturn holly_restart(char *cmd)
  {
  	__be32 __iomem *ocn_bar1 = NULL;
  	unsigned long bar;
#8 lore raw
In reply to Mathieu Malaterre
Quoted 10 lines · Mathieu Malaterre

In commit cb9e4d10c448 ("[POWERPC] Add support for 750CL Holly board") new functions were added. Since most of these functions can be made static, make it so.

Both holly_power_off and holly_halt functions were not changed since they are unused, making them static would have triggered the following warning (treated as error):

arch/powerpc/platforms/embedded6xx/holly.c:244:13: error: 'holly_halt' defined but not used [-Werror=unused-function]

Quoted 8 lines

Silence the following warnings triggered using W=1:

arch/powerpc/platforms/embedded6xx/holly.c:47:5: error: no previous prototype for 'holly_exclude_device' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:190:6: error: no previous prototype for 'holly_show_cpuinfo' [-Werror=missing-prototypes] arch/powerpc/platforms/embedded6xx/holly.c:196:17: error: no previous prototype for 'holly_restart' [-Werror=missing-prototypes]

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/308be6c7817c850b55c3b6ff4bf53c24

cheers