diff options
Diffstat (limited to 'drivers/hwmon/smsc47m1.c')
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index b07d01ecd2e3..8126fdd7cbee 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -37,17 +37,8 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | 39 | ||
40 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
41 | /* Address is autodetected, there is no default value */ | 40 | /* Address is autodetected, there is no default value */ |
42 | static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END }; | 41 | static unsigned short address; |
43 | static struct i2c_force_data forces[] = {{NULL}}; | ||
44 | |||
45 | enum chips { any_chip, smsc47m1 }; | ||
46 | static struct i2c_address_data addr_data = { | ||
47 | .normal_i2c = normal_i2c, | ||
48 | .normal_isa = normal_isa, | ||
49 | .forces = forces, | ||
50 | }; | ||
51 | 42 | ||
52 | /* Super-I/0 registers and commands */ | 43 | /* Super-I/0 registers and commands */ |
53 | 44 | ||
@@ -125,9 +116,7 @@ struct smsc47m1_data { | |||
125 | }; | 116 | }; |
126 | 117 | ||
127 | 118 | ||
128 | static int smsc47m1_attach_adapter(struct i2c_adapter *adapter); | 119 | static int smsc47m1_detect(struct i2c_adapter *adapter); |
129 | static int smsc47m1_find(int *address); | ||
130 | static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind); | ||
131 | static int smsc47m1_detach_client(struct i2c_client *client); | 120 | static int smsc47m1_detach_client(struct i2c_client *client); |
132 | 121 | ||
133 | static int smsc47m1_read_value(struct i2c_client *client, u8 reg); | 122 | static int smsc47m1_read_value(struct i2c_client *client, u8 reg); |
@@ -140,9 +129,7 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | |||
140 | static struct i2c_driver smsc47m1_driver = { | 129 | static struct i2c_driver smsc47m1_driver = { |
141 | .owner = THIS_MODULE, | 130 | .owner = THIS_MODULE, |
142 | .name = "smsc47m1", | 131 | .name = "smsc47m1", |
143 | .id = I2C_DRIVERID_SMSC47M1, | 132 | .attach_adapter = smsc47m1_detect, |
144 | .flags = I2C_DF_NOTIFY, | ||
145 | .attach_adapter = smsc47m1_attach_adapter, | ||
146 | .detach_client = smsc47m1_detach_client, | 133 | .detach_client = smsc47m1_detach_client, |
147 | }; | 134 | }; |
148 | 135 | ||
@@ -358,14 +345,7 @@ fan_present(2); | |||
358 | 345 | ||
359 | static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL); | 346 | static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL); |
360 | 347 | ||
361 | static int smsc47m1_attach_adapter(struct i2c_adapter *adapter) | 348 | static int smsc47m1_find(unsigned short *addr) |
362 | { | ||
363 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
364 | return 0; | ||
365 | return i2c_detect(adapter, &addr_data, smsc47m1_detect); | ||
366 | } | ||
367 | |||
368 | static int smsc47m1_find(int *address) | ||
369 | { | 349 | { |
370 | u8 val; | 350 | u8 val; |
371 | 351 | ||
@@ -392,10 +372,10 @@ static int smsc47m1_find(int *address) | |||
392 | } | 372 | } |
393 | 373 | ||
394 | superio_select(); | 374 | superio_select(); |
395 | *address = (superio_inb(SUPERIO_REG_BASE) << 8) | 375 | *addr = (superio_inb(SUPERIO_REG_BASE) << 8) |
396 | | superio_inb(SUPERIO_REG_BASE + 1); | 376 | | superio_inb(SUPERIO_REG_BASE + 1); |
397 | val = superio_inb(SUPERIO_REG_ACT); | 377 | val = superio_inb(SUPERIO_REG_ACT); |
398 | if (*address == 0 || (val & 0x01) == 0) { | 378 | if (*addr == 0 || (val & 0x01) == 0) { |
399 | printk(KERN_INFO "smsc47m1: Device is disabled, will not use\n"); | 379 | printk(KERN_INFO "smsc47m1: Device is disabled, will not use\n"); |
400 | superio_exit(); | 380 | superio_exit(); |
401 | return -ENODEV; | 381 | return -ENODEV; |
@@ -405,17 +385,13 @@ static int smsc47m1_find(int *address) | |||
405 | return 0; | 385 | return 0; |
406 | } | 386 | } |
407 | 387 | ||
408 | static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind) | 388 | static int smsc47m1_detect(struct i2c_adapter *adapter) |
409 | { | 389 | { |
410 | struct i2c_client *new_client; | 390 | struct i2c_client *new_client; |
411 | struct smsc47m1_data *data; | 391 | struct smsc47m1_data *data; |
412 | int err = 0; | 392 | int err = 0; |
413 | int fan1, fan2, pwm1, pwm2; | 393 | int fan1, fan2, pwm1, pwm2; |
414 | 394 | ||
415 | if (!i2c_is_isa_adapter(adapter)) { | ||
416 | return 0; | ||
417 | } | ||
418 | |||
419 | if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) { | 395 | if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) { |
420 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); | 396 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); |
421 | return -EBUSY; | 397 | return -EBUSY; |
@@ -589,7 +565,7 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | |||
589 | 565 | ||
590 | static int __init sm_smsc47m1_init(void) | 566 | static int __init sm_smsc47m1_init(void) |
591 | { | 567 | { |
592 | if (smsc47m1_find(normal_isa)) { | 568 | if (smsc47m1_find(&address)) { |
593 | return -ENODEV; | 569 | return -ENODEV; |
594 | } | 570 | } |
595 | 571 | ||