diff options
author | Petr Vandrovec <vandrove@vc.cvut.cz> | 2005-10-07 17:11:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 17:02:09 -0400 |
commit | ada0c2f8fa087dc1dbc34e096c318739b1d6381a (patch) | |
tree | e7f80d1336e2190c138fd4226438195e2f67839d /drivers/hwmon/w83627ehf.c | |
parent | bf813b314a2271c3f3903eb3279ebf5e09b3d27a (diff) |
[PATCH] hwmon: Fix w83627ehf/hf vs PNPACPI conflict (bug #4014)
This patch changes w83627hf and w83627ehf drivers to reserve only ports
0x295-0x296, instead of full 0x290-0x297 range. While some other
sensors chips respond to all addresses in 0x290-0x297 range, Winbond
chips respond to 0x295-0x296 only (this behavior is implied by
documentation, and matches behavior observed on real systems). This is
not problem alone, as no BIOS was found to put something at these unused
addresses, and sensors chip itself provides nothing there as well.
But in addition to only respond to these two addresses, also BIOS
vendors report in their ACPI-PnP structures that there is some resource
at I/O address 0x295 of length 2. And when later this hwmon driver
attempts to request region with base 0x290/length 8, it fails as one
request_region cannot span more than one device.
Due to this we have to ask only for region this hardware really
occupies, otherwise driver cannot be loaded on systems with ACPI-PnP
enabled.
Signed-off-by: Petr Vandrovec <vandrove@vc.cvut.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index b60efe8f8b26..685eeb766809 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,7 +675,8 @@ 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 | } |
@@ -762,7 +765,7 @@ exit_detach: | |||
762 | exit_free: | 765 | exit_free: |
763 | kfree(data); | 766 | kfree(data); |
764 | exit_release: | 767 | exit_release: |
765 | release_region(address, REGION_LENGTH); | 768 | release_region(address + REGION_OFFSET, REGION_LENGTH); |
766 | exit: | 769 | exit: |
767 | return err; | 770 | return err; |
768 | } | 771 | } |
@@ -776,7 +779,7 @@ static int w83627ehf_detach_client(struct i2c_client *client) | |||
776 | 779 | ||
777 | if ((err = i2c_detach_client(client))) | 780 | if ((err = i2c_detach_client(client))) |
778 | return err; | 781 | return err; |
779 | release_region(client->addr, REGION_LENGTH); | 782 | release_region(client->addr + REGION_OFFSET, REGION_LENGTH); |
780 | kfree(data); | 783 | kfree(data); |
781 | 784 | ||
782 | return 0; | 785 | return 0; |
@@ -807,7 +810,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr) | |||
807 | superio_select(W83627EHF_LD_HWM); | 810 | superio_select(W83627EHF_LD_HWM); |
808 | val = (superio_inb(SIO_REG_ADDR) << 8) | 811 | val = (superio_inb(SIO_REG_ADDR) << 8) |
809 | | superio_inb(SIO_REG_ADDR + 1); | 812 | | superio_inb(SIO_REG_ADDR + 1); |
810 | *addr = val & ~(REGION_LENGTH - 1); | 813 | *addr = val & REGION_ALIGNMENT; |
811 | if (*addr == 0) { | 814 | if (*addr == 0) { |
812 | superio_exit(); | 815 | superio_exit(); |
813 | return -ENODEV; | 816 | return -ENODEV; |