aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ads7828.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/ads7828.c')
-rw-r--r--drivers/hwmon/ads7828.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c
index 5c39b4af1b23..451977bca7d6 100644
--- a/drivers/hwmon/ads7828.c
+++ b/drivers/hwmon/ads7828.c
@@ -191,6 +191,7 @@ static int ads7828_detect(struct i2c_client *client, int kind,
191 struct i2c_board_info *info) 191 struct i2c_board_info *info)
192{ 192{
193 struct i2c_adapter *adapter = client->adapter; 193 struct i2c_adapter *adapter = client->adapter;
194 int ch;
194 195
195 /* Check we have a valid client */ 196 /* Check we have a valid client */
196 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) 197 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA))
@@ -202,20 +203,17 @@ static int ads7828_detect(struct i2c_client *client, int kind,
202 - Read from the 8 channel addresses 203 - Read from the 8 channel addresses
203 - Check the top 4 bits of each result are not set (12 data bits) 204 - Check the top 4 bits of each result are not set (12 data bits)
204 */ 205 */
205 if (kind < 0) { 206 for (ch = 0; ch < ADS7828_NCH; ch++) {
206 int ch; 207 u16 in_data;
207 for (ch = 0; ch < ADS7828_NCH; ch++) { 208 u8 cmd = channel_cmd_byte(ch);
208 u16 in_data; 209 in_data = ads7828_read_value(client, cmd);
209 u8 cmd = channel_cmd_byte(ch); 210 if (in_data & 0xF000) {
210 in_data = ads7828_read_value(client, cmd); 211 pr_debug("%s : Doesn't look like an ads7828 device\n",
211 if (in_data & 0xF000) { 212 __func__);
212 printk(KERN_DEBUG 213 return -ENODEV;
213 "%s : Doesn't look like an ads7828 device\n",
214 __func__);
215 return -ENODEV;
216 }
217 } 214 }
218 } 215 }
216
219 strlcpy(info->type, "ads7828", I2C_NAME_SIZE); 217 strlcpy(info->type, "ads7828", I2C_NAME_SIZE);
220 218
221 return 0; 219 return 0;