aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/vt1211.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/vt1211.c')
-rw-r--r--drivers/hwmon/vt1211.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c
index 89c23d6add7b..9f3e332c5b7f 100644
--- a/drivers/hwmon/vt1211.c
+++ b/drivers/hwmon/vt1211.c
@@ -31,6 +31,7 @@
31#include <linux/hwmon-vid.h> 31#include <linux/hwmon-vid.h>
32#include <linux/err.h> 32#include <linux/err.h>
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <linux/ioport.h>
34#include <asm/io.h> 35#include <asm/io.h>
35 36
36static int uch_config = -1; 37static int uch_config = -1;
@@ -1130,6 +1131,12 @@ static int __devinit vt1211_probe(struct platform_device *pdev)
1130 } 1131 }
1131 1132
1132 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 1133 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
1134 if (!request_region(res->start, res->end - res->start + 1, DRVNAME)) {
1135 err = -EBUSY;
1136 dev_err(dev, "Failed to request region 0x%lx-0x%lx\n",
1137 (unsigned long)res->start, (unsigned long)res->end);
1138 goto EXIT_KFREE;
1139 }
1133 data->addr = res->start; 1140 data->addr = res->start;
1134 data->name = DRVNAME; 1141 data->name = DRVNAME;
1135 mutex_init(&data->update_lock); 1142 mutex_init(&data->update_lock);
@@ -1197,6 +1204,8 @@ EXIT_DEV_REMOVE:
1197 dev_err(dev, "Sysfs interface creation failed (%d)\n", err); 1204 dev_err(dev, "Sysfs interface creation failed (%d)\n", err);
1198EXIT_DEV_REMOVE_SILENT: 1205EXIT_DEV_REMOVE_SILENT:
1199 vt1211_remove_sysfs(pdev); 1206 vt1211_remove_sysfs(pdev);
1207 release_region(res->start, res->end - res->start + 1);
1208EXIT_KFREE:
1200 platform_set_drvdata(pdev, NULL); 1209 platform_set_drvdata(pdev, NULL);
1201 kfree(data); 1210 kfree(data);
1202EXIT: 1211EXIT:
@@ -1206,12 +1215,16 @@ EXIT:
1206static int __devexit vt1211_remove(struct platform_device *pdev) 1215static int __devexit vt1211_remove(struct platform_device *pdev)
1207{ 1216{
1208 struct vt1211_data *data = platform_get_drvdata(pdev); 1217 struct vt1211_data *data = platform_get_drvdata(pdev);
1218 struct resource *res;
1209 1219
1210 hwmon_device_unregister(data->class_dev); 1220 hwmon_device_unregister(data->class_dev);
1211 vt1211_remove_sysfs(pdev); 1221 vt1211_remove_sysfs(pdev);
1212 platform_set_drvdata(pdev, NULL); 1222 platform_set_drvdata(pdev, NULL);
1213 kfree(data); 1223 kfree(data);
1214 1224
1225 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
1226 release_region(res->start, res->end - res->start + 1);
1227
1215 return 0; 1228 return 0;
1216} 1229}
1217 1230