diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-05-01 17:26:35 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-05-01 17:26:35 -0400 |
commit | eefcd75e72f382270f8f64e030550b10e3882b2b (patch) | |
tree | ccd55fa7068067ddd6299fe62dc15b22cc3ca46a /Documentation/i2c/porting-clients | |
parent | 35532d20035d04b0ec28508583a56c7a65c5fa47 (diff) |
i2c: Documentation update
Make the documentation on how to write and port i2c drivers more in
line with the current state of things:
* i2c-isa is deprecated and soon gone, so stop advertising it.
* Drop many sensors-specific references. Most of them were outdated
anyway.
* Update the example code to reflect the recent and not-so-recent
API and coding style preference changes.
* Simplify the example init and cleanup functions.
This should make things less complex to understand for newcomers.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'Documentation/i2c/porting-clients')
-rw-r--r-- | Documentation/i2c/porting-clients | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index ca272b263a92..7bf82c08f6ca 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients | |||
@@ -1,4 +1,4 @@ | |||
1 | Revision 6, 2005-11-20 | 1 | Revision 7, 2007-04-19 |
2 | Jean Delvare <khali@linux-fr.org> | 2 | Jean Delvare <khali@linux-fr.org> |
3 | Greg KH <greg@kroah.com> | 3 | Greg KH <greg@kroah.com> |
4 | 4 | ||
@@ -20,6 +20,10 @@ yours for best results. | |||
20 | 20 | ||
21 | Technical changes: | 21 | Technical changes: |
22 | 22 | ||
23 | * [Driver type] Any driver that was relying on i2c-isa has to be | ||
24 | converted to a proper isa, platform or pci driver. This is not | ||
25 | covered by this guide. | ||
26 | |||
23 | * [Includes] Get rid of "version.h" and <linux/i2c-proc.h>. | 27 | * [Includes] Get rid of "version.h" and <linux/i2c-proc.h>. |
24 | Includes typically look like that: | 28 | Includes typically look like that: |
25 | #include <linux/module.h> | 29 | #include <linux/module.h> |
@@ -27,12 +31,10 @@ Technical changes: | |||
27 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
28 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
29 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
30 | #include <linux/i2c-isa.h> /* for ISA drivers */ | ||
31 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ | 34 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ |
32 | #include <linux/hwmon-sysfs.h> | 35 | #include <linux/hwmon-sysfs.h> |
33 | #include <linux/hwmon-vid.h> /* if you need VRM support */ | 36 | #include <linux/hwmon-vid.h> /* if you need VRM support */ |
34 | #include <linux/err.h> /* for class registration */ | 37 | #include <linux/err.h> /* for class registration */ |
35 | #include <asm/io.h> /* if you have I/O operations */ | ||
36 | Please respect this inclusion order. Some extra headers may be | 38 | Please respect this inclusion order. Some extra headers may be |
37 | required for a given driver (e.g. "lm75.h"). | 39 | required for a given driver (e.g. "lm75.h"). |
38 | 40 | ||
@@ -69,20 +71,16 @@ Technical changes: | |||
69 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a | 71 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a |
70 | patch to the Documentation/hwmon/sysfs-interface file. | 72 | patch to the Documentation/hwmon/sysfs-interface file. |
71 | 73 | ||
72 | * [Attach] For I2C drivers, the attach function should make sure | 74 | * [Attach] The attach function should make sure that the adapter's |
73 | that the adapter's class has I2C_CLASS_HWMON (or whatever class is | 75 | class has I2C_CLASS_HWMON (or whatever class is suitable for your |
74 | suitable for your driver), using the following construct: | 76 | driver), using the following construct: |
75 | if (!(adapter->class & I2C_CLASS_HWMON)) | 77 | if (!(adapter->class & I2C_CLASS_HWMON)) |
76 | return 0; | 78 | return 0; |
77 | ISA-only drivers of course don't need this. | ||
78 | Call i2c_probe() instead of i2c_detect(). | 79 | Call i2c_probe() instead of i2c_detect(). |
79 | 80 | ||
80 | * [Detect] As mentioned earlier, the flags parameter is gone. | 81 | * [Detect] As mentioned earlier, the flags parameter is gone. |
81 | The type_name and client_name strings are replaced by a single | 82 | The type_name and client_name strings are replaced by a single |
82 | name string, which will be filled with a lowercase, short string. | 83 | name string, which will be filled with a lowercase, short string. |
83 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's | ||
84 | useless. Same for isa-only drivers, as the test would always be | ||
85 | true. Only hybrid drivers (which are quite rare) still need it. | ||
86 | The labels used for error paths are reduced to the number needed. | 84 | The labels used for error paths are reduced to the number needed. |
87 | It is advised that the labels are given descriptive names such as | 85 | It is advised that the labels are given descriptive names such as |
88 | exit and exit_free. Don't forget to properly set err before | 86 | exit and exit_free. Don't forget to properly set err before |