diff options
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index a3c642ef5c42..b14801cd615d 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -41,19 +41,13 @@ | |||
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/i2c.h> | 42 | #include <linux/i2c.h> |
43 | #include <linux/i2c-isa.h> | 43 | #include <linux/i2c-isa.h> |
44 | #include <linux/i2c-sensor.h> | ||
45 | #include <linux/hwmon.h> | 44 | #include <linux/hwmon.h> |
46 | #include <linux/err.h> | 45 | #include <linux/err.h> |
47 | #include <asm/io.h> | 46 | #include <asm/io.h> |
48 | #include "lm75.h" | 47 | #include "lm75.h" |
49 | 48 | ||
50 | /* Addresses to scan | 49 | /* The actual ISA address is read from Super-I/O configuration space */ |
51 | The actual ISA address is read from Super-I/O configuration space */ | 50 | static unsigned short address; |
52 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
53 | static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END }; | ||
54 | |||
55 | /* Insmod parameters */ | ||
56 | SENSORS_INSMOD_1(w83627ehf); | ||
57 | 51 | ||
58 | /* | 52 | /* |
59 | * Super-I/O constants and functions | 53 | * Super-I/O constants and functions |
@@ -673,15 +667,12 @@ static void w83627ehf_init_client(struct i2c_client *client) | |||
673 | } | 667 | } |
674 | } | 668 | } |
675 | 669 | ||
676 | static int w83627ehf_detect(struct i2c_adapter *adapter, int address, int kind) | 670 | static int w83627ehf_detect(struct i2c_adapter *adapter) |
677 | { | 671 | { |
678 | struct i2c_client *client; | 672 | struct i2c_client *client; |
679 | struct w83627ehf_data *data; | 673 | struct w83627ehf_data *data; |
680 | int i, err = 0; | 674 | int i, err = 0; |
681 | 675 | ||
682 | if (!i2c_is_isa_adapter(adapter)) | ||
683 | return 0; | ||
684 | |||
685 | if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { | 676 | if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { |
686 | err = -EBUSY; | 677 | err = -EBUSY; |
687 | goto exit; | 678 | goto exit; |
@@ -776,13 +767,6 @@ exit: | |||
776 | return err; | 767 | return err; |
777 | } | 768 | } |
778 | 769 | ||
779 | static int w83627ehf_attach_adapter(struct i2c_adapter *adapter) | ||
780 | { | ||
781 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
782 | return 0; | ||
783 | return i2c_detect(adapter, &addr_data, w83627ehf_detect); | ||
784 | } | ||
785 | |||
786 | static int w83627ehf_detach_client(struct i2c_client *client) | 770 | static int w83627ehf_detach_client(struct i2c_client *client) |
787 | { | 771 | { |
788 | struct w83627ehf_data *data = i2c_get_clientdata(client); | 772 | struct w83627ehf_data *data = i2c_get_clientdata(client); |
@@ -804,12 +788,11 @@ static int w83627ehf_detach_client(struct i2c_client *client) | |||
804 | static struct i2c_driver w83627ehf_driver = { | 788 | static struct i2c_driver w83627ehf_driver = { |
805 | .owner = THIS_MODULE, | 789 | .owner = THIS_MODULE, |
806 | .name = "w83627ehf", | 790 | .name = "w83627ehf", |
807 | .flags = I2C_DF_NOTIFY, | 791 | .attach_adapter = w83627ehf_detect, |
808 | .attach_adapter = w83627ehf_attach_adapter, | ||
809 | .detach_client = w83627ehf_detach_client, | 792 | .detach_client = w83627ehf_detach_client, |
810 | }; | 793 | }; |
811 | 794 | ||
812 | static int __init w83627ehf_find(int sioaddr, int *address) | 795 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr) |
813 | { | 796 | { |
814 | u16 val; | 797 | u16 val; |
815 | 798 | ||
@@ -827,8 +810,8 @@ static int __init w83627ehf_find(int sioaddr, int *address) | |||
827 | superio_select(W83627EHF_LD_HWM); | 810 | superio_select(W83627EHF_LD_HWM); |
828 | val = (superio_inb(SIO_REG_ADDR) << 8) | 811 | val = (superio_inb(SIO_REG_ADDR) << 8) |
829 | | superio_inb(SIO_REG_ADDR + 1); | 812 | | superio_inb(SIO_REG_ADDR + 1); |
830 | *address = val & ~(REGION_LENGTH - 1); | 813 | *addr = val & ~(REGION_LENGTH - 1); |
831 | if (*address == 0) { | 814 | if (*addr == 0) { |
832 | superio_exit(); | 815 | superio_exit(); |
833 | return -ENODEV; | 816 | return -ENODEV; |
834 | } | 817 | } |
@@ -844,8 +827,8 @@ static int __init w83627ehf_find(int sioaddr, int *address) | |||
844 | 827 | ||
845 | static int __init sensors_w83627ehf_init(void) | 828 | static int __init sensors_w83627ehf_init(void) |
846 | { | 829 | { |
847 | if (w83627ehf_find(0x2e, &normal_isa[0]) | 830 | if (w83627ehf_find(0x2e, &address) |
848 | && w83627ehf_find(0x4e, &normal_isa[0])) | 831 | && w83627ehf_find(0x4e, &address)) |
849 | return -ENODEV; | 832 | return -ENODEV; |
850 | 833 | ||
851 | return i2c_isa_add_driver(&w83627ehf_driver); | 834 | return i2c_isa_add_driver(&w83627ehf_driver); |