diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-03-09 08:34:28 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-03-27 08:40:41 -0400 |
commit | 2961cb22ef02850d90e7a12c28a14d74e327df8d (patch) | |
tree | bffcd9538506c0b031c082d2b0ebc8a1c608b7fc /drivers/hwmon/w83781d.c | |
parent | 05dda977f2574c3341abef9b74c27d2b362e1e3a (diff) |
hwmon: (w83781d) Fix I/O resource conflict with PNP
Only request I/O ports 0x295-0x296 instead of the full I/O address
range. This solves a conflict with PNP resources on a few motherboards.
Also request the I/O ports in two parts (4 low ports, 4 high ports)
during device detection, otherwise the PNP resource makes the request
(and thus the detection) fail.
This fixes lm-sensors ticket #2306:
http://www.lm-sensors.org/ticket/2306
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/w83781d.c')
-rw-r--r-- | drivers/hwmon/w83781d.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index 5c85670e2d16..f942ecdd47c8 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -1367,7 +1367,8 @@ w83781d_isa_probe(struct platform_device *pdev) | |||
1367 | 1367 | ||
1368 | /* Reserve the ISA region */ | 1368 | /* Reserve the ISA region */ |
1369 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1369 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
1370 | if (!request_region(res->start, W83781D_EXTENT, "w83781d")) { | 1370 | if (!request_region(res->start + W83781D_ADDR_REG_OFFSET, 2, |
1371 | "w83781d")) { | ||
1371 | err = -EBUSY; | 1372 | err = -EBUSY; |
1372 | goto exit; | 1373 | goto exit; |
1373 | } | 1374 | } |
@@ -1415,7 +1416,7 @@ w83781d_isa_probe(struct platform_device *pdev) | |||
1415 | device_remove_file(&pdev->dev, &dev_attr_name); | 1416 | device_remove_file(&pdev->dev, &dev_attr_name); |
1416 | kfree(data); | 1417 | kfree(data); |
1417 | exit_release_region: | 1418 | exit_release_region: |
1418 | release_region(res->start, W83781D_EXTENT); | 1419 | release_region(res->start + W83781D_ADDR_REG_OFFSET, 2); |
1419 | exit: | 1420 | exit: |
1420 | return err; | 1421 | return err; |
1421 | } | 1422 | } |
@@ -1429,7 +1430,7 @@ w83781d_isa_remove(struct platform_device *pdev) | |||
1429 | sysfs_remove_group(&pdev->dev.kobj, &w83781d_group); | 1430 | sysfs_remove_group(&pdev->dev.kobj, &w83781d_group); |
1430 | sysfs_remove_group(&pdev->dev.kobj, &w83781d_group_opt); | 1431 | sysfs_remove_group(&pdev->dev.kobj, &w83781d_group_opt); |
1431 | device_remove_file(&pdev->dev, &dev_attr_name); | 1432 | device_remove_file(&pdev->dev, &dev_attr_name); |
1432 | release_region(data->client.addr, W83781D_EXTENT); | 1433 | release_region(data->client.addr + W83781D_ADDR_REG_OFFSET, 2); |
1433 | kfree(data); | 1434 | kfree(data); |
1434 | 1435 | ||
1435 | return 0; | 1436 | return 0; |
@@ -1797,8 +1798,17 @@ w83781d_isa_found(unsigned short address) | |||
1797 | { | 1798 | { |
1798 | int val, save, found = 0; | 1799 | int val, save, found = 0; |
1799 | 1800 | ||
1800 | if (!request_region(address, W83781D_EXTENT, "w83781d")) | 1801 | /* We have to request the region in two parts because some |
1802 | boards declare base+4 to base+7 as a PNP device */ | ||
1803 | if (!request_region(address, 4, "w83781d")) { | ||
1804 | pr_debug("w83781d: Failed to request low part of region\n"); | ||
1801 | return 0; | 1805 | return 0; |
1806 | } | ||
1807 | if (!request_region(address + 4, 4, "w83781d")) { | ||
1808 | pr_debug("w83781d: Failed to request high part of region\n"); | ||
1809 | release_region(address, 4); | ||
1810 | return 0; | ||
1811 | } | ||
1802 | 1812 | ||
1803 | #define REALLY_SLOW_IO | 1813 | #define REALLY_SLOW_IO |
1804 | /* We need the timeouts for at least some W83781D-like | 1814 | /* We need the timeouts for at least some W83781D-like |
@@ -1871,7 +1881,8 @@ w83781d_isa_found(unsigned short address) | |||
1871 | val == 0x30 ? "W83782D" : "W83781D", (int)address); | 1881 | val == 0x30 ? "W83782D" : "W83781D", (int)address); |
1872 | 1882 | ||
1873 | release: | 1883 | release: |
1874 | release_region(address, W83781D_EXTENT); | 1884 | release_region(address + 4, 4); |
1885 | release_region(address, 4); | ||
1875 | return found; | 1886 | return found; |
1876 | } | 1887 | } |
1877 | 1888 | ||