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