Re: Adding a new driver in /drivers/net/Space.c

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

 



Crossposted to KernelNewbies and linux-net!!

On Fri, 22 Feb 2002, V.SUDHAMA wrote:

>         If you want to insert your driver as a module then the declaration
> and the intialization of the 'net_device' structure has to be done in the
> module code itself. You can't initialize the members of the structure in
> Space.c.

Thats right ! But what if my code has to have the ability to be compiled 
into the kernel as well as a module? In that case (when it is compiled 
into the kernel), where can i call my 'init' function?

>         About creating 'tap0'. 'compiling-in' with the ethertap driver
> will not create /dev/tap0 . That will have to created with 'mknod'. But I
> think it will create an interface 'tap0', so which one are you referring
> to... the device or the interface??

I was referring to the device, so it *does* create tap0.

I need a method which will do the following:

1. I have 2 drivers which depend on 'basic functionality XYZ' inside the 
kernel.
2. Both the drivers can be compiled into the kernel or be built as 
modules.
3. I have added the following to drivers/net/Config.in
    ---------------------------------------
      [] XYZ functionality (CONFIG_XYZ)
         < > Driver 1 (CONFIG_DRIVER1)
         < > Driver 2 (CONFIG_DRIVER2)
    ---------------------------------------
4. Now, when I select CONFIG_XYZ in make xconfig, i need to call 
xyz_init() regardless of whether CONFIG_DRIVER1 and CONFIG_DRIVER2 are 
compiled in or not.

*****Question******
Where should the following statements go:
--------------------------------------
#ifdef CONFIG_XYZ
   xyz_init(void);
   printk(KERN_DEBUG "xyz_init called!!\n");
#  ifdef CONFIG_DRIVER1
      driver1_init(void);
#  endif
#  ifdef CONFIG_DRIVER2
      driver2_init(void);
#  endif
#endif
---------------------------------------

Regards,
Amit


> 
> >Hi,
> >
> >I am writing a pseudo-network device driver which does not need to do any
> >probing of hardware.

-- 
The statement below is true.
The statement above is false.
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
                  Amit Kucheria
          EECS Grad. Research Assistant
         University of Kansas @ Lawrence
   (R)+1-(785)-830 8521 ||| (O)+1-(785)-864 7774
____________________________________________________

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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