summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-09-10 12:57:54 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-09-13 18:58:39 -0700
commit7f450285ef998ca7c9a268b76fdc10914e2ee6ab (patch)
tree7071f1e80684ff819b653cd2873b6210ef38e938
parent675087c355ac85a7a82d20e2244822ff786aa4ae (diff)
downloadchrome-ec-7f450285ef998ca7c9a268b76fdc10914e2ee6ab.tar.gz
charge_manager: Use enum for CHARGE_SUPPLIER_NONE
Currently, CHARGE_SUPPLIER_NONE is defined as a macro. This causes the compiler to allocate uint8_t to enum charge_supplier. When -1 passed to or returned from a function, it's cast to 0xff. This patch defines CHARGE_SUPPLIER_NONE in enum charge_supplier. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify ectool usbpdpower 1 return 'Port 1: Disconnected' and 'Port 1: SNK (not charging)' without and with a BJ adapter connected respectively on Fizz. Change-Id: I31bfa33efa91f60c6667f3b0de9cbdf9c6b3e8bf Reviewed-on: https://chromium-review.googlesource.com/1217605 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--include/charge_manager.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/charge_manager.h b/include/charge_manager.h
index e3e42b5f22..17b649052b 100644
--- a/include/charge_manager.h
+++ b/include/charge_manager.h
@@ -9,7 +9,6 @@
#include "common.h"
/* Charge port that indicates no active port */
-#define CHARGE_SUPPLIER_NONE -1
#define CHARGE_PORT_NONE -1
#define CHARGE_CEIL_NONE -1
@@ -31,6 +30,7 @@ defined(TEST_BUILD)
/* Commonly-used charge suppliers listed in no particular order */
enum charge_supplier {
+ CHARGE_SUPPLIER_NONE = -1,
CHARGE_SUPPLIER_PD,
CHARGE_SUPPLIER_TYPEC,
CHARGE_SUPPLIER_TYPEC_DTS,