blob: 146de4506d211285b82a5b3554154c4e6fc4a8a1 [file] [log] [blame]
Fabio Baltieri996a9532012-12-18 18:50:55 +01001/*
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 Hartkopp42193e32014-05-15 20:31:56 +02009#ifndef _CAN_LED_H
10#define _CAN_LED_H
Fabio Baltieri996a9532012-12-18 18:50:55 +010011
12#include <linux/if.h>
13#include <linux/leds.h>
14
15enum 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
Yegor Yefremovc54eb702015-03-16 09:38:13 +010024/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
25 * suffix and null terminator
26 */
27#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
Fabio Baltieri996a9532012-12-18 18:50:55 +010028
29void can_led_event(struct net_device *netdev, enum can_led_event event);
30void devm_can_led_init(struct net_device *netdev);
Kurt Van Dijcka1ef7bd2012-12-18 18:50:57 +010031int __init can_led_notifier_init(void);
32void __exit can_led_notifier_exit(void);
Fabio Baltieri996a9532012-12-18 18:50:55 +010033
34#else
35
36static inline void can_led_event(struct net_device *netdev,
37 enum can_led_event event)
38{
39}
40static inline void devm_can_led_init(struct net_device *netdev)
41{
42}
Kurt Van Dijcka1ef7bd2012-12-18 18:50:57 +010043static inline int can_led_notifier_init(void)
44{
45 return 0;
46}
47static inline void can_led_notifier_exit(void)
48{
49}
Fabio Baltieri996a9532012-12-18 18:50:55 +010050
51#endif
52
Oliver Hartkopp42193e32014-05-15 20:31:56 +020053#endif /* !_CAN_LED_H */