led.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #include <linux/netdevice.h>
  13. enum can_led_event {
  14. CAN_LED_EVENT_OPEN,
  15. CAN_LED_EVENT_STOP,
  16. CAN_LED_EVENT_TX,
  17. CAN_LED_EVENT_RX,
  18. };
  19. #ifdef CONFIG_CAN_LEDS
  20. /* keep space for interface name + "-tx"/"-rx"/"-rxtx"
  21. * suffix and null terminator
  22. */
  23. #define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
  24. void can_led_event(struct net_device *netdev, enum can_led_event event);
  25. void devm_can_led_init(struct net_device *netdev);
  26. int __init can_led_notifier_init(void);
  27. void __exit can_led_notifier_exit(void);
  28. #else
  29. static inline void can_led_event(struct net_device *netdev,
  30. enum can_led_event event)
  31. {
  32. }
  33. static inline void devm_can_led_init(struct net_device *netdev)
  34. {
  35. }
  36. static inline int can_led_notifier_init(void)
  37. {
  38. return 0;
  39. }
  40. static inline void can_led_notifier_exit(void)
  41. {
  42. }
  43. #endif
  44. #endif /* !_CAN_LED_H */