#include #include #include #include "hui_internal.h" #include "hui_generic.h" // clang-format off static struct platform_driver *const drivers[] = { #if !IS_ENABLED(CONFIG_HAVE_NO_AVM_GPIO) &hui_generic_button_avm, &hui_generic_led_avm, #endif &hui_generic_led_ext, #if IS_ENABLED(CONFIG_GPIOLIB) &hui_generic_led_gpio, &hui_generic_button_gpio, #endif #if IS_ENABLED(CONFIG_PWM) &hui_generic_led_pwm, #endif #if IS_ENABLED(CONFIG_LEDS_CLASS) &hui_generic_led_class, #endif }; // clang-format on int generic_gpio_init(void) { int err, i; for (i = 0; i < ARRAY_SIZE(drivers); i++) { err = platform_driver_register(drivers[i]); if (err) return err; } #if IS_ENABLED(CONFIG_HUI_LC882X) err = spi_register_driver(&hui_generic_lc882x); if (err) return err; #endif return 0; } void generic_gpio_exit(void) { int i; #if IS_ENABLED(CONFIG_HUI_LC882X) spi_unregister_driver(&hui_generic_lc882x); #endif for (i = 0; i < ARRAY_SIZE(drivers); i++) platform_driver_unregister(drivers[i]); }