SubmittingDrivers 5.49 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Submitting Drivers For The Linux Kernel
---------------------------------------

This document is intended to explain how to submit device drivers to the
various kernel trees. Note that if you are interested in video card drivers
you should probably talk to XFree86 (http://www.xfree86.org/) and/or X.Org
(http://x.org/) instead.

Also read the Documentation/SubmittingPatches document.


Allocating Device Numbers
-------------------------

Major and minor numbers for block and character devices are allocated
16 17
by the Linux assigned name and number authority (currently this is
Torben Mathiasen). The site is http://www.lanana.org/. This
Linus Torvalds's avatar
Linus Torvalds committed
18 19
also deals with allocating numbers for devices that are not going to
be submitted to the mainstream kernel.
20
See Documentation/devices.txt for more information on this.
Linus Torvalds's avatar
Linus Torvalds committed
21

22 23
If you don't use assigned numbers then when your device is submitted it will
be given an assigned number even if that is different from values you may
Linus Torvalds's avatar
Linus Torvalds committed
24 25 26 27 28 29
have shipped to customers before.

Who To Submit Drivers To
------------------------

Linux 2.0:
30
	No new drivers are accepted for this kernel tree.
Linus Torvalds's avatar
Linus Torvalds committed
31 32

Linux 2.2:
33 34 35
	No new drivers are accepted for this kernel tree.

Linux 2.4:
Linus Torvalds's avatar
Linus Torvalds committed
36 37 38
	If the code area has a general maintainer then please submit it to
	the maintainer listed in MAINTAINERS in the kernel file. If the
	maintainer does not respond or you cannot find the appropriate
39 40
	maintainer then please contact Marcelo Tosatti
	<marcelo.tosatti@cyclades.com>.
Linus Torvalds's avatar
Linus Torvalds committed
41 42 43 44 45 46 47 48 49 50 51

Linux 2.6:
	The same rules apply as 2.4 except that you should follow linux-kernel
	to track changes in API's. The final contact point for Linux 2.6
	submissions is Andrew Morton <akpm@osdl.org>.

What Criteria Determine Acceptance
----------------------------------

Licensing:	The code must be released to us under the
		GNU General Public License. We don't insist on any kind
52
		of exclusive GPL licensing, and if you wish the driver
Linus Torvalds's avatar
Linus Torvalds committed
53 54
		to be useful to other communities such as BSD you may well
		wish to release under multiple licenses.
55
		See accepted licenses at include/linux/module.h
Linus Torvalds's avatar
Linus Torvalds committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145

Copyright:	The copyright owner must agree to use of GPL.
		It's best if the submitter and copyright owner
		are the same person/entity. If not, the name of
		the person/entity authorizing use of GPL should be
		listed in case it's necessary to verify the will of
		the copright owner.

Interfaces:	If your driver uses existing interfaces and behaves like
		other drivers in the same class it will be much more likely
		to be accepted than if it invents gratuitous new ones. 
		If you need to implement a common API over Linux and NT
		drivers do it in userspace.

Code:		Please use the Linux style of code formatting as documented
		in Documentation/CodingStyle. If you have sections of code
		that need to be in other formats, for example because they
		are shared with a windows driver kit and you want to
		maintain them just once separate them out nicely and note
		this fact.

Portability:	Pointers are not always 32bits, not all computers are little
		endian, people do not all have floating point and you
		shouldn't use inline x86 assembler in your driver without
		careful thought. Pure x86 drivers generally are not popular.
		If you only have x86 hardware it is hard to test portability
		but it is easy to make sure the code can easily be made
		portable.

Clarity:	It helps if anyone can see how to fix the driver. It helps
		you because you get patches not bug reports. If you submit a
		driver that intentionally obfuscates how the hardware works
		it will go in the bitbucket.

Control:	In general if there is active maintainance of a driver by
		the author then patches will be redirected to them unless 
		they are totally obvious and without need of checking.
		If you want to be the contact and update point for the
		driver it is a good idea to state this in the comments,
		and include an entry in MAINTAINERS for your driver.

What Criteria Do Not Determine Acceptance
-----------------------------------------

Vendor:		Being the hardware vendor and maintaining the driver is
		often a good thing. If there is a stable working driver from
		other people already in the tree don't expect 'we are the
		vendor' to get your driver chosen. Ideally work with the 
		existing driver author to build a single perfect driver.

Author:		It doesn't matter if a large Linux company wrote the driver,
		or you did. Nobody has any special access to the kernel
		tree. Anyone who tells you otherwise isn't telling the
		whole story.


Resources
---------

Linux kernel master tree:
	ftp.??.kernel.org:/pub/linux/kernel/...
	?? == your country code, such as "us", "uk", "fr", etc.

Linux kernel mailing list:		
	linux-kernel@vger.kernel.org
	[mail majordomo@vger.kernel.org to subscribe]

Linux Device Drivers, Third Edition (covers 2.6.10):
	http://lwn.net/Kernel/LDD3/  (free version)

Kernel traffic:
	Weekly summary of kernel list activity (much easier to read)
	http://www.kerneltraffic.org/kernel-traffic/

LWN.net:
	Weekly summary of kernel development activity - http://lwn.net/
	2.6 API changes:
		http://lwn.net/Articles/2.6-kernel-api/
	Porting drivers from prior kernels to 2.6:
		http://lwn.net/Articles/driver-porting/

KernelTrap:
	Occasional Linux kernel articles and developer interviews
	http://kerneltrap.org/

KernelNewbies:
	Documentation and assistance for new kernel programmers
	http://kernelnewbies.org/

Linux USB project:
146
	http://www.linux-usb.org/
147 148 149 150 151 152

How to NOT write kernel driver by arjanv@redhat.com
	http://people.redhat.com/arjanv/olspaper.pdf

Kernel Janitor:
	http://janitor.kernelnewbies.org/
Linus Torvalds's avatar
Linus Torvalds committed
153

154 155
--
Last updated on 17 Nov 2005.