| 1 | These are the steps you should follow to write a new driver and |
|---|
| 2 | submit it to us so that it will be applied cleanly to our package. |
|---|
| 3 | |
|---|
| 4 | * Contact us first. |
|---|
| 5 | You are of course free to write your own drivers, but it is smart to |
|---|
| 6 | check first nobody else is already working on it. |
|---|
| 7 | Check our "New Drivers" page for information also. |
|---|
| 8 | |
|---|
| 9 | * Write the new driver. |
|---|
| 10 | For a chip driver, use lm78.c as template. For an SMBus-only adapter, |
|---|
| 11 | use i2c-piix4.c. Use i2c-via.c for an I2C-level adapter. |
|---|
| 12 | Usually, we make all prefixes start with the driver name. This is not |
|---|
| 13 | really necessary, as these symbols will not be exported anyway. But by |
|---|
| 14 | doing this, you are sure you do not shadow any global kernel names. |
|---|
| 15 | Remember that you want to output the direct measurements done by the |
|---|
| 16 | chip. If these sensor values need scaling, this should be done through |
|---|
| 17 | the configuration file. |
|---|
| 18 | |
|---|
| 19 | * Meet Kernel coding standards |
|---|
| 20 | See Documentation/CodingStyle in the kernel source. |
|---|
| 21 | Be sure and use 8 column tabs. |
|---|
| 22 | |
|---|
| 23 | * Add the driver to the Makefile. |
|---|
| 24 | Usually, you can just add it to KERNEL{CHIPS,DRIVERS}TARGETS in the |
|---|
| 25 | Module.mk file in the directory itself. |
|---|
| 26 | |
|---|
| 27 | * Make sure it compiles cleanly. |
|---|
| 28 | If you compile with 'make WARN=1', you usually get many additional |
|---|
| 29 | warnings. Please resolve these too, even if you know they are |
|---|
| 30 | harmless. Do the same with 'make DEBUG=1 WARN=1' if you use debugging |
|---|
| 31 | information. Remember, things put between #ifdef DEBUG #endif may never |
|---|
| 32 | stop the driver from functioning; they should just output additional |
|---|
| 33 | information. |
|---|
| 34 | |
|---|
| 35 | * Check for external symbols |
|---|
| 36 | 'nm --extern --defined' should only output symbols starting with __module, |
|---|
| 37 | cleanup_module, init_module and some kernel versioning symbols. Mark all |
|---|
| 38 | other symbols as static in your source file. |
|---|
| 39 | |
|---|
| 40 | * Test the module |
|---|
| 41 | This is usually the boring part... |
|---|
| 42 | Test both with 2.2.x and 2.4.x kernels. |
|---|
| 43 | |
|---|
| 44 | * Add detection information to prog/detect/sensors-detect |
|---|
| 45 | This is a perl script that automatically detects what chips and adapters |
|---|
| 46 | are present. Contact Frodo if you need help. |
|---|
| 47 | |
|---|
| 48 | * Add chip information to lib/chips.{c,h} for chip drivers |
|---|
| 49 | Until you have done this, the chip will be invisible for user-level |
|---|
| 50 | programs. Again, contact Frodo if you need help with this. |
|---|
| 51 | |
|---|
| 52 | * Add entries to etc/sensors.conf.eg |
|---|
| 53 | If needed, you can set defaults here. |
|---|
| 54 | |
|---|
| 55 | * Add a dedicated procedure to prog/sensors/chips.[ch] |
|---|
| 56 | This makes the included sensors program pretty-print your chip information. |
|---|
| 57 | |
|---|
| 58 | * Add the name of the device to the README file. |
|---|
| 59 | |
|---|
| 60 | * Add your name to the CONTRIBUTORS file. |
|---|
| 61 | |
|---|
| 62 | * Add entries to the CHANGES file. |
|---|
| 63 | |
|---|
| 64 | * Write a doc/chips/xxx or doc/busses/xxx file. |
|---|
| 65 | |
|---|
| 66 | * Make sure the GPL boilerplate and your name (and if applicable your |
|---|
| 67 | company's name) is at the top of the |
|---|
| 68 | new driver so we know you are giving it to us under the GPL. |
|---|
| 69 | |
|---|
| 70 | * Submit the changes to us a patch against CVS. |
|---|