diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-02-07 17:01:28 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-02-12 18:21:55 -0800 |
commit | 6605e420d7ef98c942a5fba3a8974296b0aecfe1 (patch) | |
tree | 07499617fba2f610280225ec6de78ae9b00f7f69 | |
parent | 3d9ae2bc502c062174c323b7fdebea8b98a313be (diff) | |
download | chrome-ec-6605e420d7ef98c942a5fba3a8974296b0aecfe1.tar.gz |
USB-PD: Make pd_build_request return void
pd_build_request always returns EC_SUCCESS.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=none
BRANCH=none
TEST=buildall
Change-Id: Iae826382134a97ba05f930245d4bfd85ebd76528
Reviewed-on: https://chromium-review.googlesource.com/1459823
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | common/usb_pd_policy.c | 5 | ||||
-rw-r--r-- | common/usb_pd_protocol.c | 13 | ||||
-rw-r--r-- | include/usb_pd.h | 5 |
3 files changed, 7 insertions, 16 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 25949289ee..1062719d22 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -171,8 +171,8 @@ void pd_extract_pdo_power(uint32_t pdo, uint32_t *ma, uint32_t *mv) *ma = MIN(max_ma, PD_MAX_CURRENT_MA); } -int pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv, - enum pd_request_type req_type) +void pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv, + enum pd_request_type req_type) { uint32_t pdo; int pdo_index, flags = 0; @@ -225,7 +225,6 @@ int pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv, } else { *rdo = RDO_FIXED(pdo_index + 1, *ma, max_or_min_ma, flags); } - return EC_SUCCESS; } void pd_process_source_cap(int port, int cnt, uint32_t *src_caps) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index a22d22fd4f..09afa57c7c 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1357,16 +1357,9 @@ static int pd_send_request_msg(int port, int always_send_request) * If this port is not actively charging or we are not allowed to * request the max voltage, then select vSafe5V */ - res = pd_build_request(port, &rdo, &curr_limit, &supply_voltage, - charging && max_request_allowed ? - PD_REQUEST_MAX : PD_REQUEST_VSAFE5V); - - if (res != EC_SUCCESS) - /* - * If fail to choose voltage, do nothing, let source re-send - * source cap - */ - return -1; + pd_build_request(port, &rdo, &curr_limit, &supply_voltage, + charging && max_request_allowed ? + PD_REQUEST_MAX : PD_REQUEST_VSAFE5V); if (!always_send_request) { /* Don't re-request the same voltage */ diff --git a/include/usb_pd.h b/include/usb_pd.h index 5ae89696dd..7cc1a58021 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -1041,10 +1041,9 @@ int pd_get_vdo_ver(int port); * @param ma selected current limit (stored on success) * @param mv selected supply voltage (stored on success) * @param req_type request type - * @return <0 if invalid, else EC_SUCCESS */ -int pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv, - enum pd_request_type req_type); +void pd_build_request(int port, uint32_t *rdo, uint32_t *ma, uint32_t *mv, + enum pd_request_type req_type); /** * Check if max voltage request is allowed (only used if |