Skip to content

Commit c6f7f1b

Browse files
committed
drm/amd/pm: Avoid open-coded use of ratelimit_state structure's internals
The amdgpu_set_thermal_throttling_logging() function directly accesses the ratelimit_state structure's ->missed field, which works, but which also makes it more difficult to change this field. Therefore, make use of the ratelimit_state_reset_interval() function instead of directly accessing the ->missed field. Nevertheless, open-coded use of ->burst and ->interval is still permitted, for example, for runtime sysfs adjustment of these fields. Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ Link: https://lore.kernel.org/all/[email protected]/ Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Paul E. McKenney <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Cc: Kenneth Feng <[email protected]> Cc: "Christian König" <[email protected]> Cc: Xinhui Pan <[email protected]> Cc: David Airlie <[email protected]> Cc: Simona Vetter <[email protected]> Cc: <[email protected]> Cc: <[email protected]>
1 parent 25228c6 commit c6f7f1b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,6 @@ static ssize_t amdgpu_set_thermal_throttling_logging(struct device *dev,
16061606
struct drm_device *ddev = dev_get_drvdata(dev);
16071607
struct amdgpu_device *adev = drm_to_adev(ddev);
16081608
long throttling_logging_interval;
1609-
unsigned long flags;
16101609
int ret = 0;
16111610

16121611
ret = kstrtol(buf, 0, &throttling_logging_interval);
@@ -1617,18 +1616,12 @@ static ssize_t amdgpu_set_thermal_throttling_logging(struct device *dev,
16171616
return -EINVAL;
16181617

16191618
if (throttling_logging_interval > 0) {
1620-
raw_spin_lock_irqsave(&adev->throttling_logging_rs.lock, flags);
16211619
/*
16221620
* Reset the ratelimit timer internals.
16231621
* This can effectively restart the timer.
16241622
*/
1625-
adev->throttling_logging_rs.interval =
1626-
(throttling_logging_interval - 1) * HZ;
1627-
adev->throttling_logging_rs.begin = 0;
1628-
adev->throttling_logging_rs.printed = 0;
1629-
adev->throttling_logging_rs.missed = 0;
1630-
raw_spin_unlock_irqrestore(&adev->throttling_logging_rs.lock, flags);
1631-
1623+
ratelimit_state_reset_interval(&adev->throttling_logging_rs,
1624+
(throttling_logging_interval - 1) * HZ);
16321625
atomic_set(&adev->throttling_logging_enabled, 1);
16331626
} else {
16341627
atomic_set(&adev->throttling_logging_enabled, 0);

0 commit comments

Comments
 (0)