• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2012, Fabio Baltieri <fabio.baltieri@gmail.com>
4  */
5 
6 #ifndef _CAN_LED_H
7 #define _CAN_LED_H
8 
9 #include <linux/if.h>
10 #include <linux/leds.h>
11 #include <linux/netdevice.h>
12 
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 
20 #ifdef CONFIG_CAN_LEDS
21 
22 /* keep space for interface name + "-tx"/"-rx"/"-rxtx"
23  * suffix and null terminator
24  */
25 #define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
26 
27 void can_led_event(struct net_device *netdev, enum can_led_event event);
28 void devm_can_led_init(struct net_device *netdev);
29 int __init can_led_notifier_init(void);
30 void __exit can_led_notifier_exit(void);
31 
32 #else
33 
can_led_event(struct net_device * netdev,enum can_led_event event)34 static inline void can_led_event(struct net_device *netdev,
35 				 enum can_led_event event)
36 {
37 }
devm_can_led_init(struct net_device * netdev)38 static inline void devm_can_led_init(struct net_device *netdev)
39 {
40 }
can_led_notifier_init(void)41 static inline int can_led_notifier_init(void)
42 {
43 	return 0;
44 }
can_led_notifier_exit(void)45 static inline void can_led_notifier_exit(void)
46 {
47 }
48 
49 #endif
50 
51 #endif /* !_CAN_LED_H */
52