Blame view

Documentation/SubmittingDrivers 6.3 KB
609d99a3b   Mauro Carvalho Chehab   Documentation/HOW...
1
  .. _submittingdrivers:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
  Submitting Drivers For The Linux Kernel
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
3
  =======================================
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
5
6
7
8
9
10
11
12
13
14
15
16
  
  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
84da7c084   Randy Dunlap   [PATCH] Doc/Submi...
17
18
  by the Linux assigned name and number authority (currently this is
  Torben Mathiasen). The site is http://www.lanana.org/. This
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
20
  also deals with allocating numbers for devices that are not going to
  be submitted to the mainstream kernel.
84da7c084   Randy Dunlap   [PATCH] Doc/Submi...
21
  See Documentation/devices.txt for more information on this.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22

84da7c084   Randy Dunlap   [PATCH] Doc/Submi...
23
24
  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
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
26
27
28
29
30
  have shipped to customers before.
  
  Who To Submit Drivers To
  ------------------------
  
  Linux 2.0:
5b0ed2c64   Xose Vazquez Perez   [PATCH] docs: upd...
31
  	No new drivers are accepted for this kernel tree.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
33
  
  Linux 2.2:
5b0ed2c64   Xose Vazquez Perez   [PATCH] docs: upd...
34
35
36
  	No new drivers are accepted for this kernel tree.
  
  Linux 2.4:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
  	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
507a6a8c9   Li Yang   Update 2.4 mainta...
40
  	maintainer then please contact Willy Tarreau <w@1wt.eu>.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41

dca22a63f   Mauro Carvalho Chehab   docs-rst: add int...
42
  Linux 2.6 and upper:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
  	The same rules apply as 2.4 except that you should follow linux-kernel
dca22a63f   Mauro Carvalho Chehab   docs-rst: add int...
44
  	to track changes in API's. The final contact point for Linux 2.6+
e1f8e8744   Francois Cami   Remove Andrew Mor...
45
  	submissions is Andrew Morton.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
47
48
  
  What Criteria Determine Acceptance
  ----------------------------------
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
49
50
  Licensing:
  		The code must be released to us under the
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
  		GNU General Public License. We don't insist on any kind
84da7c084   Randy Dunlap   [PATCH] Doc/Submi...
52
  		of exclusive GPL licensing, and if you wish the driver
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
53
54
  		to be useful to other communities such as BSD you may well
  		wish to release under multiple licenses.
5b0ed2c64   Xose Vazquez Perez   [PATCH] docs: upd...
55
  		See accepted licenses at include/linux/module.h
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
56

ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
57
58
  Copyright:
  		The copyright owner must agree to use of GPL.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
60
61
62
  		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
3706baa8b   Alexey Dobriyan   [PATCH] Documenta...
63
  		the copyright owner.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64

ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
65
66
  Interfaces:
  		If your driver uses existing interfaces and behaves like
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
  		other drivers in the same class it will be much more likely
3706baa8b   Alexey Dobriyan   [PATCH] Documenta...
68
  		to be accepted than if it invents gratuitous new ones.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
69
70
  		If you need to implement a common API over Linux and NT
  		drivers do it in userspace.
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
71
72
  Code:
  		Please use the Linux style of code formatting as documented
dca22a63f   Mauro Carvalho Chehab   docs-rst: add int...
73
74
  		in :ref:`Documentation/CodingStyle <codingStyle>`.
  		If you have sections of code
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
77
78
  		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.
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
79
80
  Portability:
  		Pointers are not always 32bits, not all computers are little
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
82
83
84
85
86
  		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.
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
87
88
  Clarity:
  		It helps if anyone can see how to fix the driver. It helps
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
89
90
91
  		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.
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
92
93
  PM support:
  		Since Linux is used on many portable and desktop systems, your
5b7952021   Rafael J. Wysocki   Documentation: As...
94
95
96
97
98
99
100
101
102
103
104
105
106
  		driver is likely to be used on such a system and therefore it
  		should support basic power management by implementing, if
  		necessary, the .suspend and .resume methods used during the
  		system-wide suspend and resume transitions.  You should verify
  		that your driver correctly handles the suspend and resume, but
  		if you are unable to ensure that, please at least define the
  		.suspend method returning the -ENOSYS ("Function not
  		implemented") error.  You should also try to make sure that your
  		driver uses as little power as possible when it's not doing
  		anything.  For the driver testing instructions see
  		Documentation/power/drivers-testing.txt and for a relatively
  		complete overview of the power management issues related to
  		drivers see Documentation/power/devices.txt .
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
107
108
  Control:
  		In general if there is active maintenance of a driver by
3706baa8b   Alexey Dobriyan   [PATCH] Documenta...
109
  		the author then patches will be redirected to them unless
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
110
111
112
113
114
115
116
  		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
  -----------------------------------------
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
117
118
  Vendor:
  		Being the hardware vendor and maintaining the driver is
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
120
  		often a good thing. If there is a stable working driver from
  		other people already in the tree don't expect 'we are the
3706baa8b   Alexey Dobriyan   [PATCH] Documenta...
121
  		vendor' to get your driver chosen. Ideally work with the
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
  		existing driver author to build a single perfect driver.
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
123
124
  Author:
  		It doesn't matter if a large Linux company wrote the driver,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
126
127
128
129
130
131
132
133
  		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:
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
134
135
136
137
  	ftp.\ *country_code*\ .kernel.org:/pub/linux/kernel/...
  
  	where *country_code* == your country code, such as
  	**us**, **uk**, **fr**, etc.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138

399e1d9c2   Ralf Thielow   Documentation: Su...
139
  	http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git
6d06b81bc   Arce, Abraham   Documentation: Su...
140

3706baa8b   Alexey Dobriyan   [PATCH] Documenta...
141
  Linux kernel mailing list:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
142
143
144
145
146
  	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)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147
148
  LWN.net:
  	Weekly summary of kernel development activity - http://lwn.net/
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
149

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150
  	2.6 API changes:
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
151

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
152
  		http://lwn.net/Articles/2.6-kernel-api/
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
153

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
154
  	Porting drivers from prior kernels to 2.6:
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
155

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
  		http://lwn.net/Articles/driver-porting/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
157
158
  KernelNewbies:
  	Documentation and assistance for new kernel programmers
ceeb1a541   Mauro Carvalho Chehab   Documentation/Sub...
159
160
  
  		http://kernelnewbies.org/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
161
162
  
  Linux USB project:
e1b114ee9   Xose Vazquez Perez   [PATCH] docs: upd...
163
  	http://www.linux-usb.org/
5b0ed2c64   Xose Vazquez Perez   [PATCH] docs: upd...
164

3706baa8b   Alexey Dobriyan   [PATCH] Documenta...
165
166
  How to NOT write kernel driver by Arjan van de Ven:
  	http://www.fenrus.org/how-to-not-write-a-device-driver-paper.pdf
5b0ed2c64   Xose Vazquez Perez   [PATCH] docs: upd...
167
168
  
  Kernel Janitor:
0ea6e6112   Justin P. Mattock   Documentation: up...
169
  	http://kernelnewbies.org/KernelJanitors
6d06b81bc   Arce, Abraham   Documentation: Su...
170
171
172
  
  GIT, Fast Version Control System:
  	http://git-scm.com/