aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/i2c/writing-clients
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-04-02 13:31:02 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:51:48 -0400
commitb3d5496ea5915fa4848fe307af9f7097f312e932 (patch)
treee358977311df194ebac13d57c5e8abf1a87bd65c /Documentation/i2c/writing-clients
parent2a5a68b840cbab31baab2d9b2e1e6de3b289ae1e (diff)
[PATCH] I2C: Kill address ranges in non-sensors i2c chip drivers
Some months ago, you killed the address ranges mechanism from all sensors i2c chip drivers (both the module parameters and the in-code address lists). I think it was a very good move, as the ranges can easily be replaced by individual addresses, and this allowed for significant cleanups in the i2c core (let alone the impressive size shrink for all these drivers). Unfortunately you did not do the same for non-sensors i2c chip drivers. These need the address ranges even less, so we could get rid of the ranges here as well for another significant i2c core cleanup. Here comes a patch which does just that. Since the process is exactly the same as what you did for the other drivers set already, I did not split this one in parts. A documentation update is included. The change saves 308 bytes in the i2c core, and an average 1382 bytes for chip drivers which use I2C_CLIENT_INSMOD, 126 bytes for those which do not. This change is required if we want to merge the sensors and non-sensors i2c code (and we want to do this). Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/Documentation/i2c/writing-clients ===================================================================
Diffstat (limited to 'Documentation/i2c/writing-clients')
-rw-r--r--Documentation/i2c/writing-clients62
1 files changed, 12 insertions, 50 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index ad27511e3c7d..f482dae81de3 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -171,45 +171,31 @@ The following lists are used internally:
171 171
172 normal_i2c: filled in by the module writer. 172 normal_i2c: filled in by the module writer.
173 A list of I2C addresses which should normally be examined. 173 A list of I2C addresses which should normally be examined.
174 normal_i2c_range: filled in by the module writer.
175 A list of pairs of I2C addresses, each pair being an inclusive range of
176 addresses which should normally be examined.
177 probe: insmod parameter. 174 probe: insmod parameter.
178 A list of pairs. The first value is a bus number (-1 for any I2C bus), 175 A list of pairs. The first value is a bus number (-1 for any I2C bus),
179 the second is the address. These addresses are also probed, as if they 176 the second is the address. These addresses are also probed, as if they
180 were in the 'normal' list. 177 were in the 'normal' list.
181 probe_range: insmod parameter.
182 A list of triples. The first value is a bus number (-1 for any I2C bus),
183 the second and third are addresses. These form an inclusive range of
184 addresses that are also probed, as if they were in the 'normal' list.
185 ignore: insmod parameter. 178 ignore: insmod parameter.
186 A list of pairs. The first value is a bus number (-1 for any I2C bus), 179 A list of pairs. The first value is a bus number (-1 for any I2C bus),
187 the second is the I2C address. These addresses are never probed. 180 the second is the I2C address. These addresses are never probed.
188 This parameter overrules 'normal' and 'probe', but not the 'force' lists. 181 This parameter overrules 'normal' and 'probe', but not the 'force' lists.
189 ignore_range: insmod parameter.
190 A list of triples. The first value is a bus number (-1 for any I2C bus),
191 the second and third are addresses. These form an inclusive range of
192 I2C addresses that are never probed.
193 This parameter overrules 'normal' and 'probe', but not the 'force' lists.
194 force: insmod parameter. 182 force: insmod parameter.
195 A list of pairs. The first value is a bus number (-1 for any I2C bus), 183 A list of pairs. The first value is a bus number (-1 for any I2C bus),
196 the second is the I2C address. A device is blindly assumed to be on 184 the second is the I2C address. A device is blindly assumed to be on
197 the given address, no probing is done. 185 the given address, no probing is done.
198 186
199Fortunately, as a module writer, you just have to define the `normal' 187Fortunately, as a module writer, you just have to define the `normal_i2c'
200and/or `normal_range' parameters. The complete declaration could look 188parameter. The complete declaration could look like this:
201like this:
202 189
203 /* Scan 0x20 to 0x2f, 0x37, and 0x40 to 0x4f */ 190 /* Scan 0x37, and 0x48 to 0x4f */
204 static unsigned short normal_i2c[] = { 0x37,I2C_CLIENT_END }; 191 static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
205 static unsigned short normal_i2c_range[] = { 0x20, 0x2f, 0x40, 0x4f, 192 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
206 I2C_CLIENT_END };
207 193
208 /* Magic definition of all other variables and things */ 194 /* Magic definition of all other variables and things */
209 I2C_CLIENT_INSMOD; 195 I2C_CLIENT_INSMOD;
210 196
211Note that you *have* to call the two defined variables `normal_i2c' and 197Note that you *have* to call the defined variable `normal_i2c',
212`normal_i2c_range', without any prefix! 198without any prefix!
213 199
214 200
215Probing classes (sensors) 201Probing classes (sensors)
@@ -223,39 +209,17 @@ The following lists are used internally. They are all lists of integers.
223 209
224 normal_i2c: filled in by the module writer. Terminated by SENSORS_I2C_END. 210 normal_i2c: filled in by the module writer. Terminated by SENSORS_I2C_END.
225 A list of I2C addresses which should normally be examined. 211 A list of I2C addresses which should normally be examined.
226 normal_i2c_range: filled in by the module writer. Terminated by
227 SENSORS_I2C_END
228 A list of pairs of I2C addresses, each pair being an inclusive range of
229 addresses which should normally be examined.
230 normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END. 212 normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END.
231 A list of ISA addresses which should normally be examined. 213 A list of ISA addresses which should normally be examined.
232 normal_isa_range: filled in by the module writer. Terminated by
233 SENSORS_ISA_END
234 A list of triples. The first two elements are ISA addresses, being an
235 range of addresses which should normally be examined. The third is the
236 modulo parameter: only addresses which are 0 module this value relative
237 to the first address of the range are actually considered.
238 probe: insmod parameter. Initialize this list with SENSORS_I2C_END values. 214 probe: insmod parameter. Initialize this list with SENSORS_I2C_END values.
239 A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for 215 A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for
240 the ISA bus, -1 for any I2C bus), the second is the address. These 216 the ISA bus, -1 for any I2C bus), the second is the address. These
241 addresses are also probed, as if they were in the 'normal' list. 217 addresses are also probed, as if they were in the 'normal' list.
242 probe_range: insmod parameter. Initialize this list with SENSORS_I2C_END
243 values.
244 A list of triples. The first value is a bus number (SENSORS_ISA_BUS for
245 the ISA bus, -1 for any I2C bus), the second and third are addresses.
246 These form an inclusive range of addresses that are also probed, as
247 if they were in the 'normal' list.
248 ignore: insmod parameter. Initialize this list with SENSORS_I2C_END values. 218 ignore: insmod parameter. Initialize this list with SENSORS_I2C_END values.
249 A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for 219 A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for
250 the ISA bus, -1 for any I2C bus), the second is the I2C address. These 220 the ISA bus, -1 for any I2C bus), the second is the I2C address. These
251 addresses are never probed. This parameter overrules 'normal' and 221 addresses are never probed. This parameter overrules 'normal' and
252 'probe', but not the 'force' lists. 222 'probe', but not the 'force' lists.
253 ignore_range: insmod parameter. Initialize this list with SENSORS_I2C_END
254 values.
255 A list of triples. The first value is a bus number (SENSORS_ISA_BUS for
256 the ISA bus, -1 for any I2C bus), the second and third are addresses.
257 These form an inclusive range of I2C addresses that are never probed.
258 This parameter overrules 'normal' and 'probe', but not the 'force' lists.
259 223
260Also used is a list of pointers to sensors_force_data structures: 224Also used is a list of pointers to sensors_force_data structures:
261 force_data: insmod parameters. A list, ending with an element of which 225 force_data: insmod parameters. A list, ending with an element of which
@@ -269,16 +233,14 @@ Also used is a list of pointers to sensors_force_data structures:
269So we have a generic insmod variabled `force', and chip-specific variables 233So we have a generic insmod variabled `force', and chip-specific variables
270`force_CHIPNAME'. 234`force_CHIPNAME'.
271 235
272Fortunately, as a module writer, you just have to define the `normal' 236Fortunately, as a module writer, you just have to define the `normal_i2c'
273and/or `normal_range' parameters, and define what chip names are used. 237and `normal_isa' parameters, and define what chip names are used.
274The complete declaration could look like this: 238The complete declaration could look like this:
275 /* Scan i2c addresses 0x20 to 0x2f, 0x37, and 0x40 to 0x4f 239 /* Scan i2c addresses 0x37, and 0x48 to 0x4f */
276 static unsigned short normal_i2c[] = {0x37,SENSORS_I2C_END}; 240 static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
277 static unsigned short normal_i2c_range[] = {0x20,0x2f,0x40,0x4f, 241 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
278 SENSORS_I2C_END};
279 /* Scan ISA address 0x290 */ 242 /* Scan ISA address 0x290 */
280 static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END}; 243 static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END};
281 static unsigned int normal_isa_range[] = {SENSORS_ISA_END};
282 244
283 /* Define chips foo and bar, as well as all module parameters and things */ 245 /* Define chips foo and bar, as well as all module parameters and things */
284 SENSORS_INSMOD_2(foo,bar); 246 SENSORS_INSMOD_2(foo,bar);