Yep, to me too.
Code which will be compiled into object code does not go into headers
but into .c files (function definitions, string constants etc.). OTOH,
function prototypes, preprocessor macro definitions, definitions of
small static inline functions etc. can go into headers.
If your driver does not export functions or variables to be called/
accessed by other drivers, you actually don't need a header. In that
case, use a header file only if you have a lot of macros to define (e.g.
for named register offsets and register contents). Such headers which
are not meant to be included by any other file than a single xyz.c are
sometimes called something like "xyz-private.h".
If you export something to other drivers in the same subdirectory, put
the header file into the subdirectory.
If you export something for other drivers anywhere across the linux
source tree, put the header into linux/include. (Exception: Some
subsystems don't do this; their users have to add respective search
paths into their Makefiles.)
If you export an API to userspace, put the header into linux/include and
register it as a header to be installed into /usr/include.
I personally never used any debugger, just printk and the various nice
options in the kernel hacking configuration menu. Maybe I have been
missing out on something which only debuggers provide, but lucky me, I'm
unaware of it. :-)
Usually, drivers are matched against some numeric IDs. Many if not most
drivers contain module aliases in their .ko so that they are auto-loaded
if the respective hardware is found.
However, maybe a driver was written but not yet submitted to the
mainline. Open-source out-of-tree drivers are listed at
http://linuxdriverproject.org/twiki/bin/view/Main/OutOfTreeDrivers .
You could also ask on the relevant subsystem mailinglist if anybody
knows of a driver for your specific device which is not in the mainline.
I'm not familiar with networking. Generally, old drivers --- even if
still actively maintained --- may contain code which does not reflect
currently preferred coding practices. Hence you should rather look at
newer drivers. But not at those in linux/staging/. ;-)
--
Stefan Richter
-=====-=-=== -=-= -==-=
http://arcgraph.de/sr/
_______________________________________________
devel mailing list
devel@linuxdriverproject.orghttp://driverdev.linuxdriverproject.org/mailman/listinfo/devel