#include <linux/atomic.h>
#include <linux/ctype.h>
#include <linux/device.h>
#include <linux/ethtool.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/linkmode.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/mutex.h>
#include <linux/phy.h>
#include <linux/rtnetlink.h>
#include <linux/timer.h>
#include "../leds.h"
#define NETDEV_LED_DEFAULT_INTERVAL …
struct led_netdev_data { … };
static const struct attribute_group netdev_trig_link_speed_attrs_group;
static void set_baseline_state(struct led_netdev_data *trigger_data)
{ … }
static bool supports_hw_control(struct led_classdev *led_cdev)
{ … }
static bool validate_net_dev(struct led_classdev *led_cdev,
struct net_device *net_dev)
{ … }
static bool can_hw_control(struct led_netdev_data *trigger_data)
{ … }
static void get_device_state(struct led_netdev_data *trigger_data)
{ … }
static ssize_t device_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static int set_device_name(struct led_netdev_data *trigger_data,
const char *name, size_t size)
{ … }
static ssize_t device_name_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t size)
{ … }
static DEVICE_ATTR_RW(device_name);
static ssize_t netdev_led_attr_show(struct device *dev, char *buf,
enum led_trigger_netdev_modes attr)
{ … }
static ssize_t netdev_led_attr_store(struct device *dev, const char *buf,
size_t size, enum led_trigger_netdev_modes attr)
{ … }
#define DEFINE_NETDEV_TRIGGER(trigger_name, trigger) …
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
DEFINE_NETDEV_TRIGGER(…);
static ssize_t interval_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t interval_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t size)
{ … }
static DEVICE_ATTR_RW(interval);
static ssize_t offloaded_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(offloaded);
#define CHECK_LINK_MODE_ATTR(link_speed) …
static umode_t netdev_trig_link_speed_visible(struct kobject *kobj,
struct attribute *attr, int n)
{ … }
static struct attribute *netdev_trig_link_speed_attrs[] = …;
static const struct attribute_group netdev_trig_link_speed_attrs_group = …;
static struct attribute *netdev_trig_attrs[] = …;
static const struct attribute_group netdev_trig_attrs_group = …;
static const struct attribute_group *netdev_trig_groups[] = …;
static int netdev_trig_notify(struct notifier_block *nb,
unsigned long evt, void *dv)
{ … }
static void netdev_trig_work(struct work_struct *work)
{ … }
static int netdev_trig_activate(struct led_classdev *led_cdev)
{ … }
static void netdev_trig_deactivate(struct led_classdev *led_cdev)
{ … }
static struct led_trigger netdev_led_trigger = …;
module_led_trigger(…);
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;