diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-07-31 15:45:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-05 12:14:20 -0400 |
commit | 96478ef3f3f71fa929cc905cc794993e312d9a5d (patch) | |
tree | 0d2200f9b89937944029880cd24f18d157d91901 | |
parent | 2ed2dc3c116d26fc6a9384e83d136b15cc203b6c (diff) |
[PATCH] hwmon: hwmon vs i2c, second round (05/11)
The i2c_detect function has no more user, delete it.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/i2c/Makefile | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-sensor-detect.c | 125 | ||||
-rw-r--r-- | drivers/i2c/i2c-sensor-vid.c | 5 | ||||
-rw-r--r-- | include/linux/i2c-sensor.h | 7 |
4 files changed, 6 insertions, 133 deletions
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index cd170395a8c7..71d68ad0e5ce 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -7,7 +7,7 @@ obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | |||
7 | obj-$(CONFIG_I2C_SENSOR) += i2c-sensor.o | 7 | obj-$(CONFIG_I2C_SENSOR) += i2c-sensor.o |
8 | obj-y += busses/ chips/ algos/ | 8 | obj-y += busses/ chips/ algos/ |
9 | 9 | ||
10 | i2c-sensor-objs := i2c-sensor-detect.o i2c-sensor-vid.o | 10 | i2c-sensor-objs := i2c-sensor-vid.o |
11 | 11 | ||
12 | 12 | ||
13 | ifeq ($(CONFIG_I2C_DEBUG_CORE),y) | 13 | ifeq ($(CONFIG_I2C_DEBUG_CORE),y) |
diff --git a/drivers/i2c/i2c-sensor-detect.c b/drivers/i2c/i2c-sensor-detect.c deleted file mode 100644 index 70fcf7281988..000000000000 --- a/drivers/i2c/i2c-sensor-detect.c +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | i2c-sensor-detect.c - Part of lm_sensors, Linux kernel modules for hardware | ||
3 | monitoring | ||
4 | Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl> and | ||
5 | Mark D. Studebaker <mdsxyz123@yahoo.com> | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/i2c.h> | ||
25 | #include <linux/i2c-sensor.h> | ||
26 | |||
27 | static unsigned short empty[] = {I2C_CLIENT_END}; | ||
28 | |||
29 | /* Won't work for 10-bit addresses! */ | ||
30 | int i2c_detect(struct i2c_adapter *adapter, | ||
31 | struct i2c_client_address_data *address_data, | ||
32 | int (*found_proc) (struct i2c_adapter *, int, int)) | ||
33 | { | ||
34 | int addr, i, found, j, err; | ||
35 | int adapter_id = i2c_adapter_id(adapter); | ||
36 | unsigned short *normal_i2c; | ||
37 | unsigned short *probe; | ||
38 | unsigned short *ignore; | ||
39 | |||
40 | /* Forget it if we can't probe using SMBUS_QUICK */ | ||
41 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) | ||
42 | return -1; | ||
43 | |||
44 | /* Use default "empty" list if the adapter doesn't specify any */ | ||
45 | normal_i2c = probe = ignore = empty; | ||
46 | if (address_data->normal_i2c) | ||
47 | normal_i2c = address_data->normal_i2c; | ||
48 | if (address_data->probe) | ||
49 | probe = address_data->probe; | ||
50 | if (address_data->ignore) | ||
51 | ignore = address_data->ignore; | ||
52 | |||
53 | for (addr = 0x00; addr <= 0x7f; addr++) { | ||
54 | if (i2c_check_addr(adapter, addr)) | ||
55 | continue; | ||
56 | |||
57 | /* If it is in one of the force entries, we don't do any | ||
58 | detection at all */ | ||
59 | found = 0; | ||
60 | for (i = 0; address_data->forces[i]; i++) { | ||
61 | for (j = 0; !found && (address_data->forces[i][j] != I2C_CLIENT_END); j += 2) { | ||
62 | if ( ((adapter_id == address_data->forces[i][j]) || | ||
63 | (address_data->forces[i][j] == ANY_I2C_BUS)) && | ||
64 | (addr == address_data->forces[i][j + 1]) ) { | ||
65 | dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr); | ||
66 | if ((err = found_proc(adapter, addr, i))) | ||
67 | return err; | ||
68 | found = 1; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | if (found) | ||
73 | continue; | ||
74 | |||
75 | /* If this address is in one of the ignores, we can forget about it | ||
76 | right now */ | ||
77 | for (i = 0; !found && (ignore[i] != I2C_CLIENT_END); i += 2) { | ||
78 | if ( ((adapter_id == ignore[i]) || | ||
79 | (ignore[i] == ANY_I2C_BUS)) && | ||
80 | (addr == ignore[i + 1])) { | ||
81 | dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr); | ||
82 | found = 1; | ||
83 | } | ||
84 | } | ||
85 | if (found) | ||
86 | continue; | ||
87 | |||
88 | /* Now, we will do a detection, but only if it is in the normal or | ||
89 | probe entries */ | ||
90 | for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) { | ||
91 | if (addr == normal_i2c[i]) { | ||
92 | found = 1; | ||
93 | dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | for (i = 0; | ||
98 | !found && (probe[i] != I2C_CLIENT_END); | ||
99 | i += 2) { | ||
100 | if (((adapter_id == probe[i]) || | ||
101 | (probe[i] == ANY_I2C_BUS)) | ||
102 | && (addr == probe[i + 1])) { | ||
103 | dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr); | ||
104 | found = 1; | ||
105 | } | ||
106 | } | ||
107 | if (!found) | ||
108 | continue; | ||
109 | |||
110 | /* OK, so we really should examine this address. First check | ||
111 | whether there is some client here at all! */ | ||
112 | if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0) | ||
113 | if ((err = found_proc(adapter, addr, -1))) | ||
114 | return err; | ||
115 | } | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | EXPORT_SYMBOL(i2c_detect); | ||
120 | |||
121 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, " | ||
122 | "Rudolf Marek <r.marek@sh.cvut.cz>"); | ||
123 | |||
124 | MODULE_DESCRIPTION("i2c-sensor driver"); | ||
125 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/i2c/i2c-sensor-vid.c b/drivers/i2c/i2c-sensor-vid.c index 922e22f054bb..b8ef289fc80e 100644 --- a/drivers/i2c/i2c-sensor-vid.c +++ b/drivers/i2c/i2c-sensor-vid.c | |||
@@ -96,3 +96,8 @@ int i2c_which_vrm(void) | |||
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | EXPORT_SYMBOL(i2c_which_vrm); | 98 | EXPORT_SYMBOL(i2c_which_vrm); |
99 | |||
100 | MODULE_AUTHOR("Rudolf Marek <r.marek@sh.cvut.cz>"); | ||
101 | |||
102 | MODULE_DESCRIPTION("i2c-sensor driver"); | ||
103 | MODULE_LICENSE("GPL"); | ||
diff --git a/include/linux/i2c-sensor.h b/include/linux/i2c-sensor.h index fc9284af9fae..1563d445dfd1 100644 --- a/include/linux/i2c-sensor.h +++ b/include/linux/i2c-sensor.h | |||
@@ -200,11 +200,4 @@ | |||
200 | NULL }; \ | 200 | NULL }; \ |
201 | SENSORS_INSMOD | 201 | SENSORS_INSMOD |
202 | 202 | ||
203 | /* Detect function. It iterates over all possible addresses itself. For | ||
204 | SMBus addresses, it will only call found_proc if some client is connected | ||
205 | to the SMBus (unless a 'force' matched). */ | ||
206 | extern int i2c_detect(struct i2c_adapter *adapter, | ||
207 | struct i2c_client_address_data *address_data, | ||
208 | int (*found_proc) (struct i2c_adapter *, int, int)); | ||
209 | |||
210 | #endif /* def _LINUX_I2C_SENSOR_H */ | 203 | #endif /* def _LINUX_I2C_SENSOR_H */ |