ppc: Fix return values of ppc_is_* to be boolean

The return values for ppc_is_sourcing_vbus(), ppc_is_port_latched_off(),
ppc_is_vbus_present() are boolean, so EC_ERROR_UNIMPLEMENTED and
EC_ERROR_INVAL cannot be returned.

BUG=none
BRANCH=none
TEST=none

Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: Ic56fd5ac75e5f0ad6e21c803feb929983f08aaf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290664
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
This commit is contained in:
Edward Hill 2020-07-09 19:33:05 -06:00 committed by Commit Bot
parent dccc9023fa
commit ce32396e6c
2 changed files with 9 additions and 9 deletions

View File

@ -125,12 +125,12 @@ int ppc_clear_oc_event_counter(int port)
int ppc_is_sourcing_vbus(int port)
{
int rv = EC_ERROR_UNIMPLEMENTED;
int rv = 0;
const struct ppc_config_t *ppc;
if ((port < 0) || (port >= ppc_cnt)) {
CPRINTS("%s(%d) Invalid port!", __func__, port);
return EC_ERROR_INVAL;
return 0;
}
ppc = &ppc_chips[port];
@ -197,7 +197,7 @@ int ppc_is_port_latched_off(int port)
{
if ((port < 0) || (port >= ppc_cnt)) {
CPRINTS("%s(%d) Invalid port!", __func__, port);
return EC_ERROR_INVAL;
return 0;
}
return oc_event_cnt_tbl[port] >= PPC_OC_CNT_THRESH;
@ -346,12 +346,12 @@ int ppc_set_frs_enable(int port, int enable)
#ifdef CONFIG_USB_PD_VBUS_DETECT_PPC
int ppc_is_vbus_present(int port)
{
int rv = EC_ERROR_UNIMPLEMENTED;
int rv = 0;
const struct ppc_config_t *ppc;
if ((port < 0) || (port >= ppc_cnt)) {
CPRINTS("%s(%d) Invalid port!", __func__, port);
return EC_ERROR_INVAL;
return 0;
}
ppc = &ppc_chips[port];

View File

@ -56,9 +56,9 @@ static int test_ppc_is_sourcing_vbus(void)
int rv;
rv = ppc_is_sourcing_vbus(1);
TEST_ASSERT(rv == EC_ERROR_INVAL);
TEST_ASSERT(rv == 0);
rv = ppc_is_sourcing_vbus(0);
TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED);
TEST_ASSERT(rv == 0);
return EC_SUCCESS;
}
@ -164,9 +164,9 @@ static int test_ppc_is_vbus_present(void)
int rv;
rv = ppc_is_vbus_present(1);
TEST_ASSERT(rv == EC_ERROR_INVAL);
TEST_ASSERT(rv == 0);
rv = ppc_is_vbus_present(0);
TEST_ASSERT(rv == EC_ERROR_UNIMPLEMENTED);
TEST_ASSERT(rv == 0);
return EC_SUCCESS;
}