From 781ca89cf657c88960ee16fbc7b3c3f4db6a41f1 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Fri, 27 May 2016 20:41:25 +0000 Subject: [PATCH] Don't wrap the declaration of gpio_alloc_intr_resource() in #ifdef INTRNG, wrap the implementation so that it returns an error if INTRNG support is not available. It should be possible to write a non-INTRNG implementation of this function some day. In the meantime, there is code that contains calls to this function (so the decl is needed), but have runtime checks to avoid calling it in the non-INTRNG case. --- sys/dev/gpio/gpiobus.c | 8 ++++++++ sys/dev/gpio/gpiobusvar.h | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 13768c37354..f8b3b46f4c2 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -96,6 +96,14 @@ gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, return (bus_alloc_resource(consumer_dev, SYS_RES_IRQ, rid, irqnum, irqnum, 1, alloc_flags)); } +#else +struct resource * +gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, + gpio_pin_t pin, uint32_t intr_mode) +{ + + return (NULL); +} #endif int diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index a103b739fa0..f6b6d68f185 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -128,10 +128,8 @@ int gpio_pin_is_active(gpio_pin_t pin, bool *active); int gpio_pin_set_active(gpio_pin_t pin, bool active); int gpio_pin_setflags(gpio_pin_t pin, uint32_t flags); #endif -#ifdef INTRNG struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, gpio_pin_t pin, uint32_t intr_mode); -#endif int gpio_check_flags(uint32_t, uint32_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t);