Commit fdf8eea5 authored by Darren Powell's avatar Darren Powell Committed by Alex Deucher

amdgpu/pm: Replace amdgpu_pm usage of sprintf with sysfs_emit

 replacing printfs with sysfs_emit

=== Test ===
AMDGPU_PCI_ADDR=`lspci -nn | grep "VGA\|Display" | cut -d " " -f 1`
AMDGPU_HWMON=`ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | awk '{print $9}'`
HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
LOGFILE=pp_printf.test.log

lspci -nn | grep "VGA\|Display"  > $LOGFILE
FILES="pwm1_enable
pwm1_min
pwm1_max
pwm1
fan1_input
fan1_target
fan1_enable
power1_cap_min "

for f in $FILES
do
  echo === $f === >> $LOGFILE
  cat $HWMON_DIR/device/$f >> $LOGFILE
done
cat $LOGFILE
Signed-off-by: default avatarDarren Powell <darren.powell@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6db0c87a
...@@ -2379,7 +2379,7 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev, ...@@ -2379,7 +2379,7 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
return sprintf(buf, "%u\n", pwm_mode); return sysfs_emit(buf, "%u\n", pwm_mode);
} }
static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev, static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
...@@ -2424,14 +2424,14 @@ static ssize_t amdgpu_hwmon_get_pwm1_min(struct device *dev, ...@@ -2424,14 +2424,14 @@ static ssize_t amdgpu_hwmon_get_pwm1_min(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%i\n", 0); return sysfs_emit(buf, "%i\n", 0);
} }
static ssize_t amdgpu_hwmon_get_pwm1_max(struct device *dev, static ssize_t amdgpu_hwmon_get_pwm1_max(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%i\n", 255); return sysfs_emit(buf, "%i\n", 255);
} }
static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev, static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev,
...@@ -2517,7 +2517,7 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev, ...@@ -2517,7 +2517,7 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev,
speed = (speed * 255) / 100; speed = (speed * 255) / 100;
return sprintf(buf, "%i\n", speed); return sysfs_emit(buf, "%i\n", speed);
} }
static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev,
...@@ -2550,7 +2550,7 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, ...@@ -2550,7 +2550,7 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev,
if (err) if (err)
return err; return err;
return sprintf(buf, "%i\n", speed); return sysfs_emit(buf, "%i\n", speed);
} }
static ssize_t amdgpu_hwmon_get_fan1_min(struct device *dev, static ssize_t amdgpu_hwmon_get_fan1_min(struct device *dev,
...@@ -2647,7 +2647,7 @@ static ssize_t amdgpu_hwmon_get_fan1_target(struct device *dev, ...@@ -2647,7 +2647,7 @@ static ssize_t amdgpu_hwmon_get_fan1_target(struct device *dev,
if (err) if (err)
return err; return err;
return sprintf(buf, "%i\n", rpm); return sysfs_emit(buf, "%i\n", rpm);
} }
static ssize_t amdgpu_hwmon_set_fan1_target(struct device *dev, static ssize_t amdgpu_hwmon_set_fan1_target(struct device *dev,
...@@ -2729,7 +2729,7 @@ static ssize_t amdgpu_hwmon_get_fan1_enable(struct device *dev, ...@@ -2729,7 +2729,7 @@ static ssize_t amdgpu_hwmon_get_fan1_enable(struct device *dev,
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
return sprintf(buf, "%i\n", pwm_mode == AMD_FAN_CTRL_AUTO ? 0 : 1); return sysfs_emit(buf, "%i\n", pwm_mode == AMD_FAN_CTRL_AUTO ? 0 : 1);
} }
static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev, static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev,
...@@ -2899,7 +2899,7 @@ static ssize_t amdgpu_hwmon_show_power_cap_min(struct device *dev, ...@@ -2899,7 +2899,7 @@ static ssize_t amdgpu_hwmon_show_power_cap_min(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%i\n", 0); return sysfs_emit(buf, "%i\n", 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment