File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 55#include <linux/interrupt.h>
66#include <linux/kfifo.h>
77#include <linux/module.h>
8+ #include <linux/poll.h>
89#include <linux/slab.h>
910#include <linux/sysfs.h>
1011#include <linux/version.h>
@@ -380,6 +381,18 @@ static void timer_handler(struct timer_list *__timer)
380381 local_irq_enable ();
381382}
382383
384+ static __poll_t kxo_poll (struct file * filp , struct poll_table_struct * wait )
385+ {
386+ __poll_t mask = 0 ;
387+
388+ poll_wait (filp , & rx_wait , wait );
389+
390+ if (kfifo_len (& rx_fifo ))
391+ mask |= EPOLLRDNORM | EPOLLIN ;
392+
393+ return mask ;
394+ }
395+
383396static ssize_t kxo_read (struct file * file ,
384397 char __user * buf ,
385398 size_t count ,
@@ -449,7 +462,7 @@ static const struct file_operations kxo_fops = {
449462 .llseek = no_llseek ,
450463 .open = kxo_open ,
451464 .release = kxo_release ,
452- };
465+ . poll = kxo_poll };
453466
454467static int __init kxo_init (void )
455468{
You can’t perform that action at this time.
0 commit comments