Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/33747
Change subject: tree: Make internal variables static ......................................................................
tree: Make internal variables static
All these variables are only used in the files they are defined in, so they can be made static.
Change-Id: I1e55138adef540e9d3a2237aa5b289cb338c0608 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M dediprog.c M developerbox_spi.c M dummyflasher.c M gfxnvidia.c M it85spi.c M layout.c M mcp6x_spi.c M nicintel.c M nicintel_spi.c M satamv.c 10 files changed, 18 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/47/33747/1
diff --git a/dediprog.c b/dediprog.c index 8029b64..5af1eec 100644 --- a/dediprog.c +++ b/dediprog.c @@ -43,7 +43,7 @@ #define REQTYPE_OTHER_IN (LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_OTHER) /* 0xC3 */ #define REQTYPE_EP_OUT (LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_ENDPOINT) /* 0x42 */ #define REQTYPE_EP_IN (LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_ENDPOINT) /* 0xC2 */ -struct libusb_context *usb_ctx; +static struct libusb_context *usb_ctx; static libusb_device_handle *dediprog_handle; static int dediprog_in_endpoint; static int dediprog_out_endpoint; @@ -159,7 +159,7 @@ };
static int dediprog_firmwareversion = FIRMWARE_VERSION(0, 0, 0); -enum dediprog_devtype dediprog_devicetype = DEV_UNKNOWN; +static enum dediprog_devtype dediprog_devicetype = DEV_UNKNOWN;
#if defined(LIBUSB_MAJOR) && defined(LIBUSB_MINOR) && defined(LIBUSB_MICRO) && \ LIBUSB_MAJOR <= 1 && LIBUSB_MINOR == 0 && LIBUSB_MICRO < 9 diff --git a/developerbox_spi.c b/developerbox_spi.c index c80a794..4ff2fb6 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -60,7 +60,7 @@ {0}, };
-struct libusb_context *usb_ctx; +static struct libusb_context *usb_ctx; static libusb_device_handle *cp210x_handle;
static int cp210x_gpio_get(void) diff --git a/dummyflasher.c b/dummyflasher.c index 22b28c4..2ff9898 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -56,10 +56,10 @@ static unsigned int emu_jedec_be_d8_size = 0; static unsigned int emu_jedec_ce_60_size = 0; static unsigned int emu_jedec_ce_c7_size = 0; -unsigned char spi_blacklist[256]; -unsigned char spi_ignorelist[256]; -int spi_blacklist_size = 0; -int spi_ignorelist_size = 0; +static unsigned char spi_blacklist[256]; +static unsigned char spi_ignorelist[256]; +static int spi_blacklist_size = 0; +static int spi_ignorelist_size = 0; static uint8_t emu_status = 0;
/* A legit complete SFDP table based on the MX25L6436E (rev. 1.8) datasheet. */ @@ -129,7 +129,7 @@ .chip_writen = dummy_chip_writen, };
-enum chipbustype dummy_buses_supported = BUS_NONE; +static enum chipbustype dummy_buses_supported = BUS_NONE;
static int dummy_shutdown(void *data) { diff --git a/gfxnvidia.c b/gfxnvidia.c index c6d752e..d8ea4d6 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -28,7 +28,7 @@ #define GFXNVIDIA_MEMMAP_MASK ((1 << 17) - 1) #define GFXNVIDIA_MEMMAP_SIZE (16 * 1024 * 1024)
-uint8_t *nvidia_bar; +static uint8_t *nvidia_bar;
const struct dev_entry gfx_nvidia[] = { {0x10de, 0x0010, NT, "NVIDIA", "Mutara V08 [NV2]" }, diff --git a/it85spi.c b/it85spi.c index 1d1ecad..3dbba78 100644 --- a/it85spi.c +++ b/it85spi.c @@ -74,9 +74,9 @@ #endif /* LPC_IO */
#ifdef LPC_IO -unsigned int shm_io_base; +static unsigned int shm_io_base; #endif -unsigned char *ce_high, *ce_low; +static unsigned char *ce_high, *ce_low; static int it85xx_scratch_rom_reenter = 0;
/* This function will poll the keyboard status register until either diff --git a/layout.c b/layout.c index e49189e..6e476c2 100644 --- a/layout.c +++ b/layout.c @@ -24,7 +24,7 @@ #include "programmer.h" #include "layout.h"
-struct romentry entries[MAX_ROMLAYOUT]; +static struct romentry entries[MAX_ROMLAYOUT]; static struct flashrom_layout global_layout = { entries, 0 };
struct flashrom_layout *get_global_layout(void) diff --git a/mcp6x_spi.c b/mcp6x_spi.c index f369277..b53d07b 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -36,7 +36,7 @@ #define MCP6X_SPI_REQUEST 0 #define MCP6X_SPI_GRANT 8
-void *mcp6x_spibar = NULL; +static void *mcp6x_spibar = NULL;
/* Cached value of last GPIO state. */ static uint8_t mcp_gpiostate; diff --git a/nicintel.c b/nicintel.c index a4424e7..4672890 100644 --- a/nicintel.c +++ b/nicintel.c @@ -20,8 +20,8 @@ #include "programmer.h" #include "hwaccess.h"
-uint8_t *nicintel_bar; -uint8_t *nicintel_control_bar; +static uint8_t *nicintel_bar; +static uint8_t *nicintel_control_bar;
const struct dev_entry nics_intel[] = { {PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"}, diff --git a/nicintel_spi.c b/nicintel_spi.c index bdb70a7..1173ef7 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -75,7 +75,7 @@
#define BIT(x) (1<<(x))
-uint8_t *nicintel_spibar; +static uint8_t *nicintel_spibar;
const struct dev_entry nics_intel_spi[] = { {PCI_VENDOR_ID_INTEL, 0x105e, OK, "Intel", "82571EB Gigabit Ethernet Controller"}, diff --git a/satamv.c b/satamv.c index 1d3734a..31265ea 100644 --- a/satamv.c +++ b/satamv.c @@ -22,8 +22,8 @@ #include "programmer.h" #include "hwaccess.h"
-uint8_t *mv_bar; -uint16_t mv_iobar; +static uint8_t *mv_bar; +static uint16_t mv_iobar;
const struct dev_entry satas_mv[] = { /* 88SX6041 and 88SX6042 are the same according to the datasheet. */
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/33747 )
Change subject: tree: Make internal variables static ......................................................................
Patch Set 1:
These were caught using -Wmissing-variable-declarations in Clang. Sadly GCC doesn't have an equivalent warning.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/33747 )
Change subject: tree: Make internal variables static ......................................................................
Patch Set 1: Code-Review+2
Nico Huber has submitted this change and it was merged. ( https://review.coreboot.org/c/flashrom/+/33747 )
Change subject: tree: Make internal variables static ......................................................................
tree: Make internal variables static
All these variables are only used in the files they are defined in, so they can be made static.
Change-Id: I1e55138adef540e9d3a2237aa5b289cb338c0608 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Reviewed-on: https://review.coreboot.org/c/flashrom/+/33747 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de --- M dediprog.c M developerbox_spi.c M dummyflasher.c M gfxnvidia.c M it85spi.c M layout.c M mcp6x_spi.c M nicintel.c M nicintel_spi.c M satamv.c 10 files changed, 18 insertions(+), 18 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/dediprog.c b/dediprog.c index 8029b64..5af1eec 100644 --- a/dediprog.c +++ b/dediprog.c @@ -43,7 +43,7 @@ #define REQTYPE_OTHER_IN (LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_OTHER) /* 0xC3 */ #define REQTYPE_EP_OUT (LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_ENDPOINT) /* 0x42 */ #define REQTYPE_EP_IN (LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_ENDPOINT) /* 0xC2 */ -struct libusb_context *usb_ctx; +static struct libusb_context *usb_ctx; static libusb_device_handle *dediprog_handle; static int dediprog_in_endpoint; static int dediprog_out_endpoint; @@ -159,7 +159,7 @@ };
static int dediprog_firmwareversion = FIRMWARE_VERSION(0, 0, 0); -enum dediprog_devtype dediprog_devicetype = DEV_UNKNOWN; +static enum dediprog_devtype dediprog_devicetype = DEV_UNKNOWN;
#if defined(LIBUSB_MAJOR) && defined(LIBUSB_MINOR) && defined(LIBUSB_MICRO) && \ LIBUSB_MAJOR <= 1 && LIBUSB_MINOR == 0 && LIBUSB_MICRO < 9 diff --git a/developerbox_spi.c b/developerbox_spi.c index c80a794..4ff2fb6 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -60,7 +60,7 @@ {0}, };
-struct libusb_context *usb_ctx; +static struct libusb_context *usb_ctx; static libusb_device_handle *cp210x_handle;
static int cp210x_gpio_get(void) diff --git a/dummyflasher.c b/dummyflasher.c index 22b28c4..2ff9898 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -56,10 +56,10 @@ static unsigned int emu_jedec_be_d8_size = 0; static unsigned int emu_jedec_ce_60_size = 0; static unsigned int emu_jedec_ce_c7_size = 0; -unsigned char spi_blacklist[256]; -unsigned char spi_ignorelist[256]; -int spi_blacklist_size = 0; -int spi_ignorelist_size = 0; +static unsigned char spi_blacklist[256]; +static unsigned char spi_ignorelist[256]; +static int spi_blacklist_size = 0; +static int spi_ignorelist_size = 0; static uint8_t emu_status = 0;
/* A legit complete SFDP table based on the MX25L6436E (rev. 1.8) datasheet. */ @@ -129,7 +129,7 @@ .chip_writen = dummy_chip_writen, };
-enum chipbustype dummy_buses_supported = BUS_NONE; +static enum chipbustype dummy_buses_supported = BUS_NONE;
static int dummy_shutdown(void *data) { diff --git a/gfxnvidia.c b/gfxnvidia.c index c6d752e..d8ea4d6 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -28,7 +28,7 @@ #define GFXNVIDIA_MEMMAP_MASK ((1 << 17) - 1) #define GFXNVIDIA_MEMMAP_SIZE (16 * 1024 * 1024)
-uint8_t *nvidia_bar; +static uint8_t *nvidia_bar;
const struct dev_entry gfx_nvidia[] = { {0x10de, 0x0010, NT, "NVIDIA", "Mutara V08 [NV2]" }, diff --git a/it85spi.c b/it85spi.c index 1d1ecad..3dbba78 100644 --- a/it85spi.c +++ b/it85spi.c @@ -74,9 +74,9 @@ #endif /* LPC_IO */
#ifdef LPC_IO -unsigned int shm_io_base; +static unsigned int shm_io_base; #endif -unsigned char *ce_high, *ce_low; +static unsigned char *ce_high, *ce_low; static int it85xx_scratch_rom_reenter = 0;
/* This function will poll the keyboard status register until either diff --git a/layout.c b/layout.c index e49189e..6e476c2 100644 --- a/layout.c +++ b/layout.c @@ -24,7 +24,7 @@ #include "programmer.h" #include "layout.h"
-struct romentry entries[MAX_ROMLAYOUT]; +static struct romentry entries[MAX_ROMLAYOUT]; static struct flashrom_layout global_layout = { entries, 0 };
struct flashrom_layout *get_global_layout(void) diff --git a/mcp6x_spi.c b/mcp6x_spi.c index f369277..b53d07b 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -36,7 +36,7 @@ #define MCP6X_SPI_REQUEST 0 #define MCP6X_SPI_GRANT 8
-void *mcp6x_spibar = NULL; +static void *mcp6x_spibar = NULL;
/* Cached value of last GPIO state. */ static uint8_t mcp_gpiostate; diff --git a/nicintel.c b/nicintel.c index a4424e7..4672890 100644 --- a/nicintel.c +++ b/nicintel.c @@ -20,8 +20,8 @@ #include "programmer.h" #include "hwaccess.h"
-uint8_t *nicintel_bar; -uint8_t *nicintel_control_bar; +static uint8_t *nicintel_bar; +static uint8_t *nicintel_control_bar;
const struct dev_entry nics_intel[] = { {PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"}, diff --git a/nicintel_spi.c b/nicintel_spi.c index bdb70a7..1173ef7 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -75,7 +75,7 @@
#define BIT(x) (1<<(x))
-uint8_t *nicintel_spibar; +static uint8_t *nicintel_spibar;
const struct dev_entry nics_intel_spi[] = { {PCI_VENDOR_ID_INTEL, 0x105e, OK, "Intel", "82571EB Gigabit Ethernet Controller"}, diff --git a/satamv.c b/satamv.c index 1d3734a..31265ea 100644 --- a/satamv.c +++ b/satamv.c @@ -22,8 +22,8 @@ #include "programmer.h" #include "hwaccess.h"
-uint8_t *mv_bar; -uint16_t mv_iobar; +static uint8_t *mv_bar; +static uint16_t mv_iobar;
const struct dev_entry satas_mv[] = { /* 88SX6041 and 88SX6042 are the same according to the datasheet. */