SubmittingDrivers 6.2 KB

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