Merge tag 'sound-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[linux-2.6-block.git] / Documentation / SubmittingDrivers
CommitLineData
1da177e4
LT
1Submitting Drivers For The Linux Kernel
2---------------------------------------
3
4This document is intended to explain how to submit device drivers to the
5various kernel trees. Note that if you are interested in video card drivers
6you should probably talk to XFree86 (http://www.xfree86.org/) and/or X.Org
7(http://x.org/) instead.
8
9Also read the Documentation/SubmittingPatches document.
10
11
12Allocating Device Numbers
13-------------------------
14
15Major and minor numbers for block and character devices are allocated
84da7c08
RD
16by the Linux assigned name and number authority (currently this is
17Torben Mathiasen). The site is http://www.lanana.org/. This
1da177e4
LT
18also deals with allocating numbers for devices that are not going to
19be submitted to the mainstream kernel.
84da7c08 20See Documentation/devices.txt for more information on this.
1da177e4 21
84da7c08
RD
22If you don't use assigned numbers then when your device is submitted it will
23be given an assigned number even if that is different from values you may
1da177e4
LT
24have shipped to customers before.
25
26Who To Submit Drivers To
27------------------------
28
29Linux 2.0:
5b0ed2c6 30 No new drivers are accepted for this kernel tree.
1da177e4
LT
31
32Linux 2.2:
5b0ed2c6
XVP
33 No new drivers are accepted for this kernel tree.
34
35Linux 2.4:
1da177e4
LT
36 If the code area has a general maintainer then please submit it to
37 the maintainer listed in MAINTAINERS in the kernel file. If the
38 maintainer does not respond or you cannot find the appropriate
507a6a8c 39 maintainer then please contact Willy Tarreau <w@1wt.eu>.
1da177e4
LT
40
41Linux 2.6:
42 The same rules apply as 2.4 except that you should follow linux-kernel
43 to track changes in API's. The final contact point for Linux 2.6
e1f8e874 44 submissions is Andrew Morton.
1da177e4
LT
45
46What Criteria Determine Acceptance
47----------------------------------
48
49Licensing: The code must be released to us under the
50 GNU General Public License. We don't insist on any kind
84da7c08 51 of exclusive GPL licensing, and if you wish the driver
1da177e4
LT
52 to be useful to other communities such as BSD you may well
53 wish to release under multiple licenses.
5b0ed2c6 54 See accepted licenses at include/linux/module.h
1da177e4
LT
55
56Copyright: The copyright owner must agree to use of GPL.
57 It's best if the submitter and copyright owner
58 are the same person/entity. If not, the name of
59 the person/entity authorizing use of GPL should be
60 listed in case it's necessary to verify the will of
3706baa8 61 the copyright owner.
1da177e4
LT
62
63Interfaces: If your driver uses existing interfaces and behaves like
64 other drivers in the same class it will be much more likely
3706baa8 65 to be accepted than if it invents gratuitous new ones.
1da177e4
LT
66 If you need to implement a common API over Linux and NT
67 drivers do it in userspace.
68
69Code: Please use the Linux style of code formatting as documented
70 in Documentation/CodingStyle. If you have sections of code
71 that need to be in other formats, for example because they
72 are shared with a windows driver kit and you want to
73 maintain them just once separate them out nicely and note
74 this fact.
75
76Portability: Pointers are not always 32bits, not all computers are little
77 endian, people do not all have floating point and you
78 shouldn't use inline x86 assembler in your driver without
79 careful thought. Pure x86 drivers generally are not popular.
80 If you only have x86 hardware it is hard to test portability
81 but it is easy to make sure the code can easily be made
82 portable.
83
84Clarity: It helps if anyone can see how to fix the driver. It helps
85 you because you get patches not bug reports. If you submit a
86 driver that intentionally obfuscates how the hardware works
87 it will go in the bitbucket.
88
5b795202
RW
89PM support: Since Linux is used on many portable and desktop systems, your
90 driver is likely to be used on such a system and therefore it
91 should support basic power management by implementing, if
92 necessary, the .suspend and .resume methods used during the
93 system-wide suspend and resume transitions. You should verify
94 that your driver correctly handles the suspend and resume, but
95 if you are unable to ensure that, please at least define the
96 .suspend method returning the -ENOSYS ("Function not
97 implemented") error. You should also try to make sure that your
98 driver uses as little power as possible when it's not doing
99 anything. For the driver testing instructions see
100 Documentation/power/drivers-testing.txt and for a relatively
101 complete overview of the power management issues related to
102 drivers see Documentation/power/devices.txt .
103
25985edc 104Control: In general if there is active maintenance of a driver by
3706baa8 105 the author then patches will be redirected to them unless
1da177e4
LT
106 they are totally obvious and without need of checking.
107 If you want to be the contact and update point for the
108 driver it is a good idea to state this in the comments,
109 and include an entry in MAINTAINERS for your driver.
110
111What Criteria Do Not Determine Acceptance
112-----------------------------------------
113
114Vendor: Being the hardware vendor and maintaining the driver is
115 often a good thing. If there is a stable working driver from
116 other people already in the tree don't expect 'we are the
3706baa8 117 vendor' to get your driver chosen. Ideally work with the
1da177e4
LT
118 existing driver author to build a single perfect driver.
119
120Author: It doesn't matter if a large Linux company wrote the driver,
121 or you did. Nobody has any special access to the kernel
122 tree. Anyone who tells you otherwise isn't telling the
123 whole story.
124
125
126Resources
127---------
128
129Linux kernel master tree:
130 ftp.??.kernel.org:/pub/linux/kernel/...
131 ?? == your country code, such as "us", "uk", "fr", etc.
132
399e1d9c 133 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git
6d06b81b 134
3706baa8 135Linux kernel mailing list:
1da177e4
LT
136 linux-kernel@vger.kernel.org
137 [mail majordomo@vger.kernel.org to subscribe]
138
139Linux Device Drivers, Third Edition (covers 2.6.10):
140 http://lwn.net/Kernel/LDD3/ (free version)
141
1da177e4
LT
142LWN.net:
143 Weekly summary of kernel development activity - http://lwn.net/
144 2.6 API changes:
145 http://lwn.net/Articles/2.6-kernel-api/
146 Porting drivers from prior kernels to 2.6:
147 http://lwn.net/Articles/driver-porting/
148
1da177e4
LT
149KernelNewbies:
150 Documentation and assistance for new kernel programmers
151 http://kernelnewbies.org/
152
153Linux USB project:
e1b114ee 154 http://www.linux-usb.org/
5b0ed2c6 155
3706baa8
AD
156How to NOT write kernel driver by Arjan van de Ven:
157 http://www.fenrus.org/how-to-not-write-a-device-driver-paper.pdf
5b0ed2c6
XVP
158
159Kernel Janitor:
0ea6e611 160 http://kernelnewbies.org/KernelJanitors
6d06b81b
AA
161
162GIT, Fast Version Control System:
163 http://git-scm.com/