Re: module function design question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Whatever you return (Success/Failure) from the entrypoint will be available
in the user space.
Irrespective of the result, you anyway want to pend for the event again.
Dont put the while loop in the kernel space but put it in user space program
accessing the driver module.

Slight change in the statement:
"You can perform this repeatedly by having while loop calling the driver
entrypoint"

"You can perform this repeatedly by having while loop in the userspace
calling the driver entrypoint."

Regards,
Anj

----- Original Message -----
From: "jnf" <jnf@redwhitearmy.com>
To: "Anjaneyulu" <anjaneyulu@mistralsoftware.com>
Cc: <kernelnewbies@nl.linux.org>
Sent: Tuesday, January 06, 2004 12:44 PM
Subject: Re: module function design question.


> hi, thanks for the reply/help. im not entirely sure how to implement what
> you said, so let me explain a little more exactly how im doing this.
>
> the interupt handler is registered in the init module function, and then
> after that the function that sleeps is called, also in the init module
> function- the first thing that function does it put itself to sleep
> when the event im waiting for happens, the interupt handler wakes up the
> sleeping function, who does some things and as i said on any fatal error
> it needs to put itself back to sleep and exit (this being the key problem
> how to exit and readd itself), when it finishes id like to have it readd
> itself and exit. when it calls itself recursivley, i guess it puts itself
> to sleep and then actually continues where it left off, but i am not sure.
> Let me try to explain in code
>
> function(void) {
>
>     interruptible_sleepon_(&wq);
>
>     if(fatal) {
>        function()
>        return -1;
>    }
>
>    ...
>
>    function();
>    return 0;
> }
>
> what i am worried about is that it never return's, and thus the stack
> frame is never shrunk, am I correct in this assumption?
>
> Also, if I added say a while() loop in front of it, would it not add
> itself to the queue multiple times?
>
> thanks again,
>
> jnf
> > Hi,
> > You can achieve the same as follows:
> > 1. Pend for the event using sleep_on / interruptible_sleep_on.
> > 2. When the event happens (Ex: from the interrupt handler), call wake_up
/
> > wake_up_interruptible.
> >
> > One thing is that you will execute step 1 in one of the driver
entrypoint
> > which will be invoked from the user space.
> > You can perform this repeatedly by having while loop calling the diver
> > entrypoint.
> >
> > Regards,
> > Anj
> >
>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux