diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-07-19 17:57:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-05 12:14:11 -0400 |
commit | 4926c0d4de77c5396a274ee7941ed7fc02afed26 (patch) | |
tree | 64a2d9b6502f861f97afc47637527367b08881ae | |
parent | 2d8672c5a6ba0d3f1d8d3ad61ef67868941364f0 (diff) |
[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (6/9)
Kill all isa-related stuff from i2c_detect, it's not used anymore.
This is one major step in the directiom of merging i2c_probe and
i2c_detect. The last obstacle I can think of is the different way forced
addresses work between sensors and non-sensors i2c drivers. I'll deal
with that in a later patchset.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/i2c/i2c-sensor-detect.c | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/drivers/i2c/i2c-sensor-detect.c b/drivers/i2c/i2c-sensor-detect.c index f99a8161a9f1..5aede3ca9cb0 100644 --- a/drivers/i2c/i2c-sensor-detect.c +++ b/drivers/i2c/i2c-sensor-detect.c | |||
@@ -25,42 +25,34 @@ | |||
25 | #include <linux/i2c-sensor.h> | 25 | #include <linux/i2c-sensor.h> |
26 | 26 | ||
27 | static unsigned short empty[] = {I2C_CLIENT_END}; | 27 | static unsigned short empty[] = {I2C_CLIENT_END}; |
28 | static unsigned int empty_isa[] = {I2C_CLIENT_ISA_END}; | ||
29 | 28 | ||
30 | /* Very inefficient for ISA detects, and won't work for 10-bit addresses! */ | 29 | /* Won't work for 10-bit addresses! */ |
31 | int i2c_detect(struct i2c_adapter *adapter, | 30 | int i2c_detect(struct i2c_adapter *adapter, |
32 | struct i2c_address_data *address_data, | 31 | struct i2c_address_data *address_data, |
33 | int (*found_proc) (struct i2c_adapter *, int, int)) | 32 | int (*found_proc) (struct i2c_adapter *, int, int)) |
34 | { | 33 | { |
35 | int addr, i, found, j, err; | 34 | int addr, i, found, j, err; |
36 | struct i2c_force_data *this_force; | 35 | struct i2c_force_data *this_force; |
37 | int is_isa = i2c_is_isa_adapter(adapter); | 36 | int adapter_id = i2c_adapter_id(adapter); |
38 | int adapter_id = | ||
39 | is_isa ? ANY_I2C_ISA_BUS : i2c_adapter_id(adapter); | ||
40 | unsigned short *normal_i2c; | 37 | unsigned short *normal_i2c; |
41 | unsigned int *normal_isa; | ||
42 | unsigned short *probe; | 38 | unsigned short *probe; |
43 | unsigned short *ignore; | 39 | unsigned short *ignore; |
44 | 40 | ||
45 | /* Forget it if we can't probe using SMBUS_QUICK */ | 41 | /* Forget it if we can't probe using SMBUS_QUICK */ |
46 | if ((!is_isa) && | 42 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) |
47 | !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) | ||
48 | return -1; | 43 | return -1; |
49 | 44 | ||
50 | /* Use default "empty" list if the adapter doesn't specify any */ | 45 | /* Use default "empty" list if the adapter doesn't specify any */ |
51 | normal_i2c = probe = ignore = empty; | 46 | normal_i2c = probe = ignore = empty; |
52 | normal_isa = empty_isa; | ||
53 | if (address_data->normal_i2c) | 47 | if (address_data->normal_i2c) |
54 | normal_i2c = address_data->normal_i2c; | 48 | normal_i2c = address_data->normal_i2c; |
55 | if (address_data->normal_isa) | ||
56 | normal_isa = address_data->normal_isa; | ||
57 | if (address_data->probe) | 49 | if (address_data->probe) |
58 | probe = address_data->probe; | 50 | probe = address_data->probe; |
59 | if (address_data->ignore) | 51 | if (address_data->ignore) |
60 | ignore = address_data->ignore; | 52 | ignore = address_data->ignore; |
61 | 53 | ||
62 | for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) { | 54 | for (addr = 0x00; addr <= 0x7f; addr++) { |
63 | if (!is_isa && i2c_check_addr(adapter, addr)) | 55 | if (i2c_check_addr(adapter, addr)) |
64 | continue; | 56 | continue; |
65 | 57 | ||
66 | /* If it is in one of the force entries, we don't do any | 58 | /* If it is in one of the force entries, we don't do any |
@@ -69,7 +61,7 @@ int i2c_detect(struct i2c_adapter *adapter, | |||
69 | for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) { | 61 | for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) { |
70 | for (j = 0; !found && (this_force->force[j] != I2C_CLIENT_END); j += 2) { | 62 | for (j = 0; !found && (this_force->force[j] != I2C_CLIENT_END); j += 2) { |
71 | if ( ((adapter_id == this_force->force[j]) || | 63 | if ( ((adapter_id == this_force->force[j]) || |
72 | ((this_force->force[j] == ANY_I2C_BUS) && !is_isa)) && | 64 | (this_force->force[j] == ANY_I2C_BUS)) && |
73 | (addr == this_force->force[j + 1]) ) { | 65 | (addr == this_force->force[j + 1]) ) { |
74 | dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr); | 66 | dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr); |
75 | if ((err = found_proc(adapter, addr, this_force->kind))) | 67 | if ((err = found_proc(adapter, addr, this_force->kind))) |
@@ -85,8 +77,7 @@ int i2c_detect(struct i2c_adapter *adapter, | |||
85 | right now */ | 77 | right now */ |
86 | for (i = 0; !found && (ignore[i] != I2C_CLIENT_END); i += 2) { | 78 | for (i = 0; !found && (ignore[i] != I2C_CLIENT_END); i += 2) { |
87 | if ( ((adapter_id == ignore[i]) || | 79 | if ( ((adapter_id == ignore[i]) || |
88 | ((ignore[i] == ANY_I2C_BUS) && | 80 | (ignore[i] == ANY_I2C_BUS)) && |
89 | !is_isa)) && | ||
90 | (addr == ignore[i + 1])) { | 81 | (addr == ignore[i + 1])) { |
91 | dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr); | 82 | dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr); |
92 | found = 1; | 83 | found = 1; |
@@ -97,19 +88,10 @@ int i2c_detect(struct i2c_adapter *adapter, | |||
97 | 88 | ||
98 | /* Now, we will do a detection, but only if it is in the normal or | 89 | /* Now, we will do a detection, but only if it is in the normal or |
99 | probe entries */ | 90 | probe entries */ |
100 | if (is_isa) { | 91 | for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) { |
101 | for (i = 0; !found && (normal_isa[i] != I2C_CLIENT_ISA_END); i += 1) { | 92 | if (addr == normal_i2c[i]) { |
102 | if (addr == normal_isa[i]) { | 93 | found = 1; |
103 | dev_dbg(&adapter->dev, "found normal isa entry for adapter %d, addr %04x\n", adapter_id, addr); | 94 | dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr); |
104 | found = 1; | ||
105 | } | ||
106 | } | ||
107 | } else { | ||
108 | for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) { | ||
109 | if (addr == normal_i2c[i]) { | ||
110 | found = 1; | ||
111 | dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr); | ||
112 | } | ||
113 | } | 95 | } |
114 | } | 96 | } |
115 | 97 | ||
@@ -117,7 +99,7 @@ int i2c_detect(struct i2c_adapter *adapter, | |||
117 | !found && (probe[i] != I2C_CLIENT_END); | 99 | !found && (probe[i] != I2C_CLIENT_END); |
118 | i += 2) { | 100 | i += 2) { |
119 | if (((adapter_id == probe[i]) || | 101 | if (((adapter_id == probe[i]) || |
120 | ((probe[i] == ANY_I2C_BUS) && !is_isa)) | 102 | (probe[i] == ANY_I2C_BUS)) |
121 | && (addr == probe[i + 1])) { | 103 | && (addr == probe[i + 1])) { |
122 | dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr); | 104 | dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr); |
123 | found = 1; | 105 | found = 1; |
@@ -128,8 +110,7 @@ int i2c_detect(struct i2c_adapter *adapter, | |||
128 | 110 | ||
129 | /* OK, so we really should examine this address. First check | 111 | /* OK, so we really should examine this address. First check |
130 | whether there is some client here at all! */ | 112 | whether there is some client here at all! */ |
131 | if (is_isa || | 113 | if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0) |
132 | (i2c_smbus_xfer (adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0)) | ||
133 | if ((err = found_proc(adapter, addr, -1))) | 114 | if ((err = found_proc(adapter, addr, -1))) |
134 | return err; | 115 | return err; |
135 | } | 116 | } |