aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gl518sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/gl518sm.c')
-rw-r--r--drivers/hwmon/gl518sm.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
index 7820df45d77a..e7ae5743e181 100644
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -46,8 +46,7 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
-/* Insmod parameters */
-I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80);
+enum chips { gl518sm_r00, gl518sm_r80 };
/* Many GL518 constants specified below */
@@ -139,8 +138,7 @@ struct gl518_data {
static int gl518_probe(struct i2c_client *client,
const struct i2c_device_id *id);
-static int gl518_detect(struct i2c_client *client, int kind,
- struct i2c_board_info *info);
+static int gl518_detect(struct i2c_client *client, struct i2c_board_info *info);
static void gl518_init_client(struct i2c_client *client);
static int gl518_remove(struct i2c_client *client);
static int gl518_read_value(struct i2c_client *client, u8 reg);
@@ -163,7 +161,7 @@ static struct i2c_driver gl518_driver = {
.remove = gl518_remove,
.id_table = gl518_id,
.detect = gl518_detect,
- .address_data = &addr_data,
+ .address_list = normal_i2c,
};
/*
@@ -484,40 +482,24 @@ static const struct attribute_group gl518_group_r80 = {
*/
/* Return 0 if detection is successful, -ENODEV otherwise */
-static int gl518_detect(struct i2c_client *client, int kind,
- struct i2c_board_info *info)
+static int gl518_detect(struct i2c_client *client, struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;
- int i;
+ int rev;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV;
/* Now, we do the remaining detection. */
-
- if (kind < 0) {
- if ((gl518_read_value(client, GL518_REG_CHIP_ID) != 0x80)
- || (gl518_read_value(client, GL518_REG_CONF) & 0x80))
- return -ENODEV;
- }
+ if ((gl518_read_value(client, GL518_REG_CHIP_ID) != 0x80)
+ || (gl518_read_value(client, GL518_REG_CONF) & 0x80))
+ return -ENODEV;
/* Determine the chip type. */
- if (kind <= 0) {
- i = gl518_read_value(client, GL518_REG_REVISION);
- if (i == 0x00) {
- kind = gl518sm_r00;
- } else if (i == 0x80) {
- kind = gl518sm_r80;
- } else {
- if (kind <= 0)
- dev_info(&adapter->dev,
- "Ignoring 'force' parameter for unknown "
- "chip at adapter %d, address 0x%02x\n",
- i2c_adapter_id(adapter), client->addr);
- return -ENODEV;
- }
- }
+ rev = gl518_read_value(client, GL518_REG_REVISION);
+ if (rev != 0x00 && rev != 0x80)
+ return -ENODEV;
strlcpy(info->type, "gl518sm", I2C_NAME_SIZE);