diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-07-17 10:57:54 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-19 20:38:37 +0000 |
commit | 1f7ab338b10d65ddaf05d1b4650270d10580a932 (patch) | |
tree | f17c9418004809a96996f12d9c66a378299d631f /include/gpio.h | |
parent | 86192137049c269838241acc5dd5a2a41e5b71af (diff) | |
download | chrome-ec-1f7ab338b10d65ddaf05d1b4650270d10580a932.tar.gz |
cleanup: GPIO: Use common macro for converting mask to GPIO
The same calculation is used across the code, so move it to a common
macro.
BUG=chrome-os-partner:42104
TEST=Verify Glados still boots AP.
BRANCH=None
Change-Id: I90da348f37fc670971737cfc5ddcfb9c34096c4b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/286169
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index 8734ea88e8..1374e85981 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -46,6 +46,9 @@ #define GPIO_INT_ANY (GPIO_INT_BOTH | GPIO_INT_LEVEL) #define GPIO_INT_BOTH_DSLEEP (GPIO_INT_BOTH | GPIO_INT_DSLEEP) +/* Convert GPIO mask to GPIO number / index. */ +#define GPIO_MASK_TO_NUM(mask) (31 - __builtin_clz(mask)) + /* NOTE: This is normally included from board.h, thru config.h and common.h But, * some boards and unit tests don't have a gpio_signal enum defined, so we * define an emtpy one here.*/ |