Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | Submitting Drivers For The Linux Kernel |
| 2 | --------------------------------------- |
| 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 |
| 16 | by the Linux assigned name and number authority (currently better |
| 17 | known as H Peter Anvin). The site is http://www.lanana.org/. This |
| 18 | also deals with allocating numbers for devices that are not going to |
| 19 | be submitted to the mainstream kernel. |
| 20 | |
| 21 | If you don't use assigned numbers then when you device is submitted it will |
| 22 | get given an assigned number even if that is different from values you may |
| 23 | have shipped to customers before. |
| 24 | |
| 25 | Who To Submit Drivers To |
| 26 | ------------------------ |
| 27 | |
| 28 | Linux 2.0: |
| 29 | No new drivers are accepted for this kernel tree |
| 30 | |
| 31 | Linux 2.2: |
| 32 | If the code area has a general maintainer then please submit it to |
| 33 | the maintainer listed in MAINTAINERS in the kernel file. If the |
| 34 | maintainer does not respond or you cannot find the appropriate |
| 35 | maintainer then please contact Alan Cox <alan@lxorguk.ukuu.org.uk> |
| 36 | |
| 37 | Linux 2.4: |
| 38 | The same rules apply as 2.2. The final contact point for Linux 2.4 |
| 39 | submissions is Marcelo Tosatti <marcelo.tosatti@cyclades.com>. |
| 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 |
| 44 | submissions is Andrew Morton <akpm@osdl.org>. |
| 45 | |
| 46 | What Criteria Determine Acceptance |
| 47 | ---------------------------------- |
| 48 | |
| 49 | Licensing: The code must be released to us under the |
| 50 | GNU General Public License. We don't insist on any kind |
| 51 | of exclusively GPL licensing, and if you wish the driver |
| 52 | to be useful to other communities such as BSD you may well |
| 53 | wish to release under multiple licenses. |
| 54 | |
| 55 | Copyright: The copyright owner must agree to use of GPL. |
| 56 | It's best if the submitter and copyright owner |
| 57 | are the same person/entity. If not, the name of |
| 58 | the person/entity authorizing use of GPL should be |
| 59 | listed in case it's necessary to verify the will of |
| 60 | the copright owner. |
| 61 | |
| 62 | Interfaces: If your driver uses existing interfaces and behaves like |
| 63 | other drivers in the same class it will be much more likely |
| 64 | to be accepted than if it invents gratuitous new ones. |
| 65 | If you need to implement a common API over Linux and NT |
| 66 | drivers do it in userspace. |
| 67 | |
| 68 | Code: Please use the Linux style of code formatting as documented |
| 69 | in Documentation/CodingStyle. If you have sections of code |
| 70 | that need to be in other formats, for example because they |
| 71 | are shared with a windows driver kit and you want to |
| 72 | maintain them just once separate them out nicely and note |
| 73 | this fact. |
| 74 | |
| 75 | Portability: Pointers are not always 32bits, not all computers are little |
| 76 | endian, people do not all have floating point and you |
| 77 | shouldn't use inline x86 assembler in your driver without |
| 78 | careful thought. Pure x86 drivers generally are not popular. |
| 79 | If you only have x86 hardware it is hard to test portability |
| 80 | but it is easy to make sure the code can easily be made |
| 81 | portable. |
| 82 | |
| 83 | Clarity: It helps if anyone can see how to fix the driver. It helps |
| 84 | you because you get patches not bug reports. If you submit a |
| 85 | driver that intentionally obfuscates how the hardware works |
| 86 | it will go in the bitbucket. |
| 87 | |
| 88 | Control: In general if there is active maintainance of a driver by |
| 89 | the author then patches will be redirected to them unless |
| 90 | they are totally obvious and without need of checking. |
| 91 | If you want to be the contact and update point for the |
| 92 | driver it is a good idea to state this in the comments, |
| 93 | and include an entry in MAINTAINERS for your driver. |
| 94 | |
| 95 | What Criteria Do Not Determine Acceptance |
| 96 | ----------------------------------------- |
| 97 | |
| 98 | Vendor: Being the hardware vendor and maintaining the driver is |
| 99 | often a good thing. If there is a stable working driver from |
| 100 | other people already in the tree don't expect 'we are the |
| 101 | vendor' to get your driver chosen. Ideally work with the |
| 102 | existing driver author to build a single perfect driver. |
| 103 | |
| 104 | Author: It doesn't matter if a large Linux company wrote the driver, |
| 105 | or you did. Nobody has any special access to the kernel |
| 106 | tree. Anyone who tells you otherwise isn't telling the |
| 107 | whole story. |
| 108 | |
| 109 | |
| 110 | Resources |
| 111 | --------- |
| 112 | |
| 113 | Linux kernel master tree: |
| 114 | ftp.??.kernel.org:/pub/linux/kernel/... |
| 115 | ?? == your country code, such as "us", "uk", "fr", etc. |
| 116 | |
| 117 | Linux kernel mailing list: |
| 118 | linux-kernel@vger.kernel.org |
| 119 | [mail majordomo@vger.kernel.org to subscribe] |
| 120 | |
| 121 | Linux Device Drivers, Third Edition (covers 2.6.10): |
| 122 | http://lwn.net/Kernel/LDD3/ (free version) |
| 123 | |
| 124 | Kernel traffic: |
| 125 | Weekly summary of kernel list activity (much easier to read) |
| 126 | http://www.kerneltraffic.org/kernel-traffic/ |
| 127 | |
| 128 | LWN.net: |
| 129 | Weekly summary of kernel development activity - http://lwn.net/ |
| 130 | 2.6 API changes: |
| 131 | http://lwn.net/Articles/2.6-kernel-api/ |
| 132 | Porting drivers from prior kernels to 2.6: |
| 133 | http://lwn.net/Articles/driver-porting/ |
| 134 | |
| 135 | KernelTrap: |
| 136 | Occasional Linux kernel articles and developer interviews |
| 137 | http://kerneltrap.org/ |
| 138 | |
| 139 | KernelNewbies: |
| 140 | Documentation and assistance for new kernel programmers |
| 141 | http://kernelnewbies.org/ |
| 142 | |
| 143 | Linux USB project: |
| 144 | http://sourceforge.net/projects/linux-usb/ |
| 145 | |