summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2020-06-18 15:09:54 +0200
committerAngel Pons <th3fanbus@gmail.com>2020-06-20 21:35:34 +0000
commit12b0f7746e6ce8c3eeb677e093b756aeb8ede493 (patch)
tree312c6aa32efcbb4d4a7503ff700e8caf113630d5
parenteb3ae1a202a31ea12021df30a03e718000b39e5e (diff)
vc/google/chromeos/elog.c: Clean up code
Constify local variables and drop redundant logic, while preserving the original behavior. While we are at it, also reflow print statements. Change-Id: Id024f3ac717dad98c4287add9b33defde7a0028d Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
-rw-r--r--src/vendorcode/google/chromeos/elog.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/vendorcode/google/chromeos/elog.c b/src/vendorcode/google/chromeos/elog.c
index 4dd8b193e8..523b7c46eb 100644
--- a/src/vendorcode/google/chromeos/elog.c
+++ b/src/vendorcode/google/chromeos/elog.c
@@ -8,32 +8,21 @@
static void elog_add_boot_reason(void *unused)
{
- int rec = vboot_recovery_mode_enabled();
- int dev = vboot_developer_mode_enabled();
-
- if (!rec && !dev)
- return;
+ const int rec = vboot_recovery_mode_enabled();
+ const int dev = vboot_developer_mode_enabled();
if (rec) {
- u8 reason = vboot_check_recovery_request();
+ const u8 reason = vboot_check_recovery_request();
elog_add_event_byte(ELOG_TYPE_CROS_RECOVERY_MODE, reason);
- printk(BIOS_DEBUG, "%s: Logged recovery mode boot%s, "
- "reason: 0x%02x\n", __func__,
- dev ? " (Dev-switch on)" : "", reason);
+ printk(BIOS_DEBUG, "%s: Logged recovery mode boot%s, reason: 0x%02x\n",
+ __func__, dev ? " (Dev-switch on)" : "", reason);
}
- if (dev) {
- int log_event = 1;
-
- /* Skip logging developer mode in ACPI resume path */
- if (acpi_is_wakeup())
- log_event = 0;
+ /* Skip logging developer mode in ACPI resume path */
+ if (dev && !acpi_is_wakeup()) {
- if (log_event) {
- elog_add_event(ELOG_TYPE_CROS_DEVELOPER_MODE);
- printk(BIOS_DEBUG, "%s: Logged dev mode boot\n",
- __func__);
- }
+ elog_add_event(ELOG_TYPE_CROS_DEVELOPER_MODE);
+ printk(BIOS_DEBUG, "%s: Logged dev mode boot\n", __func__);
}
}