[rtems commit] bsps/sparc: Make local functions static.

Joel Sherrill joel at rtems.org
Fri Mar 21 15:14:53 UTC 2014


Module:    rtems
Branch:    master
Commit:    a46e02c7eabc58cb61eebe94d3a69def5f4edb2a
Changeset: http://git.rtems.org/rtems/commit/?id=a46e02c7eabc58cb61eebe94d3a69def5f4edb2a

Author:    Daniel Cederman <cederman at gaisler.com>
Date:      Thu Mar 13 14:33:00 2014 +0100

bsps/sparc: Make local functions static.

The PCI and RASTA versions of the uart, spacewire and 1553 drivers directly includes the c-file of the standard versions
of the drivers, but uses a macro to change the name of the driver register function. When the standard version is
used this function should be global, when it is included as part of the PCI and RASTA versions it should be local and
static.

---

 c/src/lib/libbsp/sparc/leon2/pci/pci.c            |    4 ++--
 c/src/lib/libbsp/sparc/leon3/pci/pci.c            |    4 ++--
 c/src/lib/libbsp/sparc/shared/1553/b1553brm.c     |    5 +++++
 c/src/lib/libbsp/sparc/shared/1553/b1553brm_pci.c |    3 +++
 c/src/lib/libbsp/sparc/shared/can/occan_pci.c     |    2 ++
 c/src/lib/libbsp/sparc/shared/spw/grspw.c         |    5 +++++
 c/src/lib/libbsp/sparc/shared/spw/grspw_pci.c     |    5 +++++
 c/src/lib/libbsp/sparc/shared/uart/apbuart.c      |    5 +++++
 c/src/lib/libbsp/sparc/shared/uart/apbuart_pci.c  |    3 +++
 9 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/leon2/pci/pci.c b/c/src/lib/libbsp/sparc/leon2/pci/pci.c
index fa904c5..fcc63df 100644
--- a/c/src/lib/libbsp/sparc/leon2/pci/pci.c
+++ b/c/src/lib/libbsp/sparc/leon2/pci/pci.c
@@ -231,7 +231,7 @@ rtems_pci_config_t BSP_pci_configuration = {
 };
 
 
-void init_at697_pci(void) {
+static void init_at697_pci(void) {
 
     /* Reset */
     pcic->pciic = 0xffffffff;
@@ -418,7 +418,7 @@ static inline void swap_res(struct pci_res **p1, struct pci_res **p2) {
  *
  *
 */
-void pci_allocate_resources(void) {
+static void pci_allocate_resources(void) {
 
     unsigned int slot, numfuncs, func, id, pos, size, tmp, i, swapped, addr, dev, fn;
     unsigned char header;
diff --git a/c/src/lib/libbsp/sparc/leon3/pci/pci.c b/c/src/lib/libbsp/sparc/leon3/pci/pci.c
index 5ae63ef..b36b026 100644
--- a/c/src/lib/libbsp/sparc/leon3/pci/pci.c
+++ b/c/src/lib/libbsp/sparc/leon3/pci/pci.c
@@ -223,7 +223,7 @@ rtems_pci_config_t BSP_pci_configuration = {
 };
 
 
-int init_grpci(void) {
+static int init_grpci(void) {
 
     volatile unsigned int *page0 =  (unsigned volatile int *) PCI_MEM_START;
     uint32_t data;
@@ -333,7 +333,7 @@ static inline void swap_res(struct pci_res **p1, struct pci_res **p2) {
  *
  *
 */
-void pci_allocate_resources(void) {
+static void pci_allocate_resources(void) {
 
     unsigned int slot, numfuncs, func, pos, i, swapped, addr, dev, fn;
     uint32_t id, tmp, size;
diff --git a/c/src/lib/libbsp/sparc/shared/1553/b1553brm.c b/c/src/lib/libbsp/sparc/shared/1553/b1553brm.c
index c156222..045146a 100644
--- a/c/src/lib/libbsp/sparc/shared/1553/b1553brm.c
+++ b/c/src/lib/libbsp/sparc/shared/1553/b1553brm.c
@@ -30,6 +30,8 @@
 
 #ifndef B1553BRM_PREFIX
  #define B1553BRM_PREFIX(name) b1553brm##name
+#else
+ #define B1553BRM_REGISTER_STATIC
 #endif
 
 /* default to no translation */
@@ -340,6 +342,9 @@ int brm_register_leon3_ramon_asic(void){
 #endif
 #endif
 
+#ifdef B1553BRM_REGISTER_STATIC
+static
+#endif
 int B1553BRM_PREFIX(_register)(struct ambapp_bus *bus, unsigned int clksel, unsigned int clkdiv, unsigned int brm_freq)
 {
     rtems_status_code r;
diff --git a/c/src/lib/libbsp/sparc/shared/1553/b1553brm_pci.c b/c/src/lib/libbsp/sparc/shared/1553/b1553brm_pci.c
index 3be26b1..2ae4af5 100644
--- a/c/src/lib/libbsp/sparc/shared/1553/b1553brm_pci.c
+++ b/c/src/lib/libbsp/sparc/shared/1553/b1553brm_pci.c
@@ -1,3 +1,6 @@
+#include <ambapp.h>
+#include <b1553brm_pci.h>
+
 /* Select PCI driver */
 #define B1553BRM_NO_AMBA
 #define B1553BRM_PCI
diff --git a/c/src/lib/libbsp/sparc/shared/can/occan_pci.c b/c/src/lib/libbsp/sparc/shared/can/occan_pci.c
index a1fecc5..12273c9 100644
--- a/c/src/lib/libbsp/sparc/shared/can/occan_pci.c
+++ b/c/src/lib/libbsp/sparc/shared/can/occan_pci.c
@@ -3,6 +3,8 @@
  */
 #define OCCAN_WORD_REGS
 
+#include <occan_pci.h>
+
 /* Set registered device name */
 #define OCCAN_DEVNAME "/dev/occanpci0"
 #define OCCAN_DEVNAME_NO(devstr,no) ((devstr)[13]='0'+(no))
diff --git a/c/src/lib/libbsp/sparc/shared/spw/grspw.c b/c/src/lib/libbsp/sparc/shared/spw/grspw.c
index 538e8bb..b311500 100644
--- a/c/src/lib/libbsp/sparc/shared/spw/grspw.c
+++ b/c/src/lib/libbsp/sparc/shared/spw/grspw.c
@@ -58,6 +58,8 @@
 
 #ifndef GRSPW_PREFIX
  #define GRSPW_PREFIX(name) grspw##name
+#else
+ #define GRSPW_REGISTER_STATIC
 #endif
 
 /* default to no translation */
@@ -373,6 +375,9 @@ static rtems_device_driver grspw_control(
 static rtems_driver_address_table grspw_driver = GRSPW_DRIVER_TABLE_ENTRY;
 static struct ambapp_bus *amba_bus;
 
+#ifdef GRSPW_REGISTER_STATIC
+static
+#endif
 int GRSPW_PREFIX(_register)(struct ambapp_bus *bus)
 {
         rtems_status_code r;
diff --git a/c/src/lib/libbsp/sparc/shared/spw/grspw_pci.c b/c/src/lib/libbsp/sparc/shared/spw/grspw_pci.c
index 2a9a8d6..fce2fa8 100644
--- a/c/src/lib/libbsp/sparc/shared/spw/grspw_pci.c
+++ b/c/src/lib/libbsp/sparc/shared/spw/grspw_pci.c
@@ -1,3 +1,7 @@
+#include <ambapp.h>
+#include <rtems/libio.h>
+#include <grspw_pci.h>
+
 /* Select PCI driver */
 #define GRSPW_PCI
 
@@ -70,6 +74,7 @@ static inline unsigned int hw_to_cpu(unsigned int addr) {
 #endif
 
 int grspwpci_interrupt_handler(int irq, void *arg);
+
 #include "grspw.c"
 
 /*
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart.c
index fe6ea3b..e64784f 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart.c
@@ -34,6 +34,8 @@
 
 #ifndef APBUART_PREFIX
  #define APBUART_PREFIX(name) apbuart##name
+#else
+ #define APBUART_REGISTER_STATIC
 #endif
 
 #if !defined(APBUART_DEVNAME) || !defined(APBUART_DEVNAME_NO)
@@ -323,6 +325,9 @@ static void apbuart_interrupt(apbuart_priv *uart){
 	}
 }
 
+#ifdef APBUART_REGISTER_STATIC
+static
+#endif
 int APBUART_PREFIX(_register)(struct ambapp_bus *bus) {
 	rtems_status_code r;
 	rtems_device_major_number m;
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_pci.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_pci.c
index 63cac35..9ea3967 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_pci.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_pci.c
@@ -1,3 +1,6 @@
+#include <ambapp.h>
+#include <apbuart_pci.h>
+
 #undef DEBUG
 
 /* Set registered device name */




More information about the vc mailing list