diff options
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index b60efe8f8b26..eee22a57e929 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -105,7 +105,9 @@ superio_exit(void) | |||
105 | * ISA constants | 105 | * ISA constants |
106 | */ | 106 | */ |
107 | 107 | ||
108 | #define REGION_LENGTH 8 | 108 | #define REGION_ALIGNMENT ~7 |
109 | #define REGION_OFFSET 5 | ||
110 | #define REGION_LENGTH 2 | ||
109 | #define ADDR_REG_OFFSET 5 | 111 | #define ADDR_REG_OFFSET 5 |
110 | #define DATA_REG_OFFSET 6 | 112 | #define DATA_REG_OFFSET 6 |
111 | 113 | ||
@@ -673,16 +675,16 @@ static int w83627ehf_detect(struct i2c_adapter *adapter) | |||
673 | struct w83627ehf_data *data; | 675 | struct w83627ehf_data *data; |
674 | int i, err = 0; | 676 | int i, err = 0; |
675 | 677 | ||
676 | if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { | 678 | if (!request_region(address + REGION_OFFSET, REGION_LENGTH, |
679 | w83627ehf_driver.name)) { | ||
677 | err = -EBUSY; | 680 | err = -EBUSY; |
678 | goto exit; | 681 | goto exit; |
679 | } | 682 | } |
680 | 683 | ||
681 | if (!(data = kmalloc(sizeof(struct w83627ehf_data), GFP_KERNEL))) { | 684 | if (!(data = kzalloc(sizeof(struct w83627ehf_data), GFP_KERNEL))) { |
682 | err = -ENOMEM; | 685 | err = -ENOMEM; |
683 | goto exit_release; | 686 | goto exit_release; |
684 | } | 687 | } |
685 | memset(data, 0, sizeof(struct w83627ehf_data)); | ||
686 | 688 | ||
687 | client = &data->client; | 689 | client = &data->client; |
688 | i2c_set_clientdata(client, data); | 690 | i2c_set_clientdata(client, data); |
@@ -762,7 +764,7 @@ exit_detach: | |||
762 | exit_free: | 764 | exit_free: |
763 | kfree(data); | 765 | kfree(data); |
764 | exit_release: | 766 | exit_release: |
765 | release_region(address, REGION_LENGTH); | 767 | release_region(address + REGION_OFFSET, REGION_LENGTH); |
766 | exit: | 768 | exit: |
767 | return err; | 769 | return err; |
768 | } | 770 | } |
@@ -776,7 +778,7 @@ static int w83627ehf_detach_client(struct i2c_client *client) | |||
776 | 778 | ||
777 | if ((err = i2c_detach_client(client))) | 779 | if ((err = i2c_detach_client(client))) |
778 | return err; | 780 | return err; |
779 | release_region(client->addr, REGION_LENGTH); | 781 | release_region(client->addr + REGION_OFFSET, REGION_LENGTH); |
780 | kfree(data); | 782 | kfree(data); |
781 | 783 | ||
782 | return 0; | 784 | return 0; |
@@ -807,7 +809,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr) | |||
807 | superio_select(W83627EHF_LD_HWM); | 809 | superio_select(W83627EHF_LD_HWM); |
808 | val = (superio_inb(SIO_REG_ADDR) << 8) | 810 | val = (superio_inb(SIO_REG_ADDR) << 8) |
809 | | superio_inb(SIO_REG_ADDR + 1); | 811 | | superio_inb(SIO_REG_ADDR + 1); |
810 | *addr = val & ~(REGION_LENGTH - 1); | 812 | *addr = val & REGION_ALIGNMENT; |
811 | if (*addr == 0) { | 813 | if (*addr == 0) { |
812 | superio_exit(); | 814 | superio_exit(); |
813 | return -ENODEV; | 815 | return -ENODEV; |