diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 37f03786b0e6b2451cda75ee43b23826ba595f25..9776ea547a4d72f4443d499c7c8361d206d0e6d2 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -49,7 +49,7 @@ config GPIO_DEVRES
 
 config OF_GPIO
 	def_bool y
-	depends on OF
+	depends on OF || COMPILE_TEST
 
 config GPIO_ACPI
 	def_bool y