blob: 2746f7c2f87dd2f73d6312f254d367fed2b1957a [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/*
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#include <linux/netdevice.h>
15
16enum 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
25/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
26 * suffix and null terminator
27 */
28#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
29
30void can_led_event(struct net_device *netdev, enum can_led_event event);
31void devm_can_led_init(struct net_device *netdev);
32int __init can_led_notifier_init(void);
33void __exit can_led_notifier_exit(void);
34
35#else
36
37static inline void can_led_event(struct net_device *netdev,
38 enum can_led_event event)
39{
40}
41static inline void devm_can_led_init(struct net_device *netdev)
42{
43}
44static inline int can_led_notifier_init(void)
45{
46 return 0;
47}
48static inline void can_led_notifier_exit(void)
49{
50}
51
52#endif
53
54#endif /* !_CAN_LED_H */