led.h 900 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright 2012, Fabio Baltieri <fabio.baltieri@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef CAN_LED_H
  9. #define CAN_LED_H
  10. #include <linux/if.h>
  11. #include <linux/leds.h>
  12. enum can_led_event {
  13. CAN_LED_EVENT_OPEN,
  14. CAN_LED_EVENT_STOP,
  15. CAN_LED_EVENT_TX,
  16. CAN_LED_EVENT_RX,
  17. };
  18. #ifdef CONFIG_CAN_LEDS
  19. /* keep space for interface name + "-tx"/"-rx" suffix and null terminator */
  20. #define CAN_LED_NAME_SZ (IFNAMSIZ + 4)
  21. void can_led_event(struct net_device *netdev, enum can_led_event event);
  22. void devm_can_led_init(struct net_device *netdev);
  23. #else
  24. static inline void can_led_event(struct net_device *netdev,
  25. enum can_led_event event)
  26. {
  27. }
  28. static inline void devm_can_led_init(struct net_device *netdev)
  29. {
  30. }
  31. #endif
  32. #endif