diff options
author | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-06 03:31:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-06 03:31:02 -0400 |
commit | 8566cfc9fe0934f52ddedc12b083176116c13978 (patch) | |
tree | b0f92fd0982a4dabaa2c108f4f1d130d2cff6798 /Documentation/i2c | |
parent | 7bdb2b6aca356c765bb697a4e9e7599357ee1542 (diff) | |
parent | 77ae84554cc0178e03862391599a0cedf96fa4c4 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
Diffstat (limited to 'Documentation/i2c')
-rw-r--r-- | Documentation/i2c/chips/max6875 | 94 | ||||
-rw-r--r-- | Documentation/i2c/functionality | 2 | ||||
-rw-r--r-- | Documentation/i2c/porting-clients | 25 | ||||
-rw-r--r-- | Documentation/i2c/writing-clients | 114 |
4 files changed, 115 insertions, 120 deletions
diff --git a/Documentation/i2c/chips/max6875 b/Documentation/i2c/chips/max6875 index b02002898a09..96fec562a8e9 100644 --- a/Documentation/i2c/chips/max6875 +++ b/Documentation/i2c/chips/max6875 | |||
@@ -4,22 +4,13 @@ Kernel driver max6875 | |||
4 | Supported chips: | 4 | Supported chips: |
5 | * Maxim MAX6874, MAX6875 | 5 | * Maxim MAX6874, MAX6875 |
6 | Prefix: 'max6875' | 6 | Prefix: 'max6875' |
7 | Addresses scanned: 0x50, 0x52 | 7 | Addresses scanned: None (see below) |
8 | Datasheet: | 8 | Datasheet: |
9 | http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf | 9 | http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf |
10 | 10 | ||
11 | Author: Ben Gardner <bgardner@wabtec.com> | 11 | Author: Ben Gardner <bgardner@wabtec.com> |
12 | 12 | ||
13 | 13 | ||
14 | Module Parameters | ||
15 | ----------------- | ||
16 | |||
17 | * allow_write int | ||
18 | Set to non-zero to enable write permission: | ||
19 | *0: Read only | ||
20 | 1: Read and write | ||
21 | |||
22 | |||
23 | Description | 14 | Description |
24 | ----------- | 15 | ----------- |
25 | 16 | ||
@@ -33,34 +24,85 @@ registers. | |||
33 | 24 | ||
34 | The Maxim MAX6874 is a similar, mostly compatible device, with more intputs | 25 | The Maxim MAX6874 is a similar, mostly compatible device, with more intputs |
35 | and outputs: | 26 | and outputs: |
36 | |||
37 | vin gpi vout | 27 | vin gpi vout |
38 | MAX6874 6 4 8 | 28 | MAX6874 6 4 8 |
39 | MAX6875 4 3 5 | 29 | MAX6875 4 3 5 |
40 | 30 | ||
41 | MAX6874 chips can have four different addresses (as opposed to only two for | 31 | See the datasheet for more information. |
42 | the MAX6875). The additional addresses (0x54 and 0x56) are not probed by | ||
43 | this driver by default, but the probe module parameter can be used if | ||
44 | needed. | ||
45 | |||
46 | See the datasheet for details on how to program the EEPROM. | ||
47 | 32 | ||
48 | 33 | ||
49 | Sysfs entries | 34 | Sysfs entries |
50 | ------------- | 35 | ------------- |
51 | 36 | ||
52 | eeprom_user - 512 bytes of user-defined EEPROM space. Only writable if | 37 | eeprom - 512 bytes of user-defined EEPROM space. |
53 | allow_write was set and register 0x43 is 0. | ||
54 | |||
55 | eeprom_config - 70 bytes of config EEPROM. Note that changes will not get | ||
56 | loaded into register space until a power cycle or device reset. | ||
57 | |||
58 | reg_config - 70 bytes of register space. Any changes take affect immediately. | ||
59 | 38 | ||
60 | 39 | ||
61 | General Remarks | 40 | General Remarks |
62 | --------------- | 41 | --------------- |
63 | 42 | ||
64 | A typical application will require that the EEPROMs be programmed once and | 43 | Valid addresses for the MAX6875 are 0x50 and 0x52. |
65 | never altered afterwards. | 44 | Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56. |
45 | The driver does not probe any address, so you must force the address. | ||
46 | |||
47 | Example: | ||
48 | $ modprobe max6875 force=0,0x50 | ||
49 | |||
50 | The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple | ||
51 | addresses. For example, for address 0x50, it also reserves 0x51. | ||
52 | The even-address instance is called 'max6875', the odd one is 'max6875 subclient'. | ||
53 | |||
54 | |||
55 | Programming the chip using i2c-dev | ||
56 | ---------------------------------- | ||
57 | |||
58 | Use the i2c-dev interface to access and program the chips. | ||
59 | Reads and writes are performed differently depending on the address range. | ||
60 | |||
61 | The configuration registers are at addresses 0x00 - 0x45. | ||
62 | Use i2c_smbus_write_byte_data() to write a register and | ||
63 | i2c_smbus_read_byte_data() to read a register. | ||
64 | The command is the register number. | ||
65 | |||
66 | Examples: | ||
67 | To write a 1 to register 0x45: | ||
68 | i2c_smbus_write_byte_data(fd, 0x45, 1); | ||
69 | |||
70 | To read register 0x45: | ||
71 | value = i2c_smbus_read_byte_data(fd, 0x45); | ||
72 | |||
73 | |||
74 | The configuration EEPROM is at addresses 0x8000 - 0x8045. | ||
75 | The user EEPROM is at addresses 0x8100 - 0x82ff. | ||
76 | |||
77 | Use i2c_smbus_write_word_data() to write a byte to EEPROM. | ||
78 | |||
79 | The command is the upper byte of the address: 0x80, 0x81, or 0x82. | ||
80 | The data word is the lower part of the address or'd with data << 8. | ||
81 | cmd = address >> 8; | ||
82 | val = (address & 0xff) | (data << 8); | ||
83 | |||
84 | Example: | ||
85 | To write 0x5a to address 0x8003: | ||
86 | i2c_smbus_write_word_data(fd, 0x80, 0x5a03); | ||
87 | |||
88 | |||
89 | Reading data from the EEPROM is a little more complicated. | ||
90 | Use i2c_smbus_write_byte_data() to set the read address and then | ||
91 | i2c_smbus_read_byte() or i2c_smbus_read_i2c_block_data() to read the data. | ||
92 | |||
93 | Example: | ||
94 | To read data starting at offset 0x8100, first set the address: | ||
95 | i2c_smbus_write_byte_data(fd, 0x81, 0x00); | ||
96 | |||
97 | And then read the data | ||
98 | value = i2c_smbus_read_byte(fd); | ||
99 | |||
100 | or | ||
101 | |||
102 | count = i2c_smbus_read_i2c_block_data(fd, 0x84, buffer); | ||
103 | |||
104 | The block read should read 16 bytes. | ||
105 | 0x84 is the block read command. | ||
106 | |||
107 | See the datasheet for more details. | ||
66 | 108 | ||
diff --git a/Documentation/i2c/functionality b/Documentation/i2c/functionality index 8a78a95ae04e..41ffefbdc60c 100644 --- a/Documentation/i2c/functionality +++ b/Documentation/i2c/functionality | |||
@@ -115,7 +115,7 @@ CHECKING THROUGH /DEV | |||
115 | If you try to access an adapter from a userspace program, you will have | 115 | If you try to access an adapter from a userspace program, you will have |
116 | to use the /dev interface. You will still have to check whether the | 116 | to use the /dev interface. You will still have to check whether the |
117 | functionality you need is supported, of course. This is done using | 117 | functionality you need is supported, of course. This is done using |
118 | the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2c_detect | 118 | the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2cdetect |
119 | program, is below: | 119 | program, is below: |
120 | 120 | ||
121 | int file; | 121 | int file; |
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. |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 91664be91ffc..077275722a7c 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -148,15 +148,15 @@ are defined in i2c.h to help you support them, as well as a generic | |||
148 | detection algorithm. | 148 | detection algorithm. |
149 | 149 | ||
150 | You do not have to use this parameter interface; but don't try to use | 150 | You do not have to use this parameter interface; but don't try to use |
151 | function i2c_probe() (or i2c_detect()) if you don't. | 151 | function i2c_probe() if you don't. |
152 | 152 | ||
153 | NOTE: If you want to write a `sensors' driver, the interface is slightly | 153 | NOTE: If you want to write a `sensors' driver, the interface is slightly |
154 | different! See below. | 154 | different! See below. |
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | Probing classes (i2c) | 158 | Probing classes |
159 | --------------------- | 159 | --------------- |
160 | 160 | ||
161 | All parameters are given as lists of unsigned 16-bit integers. Lists are | 161 | All parameters are given as lists of unsigned 16-bit integers. Lists are |
162 | terminated by I2C_CLIENT_END. | 162 | terminated by I2C_CLIENT_END. |
@@ -171,12 +171,18 @@ The following lists are used internally: | |||
171 | ignore: insmod parameter. | 171 | ignore: insmod parameter. |
172 | A list of pairs. The first value is a bus number (-1 for any I2C bus), | 172 | A list of pairs. The first value is a bus number (-1 for any I2C bus), |
173 | the second is the I2C address. These addresses are never probed. | 173 | the second is the I2C address. These addresses are never probed. |
174 | This parameter overrules 'normal' and 'probe', but not the 'force' lists. | 174 | This parameter overrules the 'normal_i2c' list only. |
175 | force: insmod parameter. | 175 | force: insmod parameter. |
176 | A list of pairs. The first value is a bus number (-1 for any I2C bus), | 176 | A list of pairs. The first value is a bus number (-1 for any I2C bus), |
177 | the second is the I2C address. A device is blindly assumed to be on | 177 | the second is the I2C address. A device is blindly assumed to be on |
178 | the given address, no probing is done. | 178 | the given address, no probing is done. |
179 | 179 | ||
180 | Additionally, kind-specific force lists may optionally be defined if | ||
181 | the driver supports several chip kinds. They are grouped in a | ||
182 | NULL-terminated list of pointers named forces, those first element if the | ||
183 | generic force list mentioned above. Each additional list correspond to an | ||
184 | insmod parameter of the form force_<kind>. | ||
185 | |||
180 | Fortunately, as a module writer, you just have to define the `normal_i2c' | 186 | Fortunately, as a module writer, you just have to define the `normal_i2c' |
181 | parameter. The complete declaration could look like this: | 187 | parameter. The complete declaration could look like this: |
182 | 188 | ||
@@ -186,66 +192,17 @@ parameter. The complete declaration could look like this: | |||
186 | 192 | ||
187 | /* Magic definition of all other variables and things */ | 193 | /* Magic definition of all other variables and things */ |
188 | I2C_CLIENT_INSMOD; | 194 | I2C_CLIENT_INSMOD; |
195 | /* Or, if your driver supports, say, 2 kind of devices: */ | ||
196 | I2C_CLIENT_INSMOD_2(foo, bar); | ||
197 | |||
198 | If you use the multi-kind form, an enum will be defined for you: | ||
199 | enum chips { any_chip, foo, bar, ... } | ||
200 | You can then (and certainly should) use it in the driver code. | ||
189 | 201 | ||
190 | Note that you *have* to call the defined variable `normal_i2c', | 202 | Note that you *have* to call the defined variable `normal_i2c', |
191 | without any prefix! | 203 | without any prefix! |
192 | 204 | ||
193 | 205 | ||
194 | Probing classes (sensors) | ||
195 | ------------------------- | ||
196 | |||
197 | If you write a `sensors' driver, you use a slightly different interface. | ||
198 | As well as I2C addresses, we have to cope with ISA addresses. Also, we | ||
199 | use a enum of chip types. Don't forget to include `sensors.h'. | ||
200 | |||
201 | The following lists are used internally. They are all lists of integers. | ||
202 | |||
203 | normal_i2c: filled in by the module writer. Terminated by SENSORS_I2C_END. | ||
204 | A list of I2C addresses which should normally be examined. | ||
205 | normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END. | ||
206 | A list of ISA addresses which should normally be examined. | ||
207 | probe: insmod parameter. Initialize this list with SENSORS_I2C_END values. | ||
208 | A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for | ||
209 | the ISA bus, -1 for any I2C bus), the second is the address. These | ||
210 | addresses are also probed, as if they were in the 'normal' list. | ||
211 | ignore: insmod parameter. Initialize this list with SENSORS_I2C_END values. | ||
212 | A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for | ||
213 | the ISA bus, -1 for any I2C bus), the second is the I2C address. These | ||
214 | addresses are never probed. This parameter overrules 'normal' and | ||
215 | 'probe', but not the 'force' lists. | ||
216 | |||
217 | Also used is a list of pointers to sensors_force_data structures: | ||
218 | force_data: insmod parameters. A list, ending with an element of which | ||
219 | the force field is NULL. | ||
220 | Each element contains the type of chip and a list of pairs. | ||
221 | The first value is a bus number (SENSORS_ISA_BUS for the ISA bus, | ||
222 | -1 for any I2C bus), the second is the address. | ||
223 | These are automatically translated to insmod variables of the form | ||
224 | force_foo. | ||
225 | |||
226 | So we have a generic insmod variabled `force', and chip-specific variables | ||
227 | `force_CHIPNAME'. | ||
228 | |||
229 | Fortunately, as a module writer, you just have to define the `normal_i2c' | ||
230 | and `normal_isa' parameters, and define what chip names are used. | ||
231 | The complete declaration could look like this: | ||
232 | /* Scan i2c addresses 0x37, and 0x48 to 0x4f */ | ||
233 | static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c, | ||
234 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; | ||
235 | /* Scan ISA address 0x290 */ | ||
236 | static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END}; | ||
237 | |||
238 | /* Define chips foo and bar, as well as all module parameters and things */ | ||
239 | SENSORS_INSMOD_2(foo,bar); | ||
240 | |||
241 | If you have one chip, you use macro SENSORS_INSMOD_1(chip), if you have 2 | ||
242 | you use macro SENSORS_INSMOD_2(chip1,chip2), etc. If you do not want to | ||
243 | bother with chip types, you can use SENSORS_INSMOD_0. | ||
244 | |||
245 | A enum is automatically defined as follows: | ||
246 | enum chips { any_chip, chip1, chip2, ... } | ||
247 | |||
248 | |||
249 | Attaching to an adapter | 206 | Attaching to an adapter |
250 | ----------------------- | 207 | ----------------------- |
251 | 208 | ||
@@ -264,17 +221,10 @@ detected at a specific address, another callback is called. | |||
264 | return i2c_probe(adapter,&addr_data,&foo_detect_client); | 221 | return i2c_probe(adapter,&addr_data,&foo_detect_client); |
265 | } | 222 | } |
266 | 223 | ||
267 | For `sensors' drivers, use the i2c_detect function instead: | ||
268 | |||
269 | int foo_attach_adapter(struct i2c_adapter *adapter) | ||
270 | { | ||
271 | return i2c_detect(adapter,&addr_data,&foo_detect_client); | ||
272 | } | ||
273 | |||
274 | Remember, structure `addr_data' is defined by the macros explained above, | 224 | Remember, structure `addr_data' is defined by the macros explained above, |
275 | so you do not have to define it yourself. | 225 | so you do not have to define it yourself. |
276 | 226 | ||
277 | The i2c_probe or i2c_detect function will call the foo_detect_client | 227 | The i2c_probe function will call the foo_detect_client |
278 | function only for those i2c addresses that actually have a device on | 228 | function only for those i2c addresses that actually have a device on |
279 | them (unless a `force' parameter was used). In addition, addresses that | 229 | them (unless a `force' parameter was used). In addition, addresses that |
280 | are already in use (by some other registered client) are skipped. | 230 | are already in use (by some other registered client) are skipped. |
@@ -283,19 +233,18 @@ are already in use (by some other registered client) are skipped. | |||
283 | The detect client function | 233 | The detect client function |
284 | -------------------------- | 234 | -------------------------- |
285 | 235 | ||
286 | The detect client function is called by i2c_probe or i2c_detect. | 236 | The detect client function is called by i2c_probe. The `kind' parameter |
287 | The `kind' parameter contains 0 if this call is due to a `force' | 237 | contains -1 for a probed detection, 0 for a forced detection, or a positive |
288 | parameter, and -1 otherwise (for i2c_detect, it contains 0 if | 238 | number for a forced detection with a chip type forced. |
289 | this call is due to the generic `force' parameter, and the chip type | ||
290 | number if it is due to a specific `force' parameter). | ||
291 | 239 | ||
292 | Below, some things are only needed if this is a `sensors' driver. Those | 240 | Below, some things are only needed if this is a `sensors' driver. Those |
293 | parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ | 241 | parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ |
294 | markers. | 242 | markers. |
295 | 243 | ||
296 | This function should only return an error (any value != 0) if there is | 244 | Returning an error different from -ENODEV in a detect function will cause |
297 | some reason why no more detection should be done anymore. If the | 245 | the detection to stop: other addresses and adapters won't be scanned. |
298 | detection just fails for this address, return 0. | 246 | This should only be done on fatal or internal errors, such as a memory |
247 | shortage or i2c_attach_client failing. | ||
299 | 248 | ||
300 | For now, you can ignore the `flags' parameter. It is there for future use. | 249 | For now, you can ignore the `flags' parameter. It is there for future use. |
301 | 250 | ||
@@ -320,11 +269,10 @@ For now, you can ignore the `flags' parameter. It is there for future use. | |||
320 | const char *type_name = ""; | 269 | const char *type_name = ""; |
321 | int is_isa = i2c_is_isa_adapter(adapter); | 270 | int is_isa = i2c_is_isa_adapter(adapter); |
322 | 271 | ||
323 | if (is_isa) { | 272 | /* Do this only if the chip can additionally be found on the ISA bus |
273 | (hybrid chip). */ | ||
324 | 274 | ||
325 | /* If this client can't be on the ISA bus at all, we can stop now | 275 | if (is_isa) { |
326 | (call `goto ERROR0'). But for kicks, we will assume it is all | ||
327 | right. */ | ||
328 | 276 | ||
329 | /* Discard immediately if this ISA range is already used */ | 277 | /* Discard immediately if this ISA range is already used */ |
330 | if (check_region(address,FOO_EXTENT)) | 278 | if (check_region(address,FOO_EXTENT)) |
@@ -495,15 +443,13 @@ much simpler than the attachment code, fortunately! | |||
495 | /* SENSORS ONLY END */ | 443 | /* SENSORS ONLY END */ |
496 | 444 | ||
497 | /* Try to detach the client from i2c space */ | 445 | /* Try to detach the client from i2c space */ |
498 | if ((err = i2c_detach_client(client))) { | 446 | if ((err = i2c_detach_client(client))) |
499 | printk("foo.o: Client deregistration failed, client not detached.\n"); | ||
500 | return err; | 447 | return err; |
501 | } | ||
502 | 448 | ||
503 | /* SENSORS ONLY START */ | 449 | /* HYBRID SENSORS CHIP ONLY START */ |
504 | if i2c_is_isa_client(client) | 450 | if i2c_is_isa_client(client) |
505 | release_region(client->addr,LM78_EXTENT); | 451 | release_region(client->addr,LM78_EXTENT); |
506 | /* SENSORS ONLY END */ | 452 | /* HYBRID SENSORS CHIP ONLY END */ |
507 | 453 | ||
508 | kfree(client); /* Frees client data too, if allocated at the same time */ | 454 | kfree(client); /* Frees client data too, if allocated at the same time */ |
509 | return 0; | 455 | return 0; |