| Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 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 |  | 
 | 9 | #ifndef CAN_LED_H | 
 | 10 | #define CAN_LED_H | 
 | 11 |  | 
 | 12 | #include <linux/if.h> | 
 | 13 | #include <linux/leds.h> | 
 | 14 |  | 
 | 15 | enum can_led_event { | 
 | 16 | 	CAN_LED_EVENT_OPEN, | 
 | 17 | 	CAN_LED_EVENT_STOP, | 
 | 18 | 	CAN_LED_EVENT_TX, | 
 | 19 | 	CAN_LED_EVENT_RX, | 
 | 20 | }; | 
 | 21 |  | 
 | 22 | #ifdef CONFIG_CAN_LEDS | 
 | 23 |  | 
 | 24 | /* keep space for interface name + "-tx"/"-rx" suffix and null terminator */ | 
 | 25 | #define CAN_LED_NAME_SZ (IFNAMSIZ + 4) | 
 | 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); | 
| Kurt Van Dijck | a1ef7bd | 2012-12-18 18:50:57 +0100 | [diff] [blame] | 29 | int __init can_led_notifier_init(void); | 
 | 30 | void __exit can_led_notifier_exit(void); | 
| Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 31 |  | 
 | 32 | #else | 
 | 33 |  | 
 | 34 | static inline void can_led_event(struct net_device *netdev, | 
 | 35 | 				 enum can_led_event event) | 
 | 36 | { | 
 | 37 | } | 
 | 38 | static inline void devm_can_led_init(struct net_device *netdev) | 
 | 39 | { | 
 | 40 | } | 
| Kurt Van Dijck | a1ef7bd | 2012-12-18 18:50:57 +0100 | [diff] [blame] | 41 | static inline int can_led_notifier_init(void) | 
 | 42 | { | 
 | 43 | 	return 0; | 
 | 44 | } | 
 | 45 | static inline void can_led_notifier_exit(void) | 
 | 46 | { | 
 | 47 | } | 
| Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 48 |  | 
 | 49 | #endif | 
 | 50 |  | 
 | 51 | #endif |