aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adt7470.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/hwmon/adt7470.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/hwmon/adt7470.c')
-rw-r--r--drivers/hwmon/adt7470.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 633e1a1e9d79..9e775717abb7 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -29,13 +29,11 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/log2.h> 30#include <linux/log2.h>
31#include <linux/kthread.h> 31#include <linux/kthread.h>
32#include <linux/slab.h>
32 33
33/* Addresses to scan */ 34/* Addresses to scan */
34static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; 35static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
35 36
36/* Insmod parameters */
37I2C_CLIENT_INSMOD_1(adt7470);
38
39/* ADT7470 registers */ 37/* ADT7470 registers */
40#define ADT7470_REG_BASE_ADDR 0x20 38#define ADT7470_REG_BASE_ADDR 0x20
41#define ADT7470_REG_TEMP_BASE_ADDR 0x20 39#define ADT7470_REG_TEMP_BASE_ADDR 0x20
@@ -177,12 +175,12 @@ struct adt7470_data {
177 175
178static int adt7470_probe(struct i2c_client *client, 176static int adt7470_probe(struct i2c_client *client,
179 const struct i2c_device_id *id); 177 const struct i2c_device_id *id);
180static int adt7470_detect(struct i2c_client *client, int kind, 178static int adt7470_detect(struct i2c_client *client,
181 struct i2c_board_info *info); 179 struct i2c_board_info *info);
182static int adt7470_remove(struct i2c_client *client); 180static int adt7470_remove(struct i2c_client *client);
183 181
184static const struct i2c_device_id adt7470_id[] = { 182static const struct i2c_device_id adt7470_id[] = {
185 { "adt7470", adt7470 }, 183 { "adt7470", 0 },
186 { } 184 { }
187}; 185};
188MODULE_DEVICE_TABLE(i2c, adt7470_id); 186MODULE_DEVICE_TABLE(i2c, adt7470_id);
@@ -196,7 +194,7 @@ static struct i2c_driver adt7470_driver = {
196 .remove = adt7470_remove, 194 .remove = adt7470_remove,
197 .id_table = adt7470_id, 195 .id_table = adt7470_id,
198 .detect = adt7470_detect, 196 .detect = adt7470_detect,
199 .address_data = &addr_data, 197 .address_list = normal_i2c,
200}; 198};
201 199
202/* 200/*
@@ -1225,31 +1223,26 @@ static struct attribute *adt7470_attr[] =
1225}; 1223};
1226 1224
1227/* Return 0 if detection is successful, -ENODEV otherwise */ 1225/* Return 0 if detection is successful, -ENODEV otherwise */
1228static int adt7470_detect(struct i2c_client *client, int kind, 1226static int adt7470_detect(struct i2c_client *client,
1229 struct i2c_board_info *info) 1227 struct i2c_board_info *info)
1230{ 1228{
1231 struct i2c_adapter *adapter = client->adapter; 1229 struct i2c_adapter *adapter = client->adapter;
1230 int vendor, device, revision;
1232 1231
1233 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1232 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1234 return -ENODEV; 1233 return -ENODEV;
1235 1234
1236 if (kind <= 0) { 1235 vendor = i2c_smbus_read_byte_data(client, ADT7470_REG_VENDOR);
1237 int vendor, device, revision; 1236 if (vendor != ADT7470_VENDOR)
1238 1237 return -ENODEV;
1239 vendor = i2c_smbus_read_byte_data(client, ADT7470_REG_VENDOR);
1240 if (vendor != ADT7470_VENDOR)
1241 return -ENODEV;
1242 1238
1243 device = i2c_smbus_read_byte_data(client, ADT7470_REG_DEVICE); 1239 device = i2c_smbus_read_byte_data(client, ADT7470_REG_DEVICE);
1244 if (device != ADT7470_DEVICE) 1240 if (device != ADT7470_DEVICE)
1245 return -ENODEV; 1241 return -ENODEV;
1246 1242
1247 revision = i2c_smbus_read_byte_data(client, 1243 revision = i2c_smbus_read_byte_data(client, ADT7470_REG_REVISION);
1248 ADT7470_REG_REVISION); 1244 if (revision != ADT7470_REVISION)
1249 if (revision != ADT7470_REVISION) 1245 return -ENODEV;
1250 return -ENODEV;
1251 } else
1252 dev_dbg(&adapter->dev, "detection forced\n");
1253 1246
1254 strlcpy(info->type, "adt7470", I2C_NAME_SIZE); 1247 strlcpy(info->type, "adt7470", I2C_NAME_SIZE);
1255 1248