From 12b0f7746e6ce8c3eeb677e093b756aeb8ede493 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Thu, 18 Jun 2020 15:09:54 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/42514 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh --- src/vendorcode/google/chromeos/elog.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/vendorcode/google') 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__); } } -- cgit v1.2.3