summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2023-05-11 15:38:04 +0200
committerLean Sheng Tan <sheng.tan@9elements.com>2023-05-12 16:19:41 +0000
commit73e6318ec7c043066a6fbbecf36b10afed245644 (patch)
tree5ad228643ba7ff7d0bbefdc915cd7a5d40f2d076
parente0b140627607569ca36da2d8cc7eec15e970bd71 (diff)
downloadcoreboot-73e6318ec7c043066a6fbbecf36b10afed245644.tar.gz
mb/prodrive/hermes: Simplify handling board cfg
The `get_board_settings()` function always returns non-NULL, so there is no need for NULL checks. When only one member is accessed, also drop the local variable and directly dereference the function's return value. Change-Id: I4fc62ca2454f4da7c8ade506064a7b0e6ba48749 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75140 Reviewed-by: Christian Walter <christian.walter@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
-rw-r--r--src/mainboard/prodrive/hermes/hda_verb.c3
-rw-r--r--src/mainboard/prodrive/hermes/mainboard.c32
2 files changed, 7 insertions, 28 deletions
diff --git a/src/mainboard/prodrive/hermes/hda_verb.c b/src/mainboard/prodrive/hermes/hda_verb.c
index 7514ce9711..cab4fd344b 100644
--- a/src/mainboard/prodrive/hermes/hda_verb.c
+++ b/src/mainboard/prodrive/hermes/hda_verb.c
@@ -132,9 +132,6 @@ static void mainboard_r0x_configure_alc888(u8 *base, u32 viddid)
const struct eeprom_board_settings *const board_cfg = get_board_settings();
- if (!board_cfg)
- return;
-
const u32 front_panel_cfg = get_front_panel_cfg(board_cfg->front_panel_audio);
const u32 front_mic_cfg = get_front_mic_cfg(board_cfg->front_panel_audio);
diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c
index 18bd8a48b7..3173522a77 100644
--- a/src/mainboard/prodrive/hermes/mainboard.c
+++ b/src/mainboard/prodrive/hermes/mainboard.c
@@ -146,13 +146,8 @@ static void update_board_layout(void)
static void mainboard_init(void *chip_info)
{
- const struct eeprom_board_settings *const board_cfg = get_board_settings();
-
- if (!board_cfg)
- return;
-
/* Enable internal speaker amplifier */
- if (board_cfg->front_panel_audio == 2)
+ if (get_board_settings()->front_panel_audio == 2)
mb_hda_amp_enable(1);
else
mb_hda_amp_enable(0);
@@ -162,13 +157,8 @@ static void mainboard_final(struct device *dev)
{
update_board_layout();
- const struct eeprom_board_settings *const board_cfg = get_board_settings();
-
- if (!board_cfg)
- return;
-
/* Encoding: 0 -> S0, 1 -> S5 */
- const bool on = !board_cfg->power_state_after_g3;
+ const bool on = !get_board_settings()->power_state_after_g3;
pmc_soc_set_afterg3_en(on);
}
@@ -197,9 +187,6 @@ static void mainboard_acpi_fill_ssdt(const struct device *dev)
{
const struct eeprom_board_settings *const board_cfg = get_board_settings();
- if (!board_cfg)
- return;
-
const unsigned int usb_power_gpios[] = { GPP_G0, GPP_G1, GPP_G2, GPP_G3, GPP_G4 };
/* Function pointer to write STXS or CTXS according to EEPROM board setting */
@@ -292,13 +279,11 @@ static void mainboard_early(void *unused)
const struct eeprom_board_settings *const board_cfg = get_board_settings();
config_t *config = config_of_soc();
- if (board_cfg) {
- /* Set Deep Sx */
- config->deep_s5_enable_ac = board_cfg->deep_sx_enabled;
- config->deep_s5_enable_dc = board_cfg->deep_sx_enabled;
+ /* Set Deep Sx */
+ config->deep_s5_enable_ac = board_cfg->deep_sx_enabled;
+ config->deep_s5_enable_dc = board_cfg->deep_sx_enabled;
- config->disable_vmx = board_cfg->vtx_disabled;
- }
+ config->disable_vmx = board_cfg->vtx_disabled;
if (check_signature(offsetof(struct eeprom_layout, supd), FSPS_UPD_SIGNATURE)) {
struct {
@@ -325,11 +310,8 @@ BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, mainboard_early, NULL);
static void mainboard_configure_internal_gfx(void *unused)
{
struct device *dev;
- const struct eeprom_board_settings *board_cfg = get_board_settings();
- if (!board_cfg)
- return;
- if (board_cfg->primary_video == PRIMARY_VIDEO_INTEL) {
+ if (get_board_settings()->primary_video == PRIMARY_VIDEO_INTEL) {
dev = dev_find_device(PCI_VID_ASPEED, PCI_DID_ASPEED_AST2050_VGA, NULL);
dev->on_mainboard = false;
dev->enabled = false;