skypopen: tweaking the OSS audio driver
This commit is contained in:
parent
6e310ef8fc
commit
7997d24f33
|
@ -67,6 +67,7 @@ void my_timer_callback_inq( unsigned long data )
|
|||
{
|
||||
struct scull_dev *dev = (void *)data;
|
||||
|
||||
dev->readable=1;
|
||||
wake_up_interruptible(&dev->inq);
|
||||
mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) );
|
||||
|
||||
|
@ -76,6 +77,7 @@ void my_timer_callback_outq( unsigned long data )
|
|||
{
|
||||
struct scull_dev *dev = (void *)data;
|
||||
|
||||
dev->writable=1;
|
||||
wake_up_interruptible(&dev->outq);
|
||||
mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) );
|
||||
}
|
||||
|
@ -130,11 +132,11 @@ static int scull_c_open(struct inode *inode, struct file *filp)
|
|||
struct scull_dev *dev;
|
||||
dev_t key;
|
||||
|
||||
if (!current->tgid) {
|
||||
printk("Process \"%s\" has no tgid\n", current->comm);
|
||||
if (!current->pid) {
|
||||
printk("Process \"%s\" has no pid\n", current->comm);
|
||||
return -EINVAL;
|
||||
}
|
||||
key = current->tgid;
|
||||
key = current->pid;
|
||||
|
||||
/* look for a scullc device in the list */
|
||||
spin_lock(&scull_c_lock);
|
||||
|
@ -170,12 +172,14 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count,
|
|||
{
|
||||
struct scull_dev *dev = filp->private_data;
|
||||
|
||||
DEFINE_WAIT(wait);
|
||||
prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
|
||||
schedule();
|
||||
finish_wait(&dev->inq, &wait);
|
||||
//DEFINE_WAIT(wait);
|
||||
//prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
|
||||
//schedule();
|
||||
//finish_wait(&dev->inq, &wait);
|
||||
//memset(buf, 255, count);
|
||||
|
||||
wait_event_interruptible(dev->inq, dev->readable);
|
||||
dev->readable=0;
|
||||
return count;
|
||||
|
||||
}
|
||||
|
@ -184,10 +188,13 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count,
|
|||
loff_t *f_pos)
|
||||
{
|
||||
struct scull_dev *dev = filp->private_data;
|
||||
DEFINE_WAIT(wait);
|
||||
prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE);
|
||||
schedule();
|
||||
finish_wait(&dev->outq, &wait);
|
||||
//DEFINE_WAIT(wait);
|
||||
//prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE);
|
||||
//schedule();
|
||||
//finish_wait(&dev->outq, &wait);
|
||||
|
||||
wait_event_interruptible(dev->outq, dev->writable);
|
||||
dev->writable=0;
|
||||
|
||||
return count;
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ struct scull_dev {
|
|||
wait_queue_head_t outq; /* read and write queues */
|
||||
struct timer_list timer_inq;
|
||||
struct timer_list timer_outq;
|
||||
int readable;
|
||||
int writable;
|
||||
//unsigned long read_howmany;
|
||||
//unsigned long write_howmany;
|
||||
//unsigned long read_sleeped_acc;
|
||||
|
|
Loading…
Reference in New Issue