blob: 7c3cfd798c56d331a8f8a7d5e2a99c9a1641f339 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-only */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Copyright 2012, Fabio Baltieri <fabio.baltieri@gmail.com>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004 */
5
6#ifndef _CAN_LED_H
7#define _CAN_LED_H
8
9#include <linux/if.h>
10#include <linux/leds.h>
11#include <linux/netdevice.h>
12
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
22/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
23 * suffix and null terminator
24 */
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
26
27void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev);
29int __init can_led_notifier_init(void);
30void __exit can_led_notifier_exit(void);
31
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}
41static inline int can_led_notifier_init(void)
42{
43 return 0;
44}
45static inline void can_led_notifier_exit(void)
46{
47}
48
49#endif
50
51#endif /* !_CAN_LED_H */