#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <uapi/linux/serial.h>
#define LEDTRIG_TTY_INTERVAL …
struct ledtrig_tty_data { … };
enum led_trigger_tty_state { … };
enum led_trigger_tty_modes { … };
static int ledtrig_tty_wait_for_completion(struct device *dev)
{ … }
static ssize_t ttyname_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t ttyname_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t size)
{ … }
static DEVICE_ATTR_RW(ttyname);
static ssize_t ledtrig_tty_attr_show(struct device *dev, char *buf,
enum led_trigger_tty_modes attr)
{ … }
static ssize_t ledtrig_tty_attr_store(struct device *dev, const char *buf,
size_t size, enum led_trigger_tty_modes attr)
{ … }
#define DEFINE_TTY_TRIGGER(trigger_name, trigger) …
DEFINE_TTY_TRIGGER(…);
DEFINE_TTY_TRIGGER(…);
DEFINE_TTY_TRIGGER(…);
DEFINE_TTY_TRIGGER(…);
DEFINE_TTY_TRIGGER(…);
DEFINE_TTY_TRIGGER(…);
static void ledtrig_tty_work(struct work_struct *work)
{ … }
static struct attribute *ledtrig_tty_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int ledtrig_tty_activate(struct led_classdev *led_cdev)
{ … }
static void ledtrig_tty_deactivate(struct led_classdev *led_cdev)
{ … }
static struct led_trigger ledtrig_tty = …;
module_led_trigger(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;