From 52df6440a29123eed912183fe785bbe174ef14b9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 9 Dec 2009 20:35:57 +0100 Subject: hwmon: Clean up detect functions As kind is now hard-coded to -1, there is room for code clean-ups. Signed-off-by: Jean Delvare Acked-by: Corentin Labbe Cc: "Mark M. Hoffman" Cc: Juerg Haefliger Cc: Riku Voipio Acked-by: "Hans J. Koch" Cc: Rudolf Marek --- drivers/hwmon/ads7828.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'drivers/hwmon/ads7828.c') diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index 5c39b4af1b2..451977bca7d 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, struct i2c_board_info *info) { struct i2c_adapter *adapter = client->adapter; + int ch; /* Check we have a valid client */ 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, - Read from the 8 channel addresses - Check the top 4 bits of each result are not set (12 data bits) */ - if (kind < 0) { - int ch; - for (ch = 0; ch < ADS7828_NCH; ch++) { - u16 in_data; - u8 cmd = channel_cmd_byte(ch); - in_data = ads7828_read_value(client, cmd); - if (in_data & 0xF000) { - printk(KERN_DEBUG - "%s : Doesn't look like an ads7828 device\n", - __func__); - return -ENODEV; - } + for (ch = 0; ch < ADS7828_NCH; ch++) { + u16 in_data; + u8 cmd = channel_cmd_byte(ch); + in_data = ads7828_read_value(client, cmd); + if (in_data & 0xF000) { + pr_debug("%s : Doesn't look like an ads7828 device\n", + __func__); + return -ENODEV; } } + strlcpy(info->type, "ads7828", I2C_NAME_SIZE); return 0; -- cgit v1.2.3