aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_pm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 95f8b3a3c43d..58038f5cab38 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -472,9 +472,9 @@ static const struct attribute_group hwmon_attrgroup = {
472 .attrs = hwmon_attributes, 472 .attrs = hwmon_attributes,
473}; 473};
474 474
475static void radeon_hwmon_init(struct radeon_device *rdev) 475static int radeon_hwmon_init(struct radeon_device *rdev)
476{ 476{
477 int err; 477 int err = 0;
478 478
479 rdev->pm.int_hwmon_dev = NULL; 479 rdev->pm.int_hwmon_dev = NULL;
480 480
@@ -483,15 +483,26 @@ static void radeon_hwmon_init(struct radeon_device *rdev)
483 case THERMAL_TYPE_RV770: 483 case THERMAL_TYPE_RV770:
484 case THERMAL_TYPE_EVERGREEN: 484 case THERMAL_TYPE_EVERGREEN:
485 rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev); 485 rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev);
486 if (IS_ERR(rdev->pm.int_hwmon_dev)) {
487 err = PTR_ERR(rdev->pm.int_hwmon_dev);
488 dev_err(rdev->dev,
489 "Unable to register hwmon device: %d\n", err);
490 break;
491 }
486 dev_set_drvdata(rdev->pm.int_hwmon_dev, rdev->ddev); 492 dev_set_drvdata(rdev->pm.int_hwmon_dev, rdev->ddev);
487 err = sysfs_create_group(&rdev->pm.int_hwmon_dev->kobj, 493 err = sysfs_create_group(&rdev->pm.int_hwmon_dev->kobj,
488 &hwmon_attrgroup); 494 &hwmon_attrgroup);
489 if (err) 495 if (err) {
490 DRM_ERROR("Unable to create hwmon sysfs file: %d\n", err); 496 dev_err(rdev->dev,
497 "Unable to create hwmon sysfs file: %d\n", err);
498 hwmon_device_unregister(rdev->dev);
499 }
491 break; 500 break;
492 default: 501 default:
493 break; 502 break;
494 } 503 }
504
505 return err;
495} 506}
496 507
497static void radeon_hwmon_fini(struct radeon_device *rdev) 508static void radeon_hwmon_fini(struct radeon_device *rdev)
@@ -540,6 +551,7 @@ void radeon_pm_resume(struct radeon_device *rdev)
540int radeon_pm_init(struct radeon_device *rdev) 551int radeon_pm_init(struct radeon_device *rdev)
541{ 552{
542 int ret; 553 int ret;
554
543 /* default to profile method */ 555 /* default to profile method */
544 rdev->pm.pm_method = PM_METHOD_PROFILE; 556 rdev->pm.pm_method = PM_METHOD_PROFILE;
545 rdev->pm.profile = PM_PROFILE_DEFAULT; 557 rdev->pm.profile = PM_PROFILE_DEFAULT;
@@ -561,7 +573,9 @@ int radeon_pm_init(struct radeon_device *rdev)
561 } 573 }
562 574
563 /* set up the internal thermal sensor if applicable */ 575 /* set up the internal thermal sensor if applicable */
564 radeon_hwmon_init(rdev); 576 ret = radeon_hwmon_init(rdev);
577 if (ret)
578 return ret;
565 if (rdev->pm.num_power_states > 1) { 579 if (rdev->pm.num_power_states > 1) {
566 /* where's the best place to put these? */ 580 /* where's the best place to put these? */
567 ret = device_create_file(rdev->dev, &dev_attr_power_profile); 581 ret = device_create_file(rdev->dev, &dev_attr_power_profile);