diff options
Diffstat (limited to 'drivers/hwmon/pkgtemp.c')
| -rw-r--r-- | drivers/hwmon/pkgtemp.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c index 74157fcda6ed..f11903936c8b 100644 --- a/drivers/hwmon/pkgtemp.c +++ b/drivers/hwmon/pkgtemp.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
| 34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
| 35 | #include <linux/cpu.h> | 35 | #include <linux/cpu.h> |
| 36 | #include <linux/pci.h> | ||
| 37 | #include <asm/msr.h> | 36 | #include <asm/msr.h> |
| 38 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
| 39 | 38 | ||
| @@ -224,7 +223,7 @@ static int __devinit pkgtemp_probe(struct platform_device *pdev) | |||
| 224 | 223 | ||
| 225 | err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); | 224 | err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); |
| 226 | if (err) | 225 | if (err) |
| 227 | goto exit_free; | 226 | goto exit_dev; |
| 228 | 227 | ||
| 229 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 228 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
| 230 | if (IS_ERR(data->hwmon_dev)) { | 229 | if (IS_ERR(data->hwmon_dev)) { |
| @@ -238,6 +237,8 @@ static int __devinit pkgtemp_probe(struct platform_device *pdev) | |||
| 238 | 237 | ||
| 239 | exit_class: | 238 | exit_class: |
| 240 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); | 239 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); |
| 240 | exit_dev: | ||
| 241 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
| 241 | exit_free: | 242 | exit_free: |
| 242 | kfree(data); | 243 | kfree(data); |
| 243 | exit: | 244 | exit: |
| @@ -250,6 +251,7 @@ static int __devexit pkgtemp_remove(struct platform_device *pdev) | |||
| 250 | 251 | ||
| 251 | hwmon_device_unregister(data->hwmon_dev); | 252 | hwmon_device_unregister(data->hwmon_dev); |
| 252 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); | 253 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); |
| 254 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
| 253 | platform_set_drvdata(pdev, NULL); | 255 | platform_set_drvdata(pdev, NULL); |
| 254 | kfree(data); | 256 | kfree(data); |
| 255 | return 0; | 257 | return 0; |
| @@ -281,9 +283,10 @@ static int __cpuinit pkgtemp_device_add(unsigned int cpu) | |||
| 281 | int err; | 283 | int err; |
| 282 | struct platform_device *pdev; | 284 | struct platform_device *pdev; |
| 283 | struct pdev_entry *pdev_entry; | 285 | struct pdev_entry *pdev_entry; |
| 284 | #ifdef CONFIG_SMP | ||
| 285 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 286 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 286 | #endif | 287 | |
| 288 | if (!cpu_has(c, X86_FEATURE_PTS)) | ||
| 289 | return 0; | ||
| 287 | 290 | ||
| 288 | mutex_lock(&pdev_list_mutex); | 291 | mutex_lock(&pdev_list_mutex); |
| 289 | 292 | ||
| @@ -339,17 +342,18 @@ exit: | |||
| 339 | #ifdef CONFIG_HOTPLUG_CPU | 342 | #ifdef CONFIG_HOTPLUG_CPU |
| 340 | static void pkgtemp_device_remove(unsigned int cpu) | 343 | static void pkgtemp_device_remove(unsigned int cpu) |
| 341 | { | 344 | { |
| 342 | struct pdev_entry *p, *n; | 345 | struct pdev_entry *p; |
| 343 | unsigned int i; | 346 | unsigned int i; |
| 344 | int err; | 347 | int err; |
| 345 | 348 | ||
| 346 | mutex_lock(&pdev_list_mutex); | 349 | mutex_lock(&pdev_list_mutex); |
| 347 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 350 | list_for_each_entry(p, &pdev_list, list) { |
| 348 | if (p->cpu != cpu) | 351 | if (p->cpu != cpu) |
| 349 | continue; | 352 | continue; |
| 350 | 353 | ||
| 351 | platform_device_unregister(p->pdev); | 354 | platform_device_unregister(p->pdev); |
| 352 | list_del(&p->list); | 355 | list_del(&p->list); |
| 356 | mutex_unlock(&pdev_list_mutex); | ||
| 353 | kfree(p); | 357 | kfree(p); |
| 354 | for_each_cpu(i, cpu_core_mask(cpu)) { | 358 | for_each_cpu(i, cpu_core_mask(cpu)) { |
| 355 | if (i != cpu) { | 359 | if (i != cpu) { |
| @@ -358,7 +362,7 @@ static void pkgtemp_device_remove(unsigned int cpu) | |||
| 358 | break; | 362 | break; |
| 359 | } | 363 | } |
| 360 | } | 364 | } |
| 361 | break; | 365 | return; |
| 362 | } | 366 | } |
| 363 | mutex_unlock(&pdev_list_mutex); | 367 | mutex_unlock(&pdev_list_mutex); |
| 364 | } | 368 | } |
| @@ -399,11 +403,6 @@ static int __init pkgtemp_init(void) | |||
| 399 | goto exit; | 403 | goto exit; |
| 400 | 404 | ||
| 401 | for_each_online_cpu(i) { | 405 | for_each_online_cpu(i) { |
| 402 | struct cpuinfo_x86 *c = &cpu_data(i); | ||
| 403 | |||
| 404 | if (!cpu_has(c, X86_FEATURE_PTS)) | ||
| 405 | continue; | ||
| 406 | |||
| 407 | err = pkgtemp_device_add(i); | 406 | err = pkgtemp_device_add(i); |
| 408 | if (err) | 407 | if (err) |
| 409 | goto exit_devices_unreg; | 408 | goto exit_devices_unreg; |
