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