Edward O'Callaghan has uploaded this change for review.

View Change

tree/: Rename 'laptop_ok-> g_laptop_ok' to avoid shadowing

Avoid global symbol shadowing in local functions.

Change-Id: Idfca0b7e46d8051bf680227250cf40483e19dc53
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M board_enable.c
M chipset_enable.c
M include/programmer.h
M internal.c
4 files changed, 24 insertions(+), 12 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/46/73646/1
diff --git a/board_enable.c b/board_enable.c
index 3e6a5a7..4ea53ec 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2294,7 +2294,7 @@
static int p2_whitelist_laptop(void)
{
is_laptop = 1;
- laptop_ok = true;
+ g_laptop_ok = true;
msg_pdbg("Whitelisted laptop detected.\n");
return 0;
}
diff --git a/chipset_enable.c b/chipset_enable.c
index e1dd6a3..37a48fc 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -826,7 +826,7 @@

/* Suppress unknown laptop warning if we booted from SPI. */
if (boot_buses & BUS_SPI)
- laptop_ok = true;
+ g_laptop_ok = true;

return 0;
}
@@ -971,7 +971,7 @@

/* Suppress unknown laptop warning if we booted from SPI. */
if (!ret && (boot_buses & BUS_SPI))
- laptop_ok = true;
+ g_laptop_ok = true;

_freepci_ret:
pci_free_dev(spi_dev);
@@ -1087,7 +1087,7 @@

/* Suppress unknown laptop warning if we booted from SPI. */
if (boot_buses & BUS_SPI)
- laptop_ok = true;
+ g_laptop_ok = true;

return 0;
}
@@ -1676,7 +1676,7 @@

/* Suppress unknown laptop warning if we booted from SPI. */
if (!ret && want_spi)
- laptop_ok = true;
+ g_laptop_ok = true;

return ret;
}
diff --git a/include/programmer.h b/include/programmer.h
index 9728d8d..9da6165 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -263,7 +263,7 @@

#if CONFIG_INTERNAL == 1
extern int is_laptop;
-extern bool laptop_ok;
+extern bool g_laptop_ok;
extern bool force_boardmismatch;
void probe_superio(void);
int register_superio(struct superio s);
diff --git a/internal.c b/internal.c
index c75b472..0c23326 100644
--- a/internal.c
+++ b/internal.c
@@ -28,7 +28,7 @@
#endif

int is_laptop = 0;
-bool laptop_ok = false;
+bool g_laptop_ok = false;

bool force_boardmismatch = false;

@@ -109,9 +109,9 @@
}

// FIXME: remove '_' suffix from parameters once global shadowing is fixed.
-static void report_nonwl_laptop_detected(int is_laptop_, bool laptop_ok_)
+static void report_nonwl_laptop_detected(int is_laptop_, bool laptop_ok)
{
- if (is_laptop_ && !laptop_ok_) {
+ if (is_laptop_ && !laptop_ok) {
msg_pinfo("========================================================================\n");
if (is_laptop_ == 1) {
msg_pinfo("You seem to be running flashrom on an unknown laptop. Some\n"
@@ -159,7 +159,7 @@
return ret;

/* Unconditionally reset global state from previous operation. */
- laptop_ok = false;
+ g_laptop_ok = false;

/* Default to Parallel/LPC/FWH flash devices. If a known host controller
* is found, the host controller init routine sets the
@@ -229,7 +229,7 @@
* this isn't a laptop. Board-enables may override this,
* non-legacy buses (SPI and opaque atm) are probed anyway.
*/
- if (is_laptop && !(laptop_ok || force_laptop || (not_a_laptop && is_laptop == 2)))
+ if (is_laptop && !(g_laptop_ok || force_laptop || (not_a_laptop && is_laptop == 2)))
internal_buses_supported = BUS_NONE;

/* try to enable it. Failure IS an option, since not all motherboards
@@ -258,7 +258,7 @@
internal_par_init(internal_buses_supported);

/* Report if a non-whitelisted laptop is detected that likely uses a legacy bus. */
- report_nonwl_laptop_detected(is_laptop, laptop_ok);
+ report_nonwl_laptop_detected(is_laptop, g_laptop_ok);

ret = 0;


To view, visit change 73646. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Idfca0b7e46d8051bf680227250cf40483e19dc53
Gerrit-Change-Number: 73646
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange