Elyes Haouas has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83503?usp=email )
Change subject: azalia: Get rid of "return {-1,0} ......................................................................
azalia: Get rid of "return {-1,0}
Modern C uses {true,false} instead of {-1,0}.
Change-Id: Icea33ea3e6a5e3c7bbfedc29045026cd722ac23e Signed-off-by: Elyes Haouas ehaouas@noos.fr --- M src/device/azalia_device.c M src/include/device/azalia_device.h M src/soc/intel/common/hda_verb.c M src/southbridge/intel/bd82x6x/azalia.c M src/southbridge/intel/i82801gx/azalia.c M src/southbridge/intel/i82801ix/azalia.c M src/southbridge/intel/i82801jx/azalia.c M src/southbridge/intel/ibexpeak/azalia.c M src/southbridge/intel/lynxpoint/hda_verb.c 9 files changed, 24 insertions(+), 25 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/83503/1
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index 4eed489..a7fa79f 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -9,7 +9,7 @@ #include <timer.h> #include <types.h>
-int azalia_set_bits(void *port, u32 mask, u32 val) +bool azalia_set_bits(void *port, u32 mask, u32 val) { struct stopwatch sw; u32 reg32; @@ -32,17 +32,17 @@
/* Timeout occurred */ if (stopwatch_expired(&sw)) - return -1; - return 0; + return false; + return true; }
-int azalia_enter_reset(u8 *base) +bool azalia_enter_reset(u8 *base) { /* Set bit 0 to 0 to enter reset state (BAR + 0x8)[0] */ return azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, 0); }
-int azalia_exit_reset(u8 *base) +bool azalia_exit_reset(u8 *base) { /* Set bit 0 to 1 to exit reset state (BAR + 0x8)[0] */ return azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, HDA_GCTL_CRST); @@ -53,7 +53,7 @@ struct stopwatch sw; u16 reg16;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* @@ -89,10 +89,10 @@ if (stopwatch_expired(&sw)) goto no_codec;
- if (azalia_enter_reset(base) < 0) + if (!azalia_enter_reset(base)) goto no_codec;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Read in Codec location (BAR + 0x0e)[14:0] */ diff --git a/src/include/device/azalia_device.h b/src/include/device/azalia_device.h index 59e7ea2..f870491 100644 --- a/src/include/device/azalia_device.h +++ b/src/include/device/azalia_device.h @@ -20,9 +20,8 @@
#define AZALIA_MAX_CODECS 15
-int azalia_set_bits(void *port, u32 mask, u32 val); -int azalia_enter_reset(u8 *base); -int azalia_exit_reset(u8 *base); +bool azalia_enter_reset(u8 *base); +bool azalia_exit_reset(u8 *base); u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb); int azalia_program_verb_table(u8 *base, const u32 *verbs, u32 verb_size); void azalia_codec_init(u8 *base, int addr, const u32 *verb_table, u32 verb_table_bytes); diff --git a/src/soc/intel/common/hda_verb.c b/src/soc/intel/common/hda_verb.c index dceb031..61c799d 100644 --- a/src/soc/intel/common/hda_verb.c +++ b/src/soc/intel/common/hda_verb.c @@ -13,7 +13,7 @@ u8 reg8;
/* Set Bit 0 to 1 to exit reset state (BAR + 0x8)[0] */ - if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Write back the value once reset bit is set. */ @@ -26,11 +26,11 @@ write8(base + HDA_STATESTS_REG, 0xf);
/* Turn off the link and poll RESET# bit until it reads back as 0 */ - if (azalia_enter_reset(base) < 0) + if (!azalia_enter_reset(base)) goto no_codec;
/* Turn on the link and poll RESET# bit until it reads back as 1 */ - if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0] */ diff --git a/src/southbridge/intel/bd82x6x/azalia.c b/src/southbridge/intel/bd82x6x/azalia.c index ddaa8a1..d4d2e01 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -16,7 +16,7 @@ { u8 reg8;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Write back the value once reset bit is set. */ diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c index 31827e6..0c4e65f 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -16,10 +16,10 @@ { u32 reg32;
- if (azalia_enter_reset(base) < 0) + if (!azalia_enter_reset(base)) goto no_codec;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0] */ diff --git a/src/southbridge/intel/i82801ix/azalia.c b/src/southbridge/intel/i82801ix/azalia.c index fdc9514..3df2bcd 100644 --- a/src/southbridge/intel/i82801ix/azalia.c +++ b/src/southbridge/intel/i82801ix/azalia.c @@ -14,10 +14,10 @@ { u32 reg32;
- if (azalia_enter_reset(base) < 0) + if (!azalia_enter_reset(base)) goto no_codec;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0] */ diff --git a/src/southbridge/intel/i82801jx/azalia.c b/src/southbridge/intel/i82801jx/azalia.c index fa0209a..fdae920 100644 --- a/src/southbridge/intel/i82801jx/azalia.c +++ b/src/southbridge/intel/i82801jx/azalia.c @@ -14,10 +14,10 @@ { u32 reg32;
- if (azalia_enter_reset(base) < 0) + if (!azalia_enter_reset(base)) goto no_codec;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0] */ diff --git a/src/southbridge/intel/ibexpeak/azalia.c b/src/southbridge/intel/ibexpeak/azalia.c index ac950c4..8ca4951 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -14,7 +14,7 @@ { u8 reg8;
- if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Write back the value once reset bit is set. */ diff --git a/src/southbridge/intel/lynxpoint/hda_verb.c b/src/southbridge/intel/lynxpoint/hda_verb.c index 7e9f4d2..18a77ee 100644 --- a/src/southbridge/intel/lynxpoint/hda_verb.c +++ b/src/southbridge/intel/lynxpoint/hda_verb.c @@ -11,7 +11,7 @@ u8 reg8;
/* Set Bit 0 to 1 to exit reset state (BAR + 0x8)[0] */ - if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Write back the value once reset bit is set. */ @@ -24,11 +24,11 @@ write8(base + HDA_STATESTS_REG, 0xf);
/* Turn off the link and poll RESET# bit until it reads back as 0 */ - if (azalia_enter_reset(base) < 0) + if (!azalia_enter_reset(base)) goto no_codec;
/* Turn on the link and poll RESET# bit until it reads back as 1 */ - if (azalia_exit_reset(base) < 0) + if (!azalia_exit_reset(base)) goto no_codec;
/* Read in Codec location (BAR + 0xe)[2..0] */