aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-06-19 10:58:18 -0400
committerJean Delvare <khali@linux-fr.org>2009-06-19 10:58:18 -0400
commit36789b5ea52bba961122b45f4383f553ec3b5a6c (patch)
tree8e4b23645de92f07c806b4ded07e6a6ed234a65d
parent729d6dd571464954f625e6b80950d9e4e3bd94f7 (diff)
i2c: Drop i2c_probe function
The legacy i2c_probe() function has no users left, get rid of it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <dbrownell@users.sourceforge.net>
-rw-r--r--drivers/i2c/i2c-core.c137
-rw-r--r--include/linux/i2c.h8
2 files changed, 0 insertions, 145 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index dc8bc9131447..d48438908e1e 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1032,144 +1032,7 @@ EXPORT_SYMBOL(i2c_master_recv);
1032 * Will not work for 10-bit addresses! 1032 * Will not work for 10-bit addresses!
1033 * ---------------------------------------------------- 1033 * ----------------------------------------------------
1034 */ 1034 */
1035static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind,
1036 int (*found_proc) (struct i2c_adapter *, int, int))
1037{
1038 int err;
1039
1040 /* Make sure the address is valid */
1041 if (addr < 0x03 || addr > 0x77) {
1042 dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
1043 addr);
1044 return -EINVAL;
1045 }
1046
1047 /* Skip if already in use */
1048 if (i2c_check_addr(adapter, addr))
1049 return 0;
1050
1051 /* Make sure there is something at this address, unless forced */
1052 if (kind < 0) {
1053 if (i2c_smbus_xfer(adapter, addr, 0, 0, 0,
1054 I2C_SMBUS_QUICK, NULL) < 0)
1055 return 0;
1056
1057 /* prevent 24RF08 corruption */
1058 if ((addr & ~0x0f) == 0x50)
1059 i2c_smbus_xfer(adapter, addr, 0, 0, 0,
1060 I2C_SMBUS_QUICK, NULL);
1061 }
1062
1063 /* Finally call the custom detection function */
1064 err = found_proc(adapter, addr, kind);
1065 /* -ENODEV can be returned if there is a chip at the given address
1066 but it isn't supported by this chip driver. We catch it here as
1067 this isn't an error. */
1068 if (err == -ENODEV)
1069 err = 0;
1070
1071 if (err)
1072 dev_warn(&adapter->dev, "Client creation failed at 0x%x (%d)\n",
1073 addr, err);
1074 return err;
1075}
1076
1077int i2c_probe(struct i2c_adapter *adapter,
1078 const struct i2c_client_address_data *address_data,
1079 int (*found_proc) (struct i2c_adapter *, int, int))
1080{
1081 int i, err;
1082 int adap_id = i2c_adapter_id(adapter);
1083
1084 /* Force entries are done first, and are not affected by ignore
1085 entries */
1086 if (address_data->forces) {
1087 const unsigned short * const *forces = address_data->forces;
1088 int kind;
1089
1090 for (kind = 0; forces[kind]; kind++) {
1091 for (i = 0; forces[kind][i] != I2C_CLIENT_END;
1092 i += 2) {
1093 if (forces[kind][i] == adap_id
1094 || forces[kind][i] == ANY_I2C_BUS) {
1095 dev_dbg(&adapter->dev, "found force "
1096 "parameter for adapter %d, "
1097 "addr 0x%02x, kind %d\n",
1098 adap_id, forces[kind][i + 1],
1099 kind);
1100 err = i2c_probe_address(adapter,
1101 forces[kind][i + 1],
1102 kind, found_proc);
1103 if (err)
1104 return err;
1105 }
1106 }
1107 }
1108 }
1109
1110 /* Stop here if we can't use SMBUS_QUICK */
1111 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) {
1112 if (address_data->probe[0] == I2C_CLIENT_END
1113 && address_data->normal_i2c[0] == I2C_CLIENT_END)
1114 return 0;
1115
1116 dev_dbg(&adapter->dev, "SMBus Quick command not supported, "
1117 "can't probe for chips\n");
1118 return -EOPNOTSUPP;
1119 }
1120
1121 /* Probe entries are done second, and are not affected by ignore
1122 entries either */
1123 for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) {
1124 if (address_data->probe[i] == adap_id
1125 || address_data->probe[i] == ANY_I2C_BUS) {
1126 dev_dbg(&adapter->dev, "found probe parameter for "
1127 "adapter %d, addr 0x%02x\n", adap_id,
1128 address_data->probe[i + 1]);
1129 err = i2c_probe_address(adapter,
1130 address_data->probe[i + 1],
1131 -1, found_proc);
1132 if (err)
1133 return err;
1134 }
1135 }
1136
1137 /* Normal entries are done last, unless shadowed by an ignore entry */
1138 for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) {
1139 int j, ignore;
1140
1141 ignore = 0;
1142 for (j = 0; address_data->ignore[j] != I2C_CLIENT_END;
1143 j += 2) {
1144 if ((address_data->ignore[j] == adap_id ||
1145 address_data->ignore[j] == ANY_I2C_BUS)
1146 && address_data->ignore[j + 1]
1147 == address_data->normal_i2c[i]) {
1148 dev_dbg(&adapter->dev, "found ignore "
1149 "parameter for adapter %d, "
1150 "addr 0x%02x\n", adap_id,
1151 address_data->ignore[j + 1]);
1152 ignore = 1;
1153 break;
1154 }
1155 }
1156 if (ignore)
1157 continue;
1158
1159 dev_dbg(&adapter->dev, "found normal entry for adapter %d, "
1160 "addr 0x%02x\n", adap_id,
1161 address_data->normal_i2c[i]);
1162 err = i2c_probe_address(adapter, address_data->normal_i2c[i],
1163 -1, found_proc);
1164 if (err)
1165 return err;
1166 }
1167
1168 return 0;
1169}
1170EXPORT_SYMBOL(i2c_probe);
1171 1035
1172/* Separate detection function for new-style drivers */
1173static int i2c_detect_address(struct i2c_client *temp_client, int kind, 1036static int i2c_detect_address(struct i2c_client *temp_client, int kind,
1174 struct i2c_driver *driver) 1037 struct i2c_driver *driver)
1175{ 1038{
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 43a3545670b8..db25a870843a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -419,14 +419,6 @@ extern void i2c_release_client(struct i2c_client *client);
419extern void i2c_clients_command(struct i2c_adapter *adap, 419extern void i2c_clients_command(struct i2c_adapter *adap,
420 unsigned int cmd, void *arg); 420 unsigned int cmd, void *arg);
421 421
422/* Detect function. It iterates over all possible addresses itself.
423 * It will only call found_proc if some client is connected at the
424 * specific address (unless a 'force' matched);
425 */
426extern int i2c_probe(struct i2c_adapter *adapter,
427 const struct i2c_client_address_data *address_data,
428 int (*found_proc) (struct i2c_adapter *, int, int));
429
430extern struct i2c_adapter *i2c_get_adapter(int id); 422extern struct i2c_adapter *i2c_get_adapter(int id);
431extern void i2c_put_adapter(struct i2c_adapter *adap); 423extern void i2c_put_adapter(struct i2c_adapter *adap);
432 424