On 02/14/2017 06:01 PM, Deucher, Alexander wrote: >> -----Original Message----- >> From: StDenis, Tom >> Sent: Tuesday, February 14, 2017 11:58 AM >> To: Deucher, Alexander; 'Samuel Pitoiset'; amd-gfx at lists.freedesktop.org >> Subject: Re: [PATCH] drm/amdgpu: expose amdgpu_sensors on pre- >> powerplay chips >> >> On 14/02/17 11:57 AM, Deucher, Alexander wrote: >>>> -----Original Message----- >>>> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On >> Behalf >>>> Of Samuel Pitoiset >>>> Sent: Monday, February 13, 2017 7:23 PM >>>> To: amd-gfx at lists.freedesktop.org >>>> Cc: StDenis, Tom; Samuel Pitoiset >>>> Subject: [PATCH] drm/amdgpu: expose amdgpu_sensors on pre- >> powerplay >>>> chips >>>> >>>> Totally untested but as long as read_sensor() has been recently >>>> implemented for dpm based boards, amdgpu_sensors can now be >>>> exposed. >>>> >>>> Cc: Tom St Denis <tom.stdenis at amd.com> >>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com> >>>> --- >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- >>>> 1 file changed, 1 insertion(+), 4 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>>> index 6f021e70f15f..1a8e3b9a2268 100644 >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>>> @@ -3202,10 +3202,7 @@ static ssize_t >>>> amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, >>>> idx = *pos >> 2; >>>> >>>> valuesize = sizeof(values); >>>> - if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs- >>>>> read_sensor) >>>> - r = adev->powerplay.pp_funcs->read_sensor(adev- >>>>> powerplay.pp_handle, idx, &values[0], &valuesize); >>>> - else >>>> - return -EINVAL; >>>> + r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize); >>> >>> amdgpu_dpm is handled by both powerplay and non-powerplay so I think >> if we check for that here, we should be fine. E.g., >>> if (amdgpu_dpm != 0) >>> r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize); >> >> And a similar fix in the DRM ioctl too I suppose. > > We can just return an error if amdgpu_dpm ==0 in the ioctl. -EINVAL? > > Alex > >> >> Tom