diff options
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_pm.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 0c4473db8501..d79895aebc59 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -603,7 +603,6 @@ static const struct attribute_group *hwmon_groups[] = { | |||
603 | static int radeon_hwmon_init(struct radeon_device *rdev) | 603 | static int radeon_hwmon_init(struct radeon_device *rdev) |
604 | { | 604 | { |
605 | int err = 0; | 605 | int err = 0; |
606 | struct device *hwmon_dev; | ||
607 | 606 | ||
608 | switch (rdev->pm.int_thermal_type) { | 607 | switch (rdev->pm.int_thermal_type) { |
609 | case THERMAL_TYPE_RV6XX: | 608 | case THERMAL_TYPE_RV6XX: |
@@ -616,11 +615,11 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
616 | case THERMAL_TYPE_KV: | 615 | case THERMAL_TYPE_KV: |
617 | if (rdev->asic->pm.get_temperature == NULL) | 616 | if (rdev->asic->pm.get_temperature == NULL) |
618 | return err; | 617 | return err; |
619 | hwmon_dev = hwmon_device_register_with_groups(rdev->dev, | 618 | rdev->pm.int_hwmon_dev = hwmon_device_register_with_groups(rdev->dev, |
620 | "radeon", rdev, | 619 | "radeon", rdev, |
621 | hwmon_groups); | 620 | hwmon_groups); |
622 | if (IS_ERR(hwmon_dev)) { | 621 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { |
623 | err = PTR_ERR(hwmon_dev); | 622 | err = PTR_ERR(rdev->pm.int_hwmon_dev); |
624 | dev_err(rdev->dev, | 623 | dev_err(rdev->dev, |
625 | "Unable to register hwmon device: %d\n", err); | 624 | "Unable to register hwmon device: %d\n", err); |
626 | } | 625 | } |
@@ -632,6 +631,12 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
632 | return err; | 631 | return err; |
633 | } | 632 | } |
634 | 633 | ||
634 | static void radeon_hwmon_fini(struct radeon_device *rdev) | ||
635 | { | ||
636 | if (rdev->pm.int_hwmon_dev) | ||
637 | hwmon_device_unregister(rdev->pm.int_hwmon_dev); | ||
638 | } | ||
639 | |||
635 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) | 640 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) |
636 | { | 641 | { |
637 | struct radeon_device *rdev = | 642 | struct radeon_device *rdev = |
@@ -1353,6 +1358,8 @@ static void radeon_pm_fini_old(struct radeon_device *rdev) | |||
1353 | device_remove_file(rdev->dev, &dev_attr_power_method); | 1358 | device_remove_file(rdev->dev, &dev_attr_power_method); |
1354 | } | 1359 | } |
1355 | 1360 | ||
1361 | radeon_hwmon_fini(rdev); | ||
1362 | |||
1356 | if (rdev->pm.power_state) | 1363 | if (rdev->pm.power_state) |
1357 | kfree(rdev->pm.power_state); | 1364 | kfree(rdev->pm.power_state); |
1358 | } | 1365 | } |
@@ -1372,6 +1379,8 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev) | |||
1372 | } | 1379 | } |
1373 | radeon_dpm_fini(rdev); | 1380 | radeon_dpm_fini(rdev); |
1374 | 1381 | ||
1382 | radeon_hwmon_fini(rdev); | ||
1383 | |||
1375 | if (rdev->pm.power_state) | 1384 | if (rdev->pm.power_state) |
1376 | kfree(rdev->pm.power_state); | 1385 | kfree(rdev->pm.power_state); |
1377 | } | 1386 | } |