Lines Matching refs:trigger_data
19 static void ledtrig_tty_restart(struct ledtrig_tty_data *trigger_data) in ledtrig_tty_restart() argument
21 schedule_delayed_work(&trigger_data->dwork, 0); in ledtrig_tty_restart()
27 struct ledtrig_tty_data *trigger_data = led_trigger_get_drvdata(dev); in ttyname_show() local
30 mutex_lock(&trigger_data->mutex); in ttyname_show()
32 if (trigger_data->ttyname) in ttyname_show()
33 len = sprintf(buf, "%s\n", trigger_data->ttyname); in ttyname_show()
35 mutex_unlock(&trigger_data->mutex); in ttyname_show()
44 struct ledtrig_tty_data *trigger_data = led_trigger_get_drvdata(dev); in ttyname_store() local
60 mutex_lock(&trigger_data->mutex); in ttyname_store()
62 running = trigger_data->ttyname != NULL; in ttyname_store()
64 kfree(trigger_data->ttyname); in ttyname_store()
65 tty_kref_put(trigger_data->tty); in ttyname_store()
66 trigger_data->tty = NULL; in ttyname_store()
68 trigger_data->ttyname = ttyname; in ttyname_store()
70 mutex_unlock(&trigger_data->mutex); in ttyname_store()
73 ledtrig_tty_restart(trigger_data); in ttyname_store()
81 struct ledtrig_tty_data *trigger_data = in ledtrig_tty_work() local
86 mutex_lock(&trigger_data->mutex); in ledtrig_tty_work()
88 if (!trigger_data->ttyname) { in ledtrig_tty_work()
90 mutex_unlock(&trigger_data->mutex); in ledtrig_tty_work()
95 if (!trigger_data->tty) { in ledtrig_tty_work()
100 ret = tty_dev_name_to_number(trigger_data->ttyname, &devno); in ledtrig_tty_work()
113 trigger_data->tty = tty; in ledtrig_tty_work()
116 ret = tty_get_icount(trigger_data->tty, &icount); in ledtrig_tty_work()
118 dev_info(trigger_data->tty->dev, "Failed to get icount, stopped polling\n"); in ledtrig_tty_work()
119 mutex_unlock(&trigger_data->mutex); in ledtrig_tty_work()
123 if (icount.rx != trigger_data->rx || in ledtrig_tty_work()
124 icount.tx != trigger_data->tx) { in ledtrig_tty_work()
125 led_set_brightness_sync(trigger_data->led_cdev, LED_ON); in ledtrig_tty_work()
127 trigger_data->rx = icount.rx; in ledtrig_tty_work()
128 trigger_data->tx = icount.tx; in ledtrig_tty_work()
130 led_set_brightness_sync(trigger_data->led_cdev, LED_OFF); in ledtrig_tty_work()
134 mutex_unlock(&trigger_data->mutex); in ledtrig_tty_work()
135 schedule_delayed_work(&trigger_data->dwork, msecs_to_jiffies(100)); in ledtrig_tty_work()
146 struct ledtrig_tty_data *trigger_data; in ledtrig_tty_activate() local
148 trigger_data = kzalloc(sizeof(*trigger_data), GFP_KERNEL); in ledtrig_tty_activate()
149 if (!trigger_data) in ledtrig_tty_activate()
152 led_set_trigger_data(led_cdev, trigger_data); in ledtrig_tty_activate()
154 INIT_DELAYED_WORK(&trigger_data->dwork, ledtrig_tty_work); in ledtrig_tty_activate()
155 trigger_data->led_cdev = led_cdev; in ledtrig_tty_activate()
156 mutex_init(&trigger_data->mutex); in ledtrig_tty_activate()
163 struct ledtrig_tty_data *trigger_data = led_get_trigger_data(led_cdev); in ledtrig_tty_deactivate() local
165 cancel_delayed_work_sync(&trigger_data->dwork); in ledtrig_tty_deactivate()
167 kfree(trigger_data); in ledtrig_tty_deactivate()