[uCsimm] struct wait_queue using interrupts

From: daniel haensse (daniel.haensse@fhk.usz.ch)
Date: Mon Mar 26 2001 - 10:36:51 EST


Hi all

The driver I wrote is going to get stuck in read (sometime the system
crashes by some kfree message). I think the problem is the pointer to
interruptsync_queue which is a pointer to a wait_queue structure. My Question
is who is going to allocate memory where the pointer interruptsync_queue point
to? It is initialized to null at initialisation of the driver. Do I have to call
interruptible_sleep_on first or allocate some memory? According to Rubini's
book this is not done?!

Thanks Dani

declaration:
struct Mcpmod_Dev
{
  volatile struct wait_queue *interruptsync_queue;
} *mcpmod_devices;

init:
  mcpmod_devices = kmalloc (sizeof (struct Mcpmod_Dev), GFP_KERNEL);
  mcpmod_devices->interruptsync_queue=NULL;

read:
static int
mcpmod_read (struct inode * inode, struct file * filp,
             char *buf, int count)
{
  int read=0;
  if (mcpmod_devices->samplebuf_head==mcpmod_devices->samplebuf_tail)
    {
      interruptible_sleep_on (&mcpmod_devices->interruptsync_queue);
      if (current->signal & ~current->blocked) /* a signal arrived */
                {
                 return -ERESTARTSYS; /* tell the fs layer to handle it */
                }
    }

interrupt:
  wake_up_interruptible(&mcpmod_devices->interruptsync_queue);

-- 
**********************************************************

Daniel Haensse

Klinik fuer Neonatologie

UniversitaetsSpital Zuerich

Frauenklinikstr. 10

8091 Zuerich

Switzerland

Tel: ++41 / 1 / 255 5342

Fax: ++41 / 1 / 255 4442

email: daniel.haensse@fhk.usz.ch This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:42 EST