lkml.org 
[lkml]   [1998]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectAnother doubt on device drivers

    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

    \
     
     \ /
      Last update: 2005-03-22 13:44    [W:0.021 / U:29.220 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site