diff options
-rw-r--r-- | drivers/hwmon/lm78.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index ed7859f0e16a..2c96d8a548f7 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -655,7 +655,7 @@ static int __devinit lm78_isa_probe(struct platform_device *pdev) | |||
655 | 655 | ||
656 | /* Reserve the ISA region */ | 656 | /* Reserve the ISA region */ |
657 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 657 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
658 | if (!request_region(res->start, LM78_EXTENT, "lm78")) { | 658 | if (!request_region(res->start + LM78_ADDR_REG_OFFSET, 2, "lm78")) { |
659 | err = -EBUSY; | 659 | err = -EBUSY; |
660 | goto exit; | 660 | goto exit; |
661 | } | 661 | } |
@@ -699,7 +699,7 @@ static int __devinit lm78_isa_probe(struct platform_device *pdev) | |||
699 | device_remove_file(&pdev->dev, &dev_attr_name); | 699 | device_remove_file(&pdev->dev, &dev_attr_name); |
700 | kfree(data); | 700 | kfree(data); |
701 | exit_release_region: | 701 | exit_release_region: |
702 | release_region(res->start, LM78_EXTENT); | 702 | release_region(res->start + LM78_ADDR_REG_OFFSET, 2); |
703 | exit: | 703 | exit: |
704 | return err; | 704 | return err; |
705 | } | 705 | } |
@@ -711,7 +711,7 @@ static int __devexit lm78_isa_remove(struct platform_device *pdev) | |||
711 | hwmon_device_unregister(data->hwmon_dev); | 711 | hwmon_device_unregister(data->hwmon_dev); |
712 | sysfs_remove_group(&pdev->dev.kobj, &lm78_group); | 712 | sysfs_remove_group(&pdev->dev.kobj, &lm78_group); |
713 | device_remove_file(&pdev->dev, &dev_attr_name); | 713 | device_remove_file(&pdev->dev, &dev_attr_name); |
714 | release_region(data->client.addr, LM78_EXTENT); | 714 | release_region(data->client.addr + LM78_ADDR_REG_OFFSET, 2); |
715 | kfree(data); | 715 | kfree(data); |
716 | 716 | ||
717 | return 0; | 717 | return 0; |
@@ -837,8 +837,17 @@ static int __init lm78_isa_found(unsigned short address) | |||
837 | { | 837 | { |
838 | int val, save, found = 0; | 838 | int val, save, found = 0; |
839 | 839 | ||
840 | if (!request_region(address, LM78_EXTENT, "lm78")) | 840 | /* We have to request the region in two parts because some |
841 | boards declare base+4 to base+7 as a PNP device */ | ||
842 | if (!request_region(address, 4, "lm78")) { | ||
843 | pr_debug("lm78: Failed to request low part of region\n"); | ||
841 | return 0; | 844 | return 0; |
845 | } | ||
846 | if (!request_region(address + 4, 4, "lm78")) { | ||
847 | pr_debug("lm78: Failed to request high part of region\n"); | ||
848 | release_region(address, 4); | ||
849 | return 0; | ||
850 | } | ||
842 | 851 | ||
843 | #define REALLY_SLOW_IO | 852 | #define REALLY_SLOW_IO |
844 | /* We need the timeouts for at least some LM78-like | 853 | /* We need the timeouts for at least some LM78-like |
@@ -901,7 +910,8 @@ static int __init lm78_isa_found(unsigned short address) | |||
901 | val & 0x80 ? "LM79" : "LM78", (int)address); | 910 | val & 0x80 ? "LM79" : "LM78", (int)address); |
902 | 911 | ||
903 | release: | 912 | release: |
904 | release_region(address, LM78_EXTENT); | 913 | release_region(address + 4, 4); |
914 | release_region(address, 4); | ||
905 | return found; | 915 | return found; |
906 | } | 916 | } |
907 | 917 | ||