[PATCH i-g-t] tests/xe_pm_residency: Fix while loop in toggle_gt_c6
Riana Tauro
riana.tauro at intel.com
Wed Sep 25 09:17:39 UTC 2024
On 9/20/2024 3:32 AM, Rodrigo Vivi wrote:
> On Thu, Sep 19, 2024 at 09:35:48PM +0300, Ville Syrjälä wrote:
>> On Thu, Sep 19, 2024 at 12:59:50PM -0400, Rodrigo Vivi wrote:
>>> From: Bommithi Sakeena <bommithi.sakeena at intel.com>
>>>
>>> Function toggle_gt_c6 has while loop iterating for (NUM_REPS +1)
>>> times. Correct it to iterate to NUM_REPS times.
>>>
>>> Signed-off-by: Bommithi Sakeena <bommithi.sakeena at intel.com>
>>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
>>> ---
>>> tests/intel/xe_pm_residency.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tests/intel/xe_pm_residency.c b/tests/intel/xe_pm_residency.c
>>> index 0e687558b..f4d05889c 100644
>>> --- a/tests/intel/xe_pm_residency.c
>>> +++ b/tests/intel/xe_pm_residency.c
>>> @@ -297,7 +297,7 @@ static void toggle_gt_c6(int fd, int n)
>>>
>>> if (n == NUM_REPS)
>>> measure_power(&gpu, >_c6_power);
>>> - } while (n--);
>>> + } while (--n);
>>
>> Why isn't that just a canonical for loop?
>
> I honestly asked me the same question when Sakeena showed me this.
> If it was in kernel I would had requested the for loop.
> but given while is used in more places in IGT I liked the small
> patch as possible here.
This can be converted into for loop. There was no specific reason to use
while.
Thank you for the fix. This patch however looks good to me
Reviewed-by: Riana Tauro <riana.tauro at intel.com>
>
>>
>>>
>>> igt_power_close(&gpu);
>>> igt_info("GPU consumed %fmW in GT C6 and %fmW in GT C0\n", gt_c6_power, gt_c0_power);
>>> --
>>> 2.46.0
>>
>> --
>> Ville Syrjälä
>> Intel
More information about the igt-dev
mailing list