drm/nouveau/pm: style fixes
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / nouveau_pm.c
index aba3362d421a3cf42f8f51a7e7143aa32c051146..1770f1569c9084209986f06cce661d317f31f509 100644 (file)
@@ -162,6 +162,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
        struct nouveau_pm_level *perflvl = NULL;
+       long pl;
 
        /* safety precaution, for now */
        if (nouveau_perflvl_wr != 7777)
@@ -170,8 +171,9 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
        if (!strncmp(profile, "boot", 4))
                perflvl = &pm->boot;
        else {
-               int pl = simple_strtol(profile, NULL, 10);
                int i;
+               if (kstrtol(profile, 10, &pl) == -EINVAL)
+                       return -EINVAL;
 
                for (i = 0; i < pm->nr_perflvl; i++) {
                        if (pm->perflvl[i].id == pl) {
@@ -397,7 +399,7 @@ nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a,
        struct nouveau_pm_threshold_temp *temp = &pm->threshold_temp;
        long value;
 
-       if (strict_strtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value) == -EINVAL)
                return count;
 
        temp->down_clock = value/1000;
@@ -432,7 +434,7 @@ nouveau_hwmon_set_critical_temp(struct device *d, struct device_attribute *a,
        struct nouveau_pm_threshold_temp *temp = &pm->threshold_temp;
        long value;
 
-       if (strict_strtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value) == -EINVAL)
                return count;
 
        temp->critical = value/1000;
@@ -529,7 +531,7 @@ nouveau_hwmon_set_pwm0(struct device *d, struct device_attribute *a,
        if (nouveau_perflvl_wr != 7777)
                return -EPERM;
 
-       if (strict_strtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value) == -EINVAL)
                return -EINVAL;
 
        if (value < pm->fan.min_duty)
@@ -568,7 +570,7 @@ nouveau_hwmon_set_pwm0_min(struct device *d, struct device_attribute *a,
        struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
        long value;
 
-       if (strict_strtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value) == -EINVAL)
                return -EINVAL;
 
        if (value < 0)
@@ -609,7 +611,7 @@ nouveau_hwmon_set_pwm0_max(struct device *d, struct device_attribute *a,
        struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
        long value;
 
-       if (strict_strtol(buf, 10, &value) == -EINVAL)
+       if (kstrtol(buf, 10, &value) == -EINVAL)
                return -EINVAL;
 
        if (value < 0)
@@ -663,9 +665,9 @@ static const struct attribute_group hwmon_pwm_fan_attrgroup = {
 static int
 nouveau_hwmon_init(struct drm_device *dev)
 {
-#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
+#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
        struct device *hwmon_dev;
        int ret = 0;
 
@@ -731,8 +733,10 @@ nouveau_hwmon_fini(struct drm_device *dev)
 
        if (pm->hwmon) {
                sysfs_remove_group(&dev->pdev->dev.kobj, &hwmon_attrgroup);
-               sysfs_remove_group(&dev->pdev->dev.kobj, &hwmon_pwm_fan_attrgroup);
-               sysfs_remove_group(&dev->pdev->dev.kobj, &hwmon_fan_rpm_attrgroup);
+               sysfs_remove_group(&dev->pdev->dev.kobj,
+                                  &hwmon_pwm_fan_attrgroup);
+               sysfs_remove_group(&dev->pdev->dev.kobj,
+                                  &hwmon_fan_rpm_attrgroup);
 
                hwmon_device_unregister(pm->hwmon);
        }