I opened a device file in Linux kernel space using struct file *filp->f_op->open
.
Now I want to poll the opened device file before doing a read using struct file *filp->f_op->read
or I want to read the device file once the data has arrived.
When I went through the Internet, I found a kernel function to poll called poll_wait()
.
Can any one provide example how to use poll_wait()
to function ?
Below is my pseudo code in kernel implementation :
struct file *filp;
filp->f_op->sys_open("/dev/ttySX") ---> Non blocking mode
filp->f_op->read() --> Before reading i need to poll the opened device file .
Is the polling only way to find the data has arrived?