When can I call wake_up_interruptible?

Erik Corry (erik@arbat.com)
Sun, 3 May 1998 00:14:36 +0200


Hi,

I am trying to write a driver for a character device (a phone
port, into which you can plug a POTS telephone). When I get
an interrupt from the phone I want to wake up the processes
that were blocked trying to read events from a file descriptor.

I keep getting 'Aiee scheduling in interrupt' errors. Should
I be setting a flag and waiting for the next clock tick? Should
I call wake_up_interruptible with interrupts on or off? Is the
problem somewhere completely different? (error in the linked
list of wait structures?). Here is an excerpt from the code

typedef struct s_phone_t
{
/* ... */
int packets_available;
struct wait_queue *read_wait;
int readers;
int tail;
phone_pkt buffer[ASUS_AB_BUFSIZE];
} asus_ab;

void
asus_ab_data_for_reader(struct IsdnCardState *cs, asus_ab *ab)
{
unsigned long flags;
int head;
save_flags(flags);
cli();
if(!ab->readers)
{
/*printk("no readers\n");*/
restore_flags(flags);
return;
}
if(ab->packets_available == ASUS_AB_BUFSIZE)
{
printk("/dev/phone%d: data dropped due to slow reader\n", ab->minor);
restore_flags(flags);
return;
}
head = ab->tail + ab->packets_available;
if (head > ASUS_AB_BUFSIZE) head -= ASUS_AB_BUFSIZE;
fill_phone_pkt(ab, ab->buffer + head);
ab->packets_available++;
restore_flags(flags);
printk("phone%d: waking up\n", ab->minor);
wake_up_interruptible(&ab->read_wait);
}

-- 
Erik Corry

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu