Re: Gettinng started with Linux drivers

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stefan Richter
Date: Saturday, April 11, 2009 - 3:00 am

Amit Uttamchandani wrote:

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.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[No subject], , (Wed Dec 31, 5:00 pm)
Dearest Beloved,, Mr. Kunio Uematsu, (Tue Mar 16, 12:52 pm)
Hope to hear from you soon., Christopher Green, (Tue Oct 26, 12:02 pm)
Kick off the Linux Driver Project (again, this time for real), Peter W. Morreale, (Thu Sep 27, 6:21 am)
Kick off the Linux Driver Project (again, this time for real), Peter W. Morreale, (Thu Sep 27, 6:55 am)
Kick off the Linux Driver Project (again, this time for real), Peter W. Morreale, (Thu Sep 27, 7:58 am)
Kick off the Linux Driver Project (again, this time for real), Tomasz Grzegurzko, (Thu Sep 27, 6:40 pm)
JOINT VENTURE., ming yang, (Sun Dec 23, 5:41 am)
broken mailing list, try 47..., Greg KH, (Fri Jan 11, 12:12 pm)
Re: broken mailing list, try 47..., Steven Le Roux, (Sat Jan 12, 11:10 am)
Re: broken mailing list, try 47..., stuart, (Sat Jan 12, 3:56 pm)
Mailing Lists, Tomasz Grzegurzko, (Fri Feb 8, 5:22 pm)
what is the status of this initiative ?, JoJo jojo, (Thu Mar 13, 12:20 am)
Re: what is the status of this initiative ?, Greg KH, (Thu Mar 13, 7:51 am)
Re: what is the status of this initiative ?, Javi Roman, (Thu Mar 13, 10:13 am)
Re: what is the status of this initiative ?, Davide Madrisan, (Thu Mar 13, 10:30 am)
Re: what is the status of this initiative ?, Greg KH, (Thu Mar 13, 10:36 am)
[patch 00/10] firedtv: a few more updates, Stefan Richter, (Mon Sep 29, 10:15 am)
[patch 08/10] firedtv: remove unused struct members, Stefan Richter, (Mon Sep 29, 10:21 am)
Re: [patch 00/10] firedtv: a few more updates, Stefan Richter, (Mon Sep 29, 10:46 am)
Gettinng started with Linux drivers, Amit Uttamchandani, (Fri Apr 10, 3:04 pm)
Re: Gettinng started with Linux drivers, Stefan Richter, (Sat Apr 11, 3:00 am)
Re: Gettinng started with Linux drivers, Amit Uttamchandani, (Sun Apr 12, 6:08 pm)
Re: Gettinng started with Linux drivers, Stefan Richter, (Mon Apr 13, 12:39 am)
A tablet driver question, Steven Hunt, (Tue May 19, 9:49 pm)
Re: A tablet driver question, Greg KH, (Tue May 19, 10:12 pm)
Re: A tablet driver question, Steven Hunt, (Tue May 19, 11:16 pm)
Re: A tablet driver question, Jiri Slaby, (Wed May 20, 12:19 am)
Re: A tablet driver question, Steven Hunt, (Wed May 20, 8:58 am)
Re: A tablet driver question, Jiri Slaby, (Wed May 20, 9:24 am)
Re: A tablet driver question, Mohamed Ikbel Boulabiar, (Wed May 20, 9:50 am)
Re: A tablet driver question, Jiri Kosina, (Thu May 21, 1:33 am)