diff options
Diffstat (limited to 'Documentation/i2c/porting-clients')
-rw-r--r-- | Documentation/i2c/porting-clients | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index a7adbdd9ea8a..4849dfd6961c 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients | |||
@@ -1,4 +1,4 @@ | |||
1 | Revision 4, 2004-03-30 | 1 | Revision 5, 2005-07-29 |
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 | ||
@@ -17,20 +17,22 @@ yours for best results. | |||
17 | 17 | ||
18 | Technical changes: | 18 | Technical changes: |
19 | 19 | ||
20 | * [Includes] Get rid of "version.h". Replace <linux/i2c-proc.h> with | 20 | * [Includes] Get rid of "version.h" and <linux/i2c-proc.h>. |
21 | <linux/i2c-sensor.h>. Includes typically look like that: | 21 | Includes typically look like that: |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/i2c-sensor.h> | 26 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ |
27 | #include <linux/i2c-vid.h> /* if you need VRM support */ | 27 | #include <linux/hwmon-sysfs.h> |
28 | #include <linux/hwmon-vid.h> /* if you need VRM support */ | ||
28 | #include <asm/io.h> /* if you have I/O operations */ | 29 | #include <asm/io.h> /* if you have I/O operations */ |
29 | Please respect this inclusion order. Some extra headers may be | 30 | Please respect this inclusion order. Some extra headers may be |
30 | required for a given driver (e.g. "lm75.h"). | 31 | required for a given driver (e.g. "lm75.h"). |
31 | 32 | ||
32 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, SENSORS_ISA_END | 33 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses |
33 | becomes I2C_CLIENT_ISA_END. | 34 | are no more handled by the i2c core. |
35 | SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. | ||
34 | 36 | ||
35 | * [Client data] Get rid of sysctl_id. Try using standard names for | 37 | * [Client data] Get rid of sysctl_id. Try using standard names for |
36 | register values (for example, temp_os becomes temp_max). You're | 38 | register values (for example, temp_os becomes temp_max). You're |
@@ -66,13 +68,15 @@ Technical changes: | |||
66 | if (!(adapter->class & I2C_CLASS_HWMON)) | 68 | if (!(adapter->class & I2C_CLASS_HWMON)) |
67 | return 0; | 69 | return 0; |
68 | ISA-only drivers of course don't need this. | 70 | ISA-only drivers of course don't need this. |
71 | Call i2c_probe() instead of i2c_detect(). | ||
69 | 72 | ||
70 | * [Detect] As mentioned earlier, the flags parameter is gone. | 73 | * [Detect] As mentioned earlier, the flags parameter is gone. |
71 | The type_name and client_name strings are replaced by a single | 74 | The type_name and client_name strings are replaced by a single |
72 | name string, which will be filled with a lowercase, short string | 75 | name string, which will be filled with a lowercase, short string |
73 | (typically the driver name, e.g. "lm75"). | 76 | (typically the driver name, e.g. "lm75"). |
74 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's | 77 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's |
75 | useless. | 78 | useless. Same for isa-only drivers, as the test would always be |
79 | true. Only hybrid drivers (which are quite rare) still need it. | ||
76 | The errorN labels are reduced to the number needed. If that number | 80 | The errorN labels are reduced to the number needed. If that number |
77 | is 2 (i2c-only drivers), it is advised that the labels are named | 81 | is 2 (i2c-only drivers), it is advised that the labels are named |
78 | exit and exit_free. For i2c+isa drivers, labels should be named | 82 | exit and exit_free. For i2c+isa drivers, labels should be named |
@@ -86,6 +90,8 @@ Technical changes: | |||
86 | device_create_file. Move the driver initialization before any | 90 | device_create_file. Move the driver initialization before any |
87 | sysfs file creation. | 91 | sysfs file creation. |
88 | Drop client->id. | 92 | Drop client->id. |
93 | Drop any 24RF08 corruption prevention you find, as this is now done | ||
94 | at the i2c-core level, and doing it twice voids it. | ||
89 | 95 | ||
90 | * [Init] Limits must not be set by the driver (can be done later in | 96 | * [Init] Limits must not be set by the driver (can be done later in |
91 | user-space). Chip should not be reset default (although a module | 97 | user-space). Chip should not be reset default (although a module |
@@ -93,7 +99,8 @@ Technical changes: | |||
93 | limited to the strictly necessary steps. | 99 | limited to the strictly necessary steps. |
94 | 100 | ||
95 | * [Detach] Get rid of data, remove the call to | 101 | * [Detach] Get rid of data, remove the call to |
96 | i2c_deregister_entry. | 102 | i2c_deregister_entry. Do not log an error message if |
103 | i2c_detach_client fails, as i2c-core will now do it for you. | ||
97 | 104 | ||
98 | * [Update] Don't access client->data directly, use | 105 | * [Update] Don't access client->data directly, use |
99 | i2c_get_clientdata(client) instead. | 106 | i2c_get_clientdata(client) instead. |