Lines Matching refs:serio_raw
28 struct serio_raw { struct
44 struct serio_raw *serio_raw; member
62 static struct serio_raw *serio_raw_locate(int minor) in serio_raw_locate()
64 struct serio_raw *serio_raw; in serio_raw_locate() local
66 list_for_each_entry(serio_raw, &serio_raw_list, node) { in serio_raw_locate()
67 if (serio_raw->dev.minor == minor) in serio_raw_locate()
68 return serio_raw; in serio_raw_locate()
76 struct serio_raw *serio_raw; in serio_raw_open() local
84 serio_raw = serio_raw_locate(iminor(inode)); in serio_raw_open()
85 if (!serio_raw) { in serio_raw_open()
90 if (serio_raw->dead) { in serio_raw_open()
101 client->serio_raw = serio_raw; in serio_raw_open()
104 kref_get(&serio_raw->kref); in serio_raw_open()
106 serio_pause_rx(serio_raw->serio); in serio_raw_open()
107 list_add_tail(&client->node, &serio_raw->client_list); in serio_raw_open()
108 serio_continue_rx(serio_raw->serio); in serio_raw_open()
117 struct serio_raw *serio_raw = in serio_raw_free() local
118 container_of(kref, struct serio_raw, kref); in serio_raw_free()
120 put_device(&serio_raw->serio->dev); in serio_raw_free()
121 kfree(serio_raw); in serio_raw_free()
127 struct serio_raw *serio_raw = client->serio_raw; in serio_raw_release() local
129 serio_pause_rx(serio_raw->serio); in serio_raw_release()
131 serio_continue_rx(serio_raw->serio); in serio_raw_release()
135 kref_put(&serio_raw->kref, serio_raw_free); in serio_raw_release()
140 static bool serio_raw_fetch_byte(struct serio_raw *serio_raw, char *c) in serio_raw_fetch_byte() argument
144 serio_pause_rx(serio_raw->serio); in serio_raw_fetch_byte()
146 empty = serio_raw->head == serio_raw->tail; in serio_raw_fetch_byte()
148 *c = serio_raw->queue[serio_raw->tail]; in serio_raw_fetch_byte()
149 serio_raw->tail = (serio_raw->tail + 1) % SERIO_RAW_QUEUE_LEN; in serio_raw_fetch_byte()
152 serio_continue_rx(serio_raw->serio); in serio_raw_fetch_byte()
161 struct serio_raw *serio_raw = client->serio_raw; in serio_raw_read() local
167 if (serio_raw->dead) in serio_raw_read()
170 if (serio_raw->head == serio_raw->tail && in serio_raw_read()
177 while (read < count && serio_raw_fetch_byte(serio_raw, &c)) { in serio_raw_read()
187 error = wait_event_interruptible(serio_raw->wait, in serio_raw_read()
188 serio_raw->head != serio_raw->tail || in serio_raw_read()
189 serio_raw->dead); in serio_raw_read()
202 struct serio_raw *serio_raw = client->serio_raw; in serio_raw_write() local
210 if (serio_raw->dead) { in serio_raw_write()
224 if (serio_write(serio_raw->serio, c)) { in serio_raw_write()
242 struct serio_raw *serio_raw = client->serio_raw; in serio_raw_poll() local
245 poll_wait(file, &serio_raw->wait, wait); in serio_raw_poll()
247 mask = serio_raw->dead ? EPOLLHUP | EPOLLERR : EPOLLOUT | EPOLLWRNORM; in serio_raw_poll()
248 if (serio_raw->head != serio_raw->tail) in serio_raw_poll()
273 struct serio_raw *serio_raw = serio_get_drvdata(serio); in serio_raw_interrupt() local
275 unsigned int head = serio_raw->head; in serio_raw_interrupt()
278 serio_raw->queue[head] = data; in serio_raw_interrupt()
280 if (likely(head != serio_raw->tail)) { in serio_raw_interrupt()
281 serio_raw->head = head; in serio_raw_interrupt()
282 list_for_each_entry(client, &serio_raw->client_list, node) in serio_raw_interrupt()
284 wake_up_interruptible(&serio_raw->wait); in serio_raw_interrupt()
293 struct serio_raw *serio_raw; in serio_raw_connect() local
296 serio_raw = kzalloc(sizeof(struct serio_raw), GFP_KERNEL); in serio_raw_connect()
297 if (!serio_raw) { in serio_raw_connect()
302 snprintf(serio_raw->name, sizeof(serio_raw->name), in serio_raw_connect()
304 kref_init(&serio_raw->kref); in serio_raw_connect()
305 INIT_LIST_HEAD(&serio_raw->client_list); in serio_raw_connect()
306 init_waitqueue_head(&serio_raw->wait); in serio_raw_connect()
308 serio_raw->serio = serio; in serio_raw_connect()
311 serio_set_drvdata(serio, serio_raw); in serio_raw_connect()
321 list_add_tail(&serio_raw->node, &serio_raw_list); in serio_raw_connect()
324 serio_raw->dev.minor = PSMOUSE_MINOR; in serio_raw_connect()
325 serio_raw->dev.name = serio_raw->name; in serio_raw_connect()
326 serio_raw->dev.parent = &serio->dev; in serio_raw_connect()
327 serio_raw->dev.fops = &serio_raw_fops; in serio_raw_connect()
329 err = misc_register(&serio_raw->dev); in serio_raw_connect()
331 serio_raw->dev.minor = MISC_DYNAMIC_MINOR; in serio_raw_connect()
332 err = misc_register(&serio_raw->dev); in serio_raw_connect()
343 serio->phys, serio_raw->name, serio_raw->dev.minor); in serio_raw_connect()
347 list_del_init(&serio_raw->node); in serio_raw_connect()
352 kref_put(&serio_raw->kref, serio_raw_free); in serio_raw_connect()
358 struct serio_raw *serio_raw = serio_get_drvdata(serio); in serio_raw_reconnect() local
361 if (!drv || !serio_raw) { in serio_raw_reconnect()
378 static void serio_raw_hangup(struct serio_raw *serio_raw) in serio_raw_hangup() argument
382 serio_pause_rx(serio_raw->serio); in serio_raw_hangup()
383 list_for_each_entry(client, &serio_raw->client_list, node) in serio_raw_hangup()
385 serio_continue_rx(serio_raw->serio); in serio_raw_hangup()
387 wake_up_interruptible(&serio_raw->wait); in serio_raw_hangup()
393 struct serio_raw *serio_raw = serio_get_drvdata(serio); in serio_raw_disconnect() local
395 misc_deregister(&serio_raw->dev); in serio_raw_disconnect()
398 serio_raw->dead = true; in serio_raw_disconnect()
399 list_del_init(&serio_raw->node); in serio_raw_disconnect()
402 serio_raw_hangup(serio_raw); in serio_raw_disconnect()
405 kref_put(&serio_raw->kref, serio_raw_free); in serio_raw_disconnect()