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 | |
Oliver Hartkopp | 42193e3 | 2014-05-15 20:31:56 +0200 | [diff] [blame] | 9 | #ifndef _CAN_LED_H |
| 10 | #define _CAN_LED_H |
Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 11 | |
| 12 | #include <linux/if.h> |
| 13 | #include <linux/leds.h> |
Marc Kleine-Budde | 2785968 | 2015-05-09 17:47:52 +0200 | [diff] [blame] | 14 | #include <linux/netdevice.h> |
Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 15 | |
| 16 | enum can_led_event { |
| 17 | CAN_LED_EVENT_OPEN, |
| 18 | CAN_LED_EVENT_STOP, |
| 19 | CAN_LED_EVENT_TX, |
| 20 | CAN_LED_EVENT_RX, |
| 21 | }; |
| 22 | |
| 23 | #ifdef CONFIG_CAN_LEDS |
| 24 | |
Yegor Yefremov | c54eb70 | 2015-03-16 09:38:13 +0100 | [diff] [blame] | 25 | /* keep space for interface name + "-tx"/"-rx"/"-rxtx" |
| 26 | * suffix and null terminator |
| 27 | */ |
| 28 | #define CAN_LED_NAME_SZ (IFNAMSIZ + 6) |
Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 29 | |
| 30 | void can_led_event(struct net_device *netdev, enum can_led_event event); |
| 31 | void devm_can_led_init(struct net_device *netdev); |
Kurt Van Dijck | a1ef7bd | 2012-12-18 18:50:57 +0100 | [diff] [blame] | 32 | int __init can_led_notifier_init(void); |
| 33 | void __exit can_led_notifier_exit(void); |
Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 34 | |
| 35 | #else |
| 36 | |
| 37 | static inline void can_led_event(struct net_device *netdev, |
| 38 | enum can_led_event event) |
| 39 | { |
| 40 | } |
| 41 | static inline void devm_can_led_init(struct net_device *netdev) |
| 42 | { |
| 43 | } |
Kurt Van Dijck | a1ef7bd | 2012-12-18 18:50:57 +0100 | [diff] [blame] | 44 | static inline int can_led_notifier_init(void) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
| 48 | static inline void can_led_notifier_exit(void) |
| 49 | { |
| 50 | } |
Fabio Baltieri | 996a953 | 2012-12-18 18:50:55 +0100 | [diff] [blame] | 51 | |
| 52 | #endif |
| 53 | |
Oliver Hartkopp | 42193e3 | 2014-05-15 20:31:56 +0200 | [diff] [blame] | 54 | #endif /* !_CAN_LED_H */ |