diff options
author | Jett Rink <jettrink@chromium.org> | 2019-10-17 07:52:12 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-24 00:44:34 +0000 |
commit | 5f683e3de7f605302ec8af791044cff23b0920ee (patch) | |
tree | 13a8448ab03f8ccf31bff8519ecd2dc377854391 /common/usbc/usb_tc_vpd_sm.c | |
parent | cb2fa8b437cb14e652f0e6374d3caf8e568a04ac (diff) | |
download | chrome-ec-5f683e3de7f605302ec8af791044cff23b0920ee.tar.gz |
cleanup: use power and data role enums instead of int
Use first class enums types instead of int for power and data
role.
BRANCH=none
BUG=none
TEST=builds and new stack works with single charger on C1 hatch
Change-Id: Ied4562e6a148803140cf277bd229b6c3ed801470
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865985
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/usbc/usb_tc_vpd_sm.c')
-rw-r--r-- | common/usbc/usb_tc_vpd_sm.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/usbc/usb_tc_vpd_sm.c b/common/usbc/usb_tc_vpd_sm.c index 92ce580c53..cb30093be3 100644 --- a/common/usbc/usb_tc_vpd_sm.c +++ b/common/usbc/usb_tc_vpd_sm.c @@ -34,9 +34,9 @@ static struct type_c { /* state machine context */ struct sm_ctx ctx; /* current port power role (VPD, SOURCE or SINK) */ - uint8_t power_role; + enum pd_power_role power_role; /* current port data role (DFP or UFP) */ - uint8_t data_role; + enum pd_data_role data_role; /* Higher-level power deliver state machines are enabled if true. */ uint8_t pd_enable; /* port flags, see TC_FLAGS_* */ @@ -99,12 +99,12 @@ void tc_state_init(int port) } -int tc_get_power_role(int port) +enum pd_power_role tc_get_power_role(int port) { return tc[port].power_role; } -int tc_get_data_role(int port) +enum pd_data_role tc_get_data_role(int port) { return tc[port].data_role; } @@ -120,7 +120,7 @@ uint8_t tc_get_pd_enabled(int port) return tc[port].pd_enable; } -void tc_set_power_role(int port, int role) +void tc_set_power_role(int port, enum pd_power_role role) { tc[port].power_role = role; } |