diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index e4ed169e31999..d8ad5357002d9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -53,7 +53,12 @@ #define dont_test_bit(b,d) (0) -#define REJECT_HOTPLUG_TAX 1 +/* + * The SRCU bypass below skips srcu_read_lock() while the core retains its + * lockdep_assert_held(&gc->gpiodev->srcu) checks, so every gpiod_*() call + * splats under lockdep. Keep the optimisation for production builds only. + */ +#define REJECT_HOTPLUG_TAX (!IS_ENABLED(CONFIG_LOCKDEP)) #if REJECT_HOTPLUG_TAX