blob: 7c3cfd798c56d331a8f8a7d5e2a99c9a1641f339 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Fabio Baltieri996a9532012-12-18 18:50:55 +01002/*
3 * Copyright 2012, Fabio Baltieri <fabio.baltieri@gmail.com>
Fabio Baltieri996a9532012-12-18 18:50:55 +01004 */
5
Oliver Hartkopp42193e32014-05-15 20:31:56 +02006#ifndef _CAN_LED_H
7#define _CAN_LED_H
Fabio Baltieri996a9532012-12-18 18:50:55 +01008
9#include <linux/if.h>
10#include <linux/leds.h>
Marc Kleine-Budde27859682015-05-09 17:47:52 +020011#include <linux/netdevice.h>
Fabio Baltieri996a9532012-12-18 18:50:55 +010012
13enum 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
Yegor Yefremovc54eb702015-03-16 09:38:13 +010022/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
23 * suffix and null terminator
24 */
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
Fabio Baltieri996a9532012-12-18 18:50:55 +010026
27void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev);
Kurt Van Dijcka1ef7bd2012-12-18 18:50:57 +010029int __init can_led_notifier_init(void);
30void __exit can_led_notifier_exit(void);
Fabio Baltieri996a9532012-12-18 18:50:55 +010031
32#else
33
34static inline void can_led_event(struct net_device *netdev,
35 enum can_led_event event)
36{
37}
38static inline void devm_can_led_init(struct net_device *netdev)
39{
40}
Kurt Van Dijcka1ef7bd2012-12-18 18:50:57 +010041static inline int can_led_notifier_init(void)
42{
43 return 0;
44}
45static inline void can_led_notifier_exit(void)
46{
47}
Fabio Baltieri996a9532012-12-18 18:50:55 +010048
49#endif
50
Oliver Hartkopp42193e32014-05-15 20:31:56 +020051#endif /* !_CAN_LED_H */