Another doubt on device drivers

N K SATHEESH KUMAR (nksk@wipinfo.soft.net)
Wed, 26 Aug 1998 18:27:04 +0000 (GMT)


Hi,
Please help me with this doubt too...Pardon me if the question is very
trivial..I am just a beginner with device driver writing.

I have written a character device driver in which the following functions
are there.

#ifndef MODULE
long zero_init(long mem_start, long mem_end)
{
..........
}
#else
int init_module(void)
{
..........
/* here I use register_chrdev() */
}
void cleanup_module(void)
{
.........
/* here I use unregister_chrdev() */
}
#endif

My doubt is this. I have a printk() function call in init_module. When I
compile the source I use -D option to define MODULE. But I am not getting
any output from printk() in init_module(). Why is this so ?
I believe init_module() is called when I do 'insmod'. Am I correct ?
If not, when is register_chrdev() called ? Is cleanup_module() called
when I do a 'rmmod' ??

Thank you,
regards
Satheesh

---------------------------------------------------------------------------
The human mind treats a new idea the way the body treats a strange protein-
--it rejects it.
---------------------------------------------------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html