From 3c7051cd6849e7d505145535055ba4089f3c73b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Barna=C5=9B?= Date: Thu, 28 Oct 2021 13:36:24 +0200 Subject: ioex: add error message if driver doesn't support get_port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If support for ioex get_port was enabled and driver doesn't support it, there will be a compilation error. The get_port function is required for zephyr ioex implementation. BRANCH=main BUG=b:202701452 TEST=enable any driver that doesn't support get_port function and check if compilation fails with corresponding message Change-Id: I3f5c6d2eae95b8a63c6655595dd1e658bfd0c8da Signed-off-by: Michał Barnaś Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262094 Reviewed-by: Denis Brockus Reviewed-by: Keith Short --- driver/ioexpander/ccgxxf.c | 4 ++++ driver/ioexpander/ioexpander_nct38xx.c | 4 ++++ driver/ioexpander/it8801.c | 4 ++++ driver/ioexpander/pca9675.c | 4 ++++ driver/ioexpander/pcal6408.c | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/driver/ioexpander/ccgxxf.c b/driver/ioexpander/ccgxxf.c index ac079d7b2f..347a2c7587 100644 --- a/driver/ioexpander/ccgxxf.c +++ b/driver/ioexpander/ccgxxf.c @@ -14,6 +14,10 @@ #define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) +#ifdef CONFIG_IO_EXPANDER_SUPPORT_GET_PORT +#error "This driver doesn't support get_port function" +#endif + static inline int ccgxxf_read8(int ioex, int reg, int *data) { return i2c_read8(ioex_config[ioex].i2c_host_port, diff --git a/driver/ioexpander/ioexpander_nct38xx.c b/driver/ioexpander/ioexpander_nct38xx.c index 8c87a33d24..6d30e4ecc3 100644 --- a/driver/ioexpander/ioexpander_nct38xx.c +++ b/driver/ioexpander/ioexpander_nct38xx.c @@ -16,6 +16,10 @@ #define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args) #define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) +#ifdef CONFIG_IO_EXPANDER_SUPPORT_GET_PORT +#error "This driver doesn't support get_port function" +#endif + /* * Store the GPIO_ALERT_MASK_0/1 and chip ID registers locally. In this way, * we don't have to read it via I2C transaction everytime. diff --git a/driver/ioexpander/it8801.c b/driver/ioexpander/it8801.c index b7f6d41774..9bb6ca4487 100644 --- a/driver/ioexpander/it8801.c +++ b/driver/ioexpander/it8801.c @@ -19,6 +19,10 @@ #define CPRINTS(format, args...) cprints(CC_KEYSCAN, format, ## args) +#ifdef CONFIG_IO_EXPANDER_SUPPORT_GET_PORT +#error "This driver doesn't support get_port function" +#endif + static int it8801_ioex_set_level(int ioex, int port, int mask, int value); static void it8801_ioex_event_handler(void); DECLARE_DEFERRED(it8801_ioex_event_handler); diff --git a/driver/ioexpander/pca9675.c b/driver/ioexpander/pca9675.c index 3fe3bfa0c4..2bef06d19e 100644 --- a/driver/ioexpander/pca9675.c +++ b/driver/ioexpander/pca9675.c @@ -9,6 +9,10 @@ #include "ioexpander.h" #include "pca9675.h" +#ifdef CONFIG_IO_EXPANDER_SUPPORT_GET_PORT +#error "This driver doesn't support get_port function" +#endif + struct pca9675_ioexpander { /* I/O port direction (1 = input, 0 = output) */ uint16_t io_direction; diff --git a/driver/ioexpander/pcal6408.c b/driver/ioexpander/pcal6408.c index 287e0506d0..46de96b595 100644 --- a/driver/ioexpander/pcal6408.c +++ b/driver/ioexpander/pcal6408.c @@ -15,6 +15,10 @@ #define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args) #define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) +#ifdef CONFIG_IO_EXPANDER_SUPPORT_GET_PORT +#error "This driver doesn't support get_port function" +#endif + /* * Store interrupt mask registers locally. In this way, * we don't have to read it via i2c transaction every time. -- cgit v1.2.1