From d0fccdb54941bc8891138ae73cdb28f2f3498f46 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 27 Jun 2023 19:16:05 +0200 Subject: [PATCH] drivers/pcf857x: Move compile time check to compilation unit This allows including the header without using the module. Obviously, calls to the functions provided by the header won't like without using the module. But including the header can still be useful for e.g.: if (IS_USED(MODULE_PCF857x)) { /* make use of the module */ } In the above example all calls to pcf857x functions would be optimized out when the module is not used, full compile checks happen in either case. --- drivers/include/pcf857x.h | 4 ---- drivers/pcf857x/pcf857x.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/include/pcf857x.h b/drivers/include/pcf857x.h index 4b270be1e6..c2ce3ba888 100644 --- a/drivers/include/pcf857x.h +++ b/drivers/include/pcf857x.h @@ -260,10 +260,6 @@ extern "C" #include "event.h" #endif /* MODULE_PCF857X_IRQ */ -#if !IS_USED(MODULE_PCF8574) && !IS_USED(MODULE_PCF8574A) && !IS_USED(MODULE_PCF8575) -#error "Please provide a list of pcf857x variants used by the application (pcf8574, pcf8574a or pcf8575)" -#endif - /** * @name PCF857X I2C slave addresses * diff --git a/drivers/pcf857x/pcf857x.c b/drivers/pcf857x/pcf857x.c index d74c4a8a18..a37d21b394 100644 --- a/drivers/pcf857x/pcf857x.c +++ b/drivers/pcf857x/pcf857x.c @@ -42,6 +42,10 @@ #endif /* ENABLE_DEBUG */ +#if !IS_USED(MODULE_PCF8574) && !IS_USED(MODULE_PCF8574A) && !IS_USED(MODULE_PCF8575) +#error "Please provide a list of pcf857x variants used by the application (pcf8574, pcf8574a or pcf8575)" +#endif + #if IS_USED(MODULE_PCF857X_IRQ_LOW) #define PCF857X_EVENT_PRIO EVENT_PRIO_LOWEST #elif IS_USED(MODULE_PCF857X_IRQ_MEDIUM)