[Intel-xe] [PATCH] drm/xe/kunit: Return number of iterated devices

Michal Wajdeczko michal.wajdeczko at intel.com
Fri Nov 17 15:38:14 UTC 2023



On 17.11.2023 16:18, Lucas De Marchi wrote:
> On Wed, Nov 15, 2023 at 12:58:16PM +0100, Michal Wajdeczko wrote:
>> In xe_call_for_each_device() we are already counting number of
>> iterated devices. Lets make that available to the caller too.
> 
> anything useful to do with the return? Is there a follow up patch here?

there is, but down the road together with some SR-IOV tests

but IMO even if there would be none tests right now, if information is
available at no cost we should make make functions as useful as possible
to allow future new use cases

> 
> Lucas De Marchi
> 
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
>> ---
>> drivers/gpu/drm/xe/tests/xe_pci.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c
>> b/drivers/gpu/drm/xe/tests/xe_pci.c
>> index a40879da2fbe..306ff8cb35cb 100644
>> --- a/drivers/gpu/drm/xe/tests/xe_pci.c
>> +++ b/drivers/gpu/drm/xe/tests/xe_pci.c
>> @@ -42,8 +42,8 @@ static int dev_to_xe_device_fn(struct device *dev,
>> void *__data)
>>  * function. Across each function call, drm_dev_enter() /
>> drm_dev_exit() is
>>  * called for the corresponding drm device.
>>  *
>> - * Return: Zero or the error code of a call to @xe_fn returning an error
>> - * code.
>> + * Return: Number of devices iterated or
>> + *         the error code of a call to @xe_fn returning an error code.
>>  */
>> int xe_call_for_each_device(xe_device_fn xe_fn)
>> {
>> @@ -59,7 +59,7 @@ int xe_call_for_each_device(xe_device_fn xe_fn)
>>     if (!data.ndevs)
>>         kunit_skip(current->kunit_test, "test runs only on hardware\n");
>>
>> -    return ret;
>> +    return ret ?: data.ndevs;
>> }
>>
>> /**
>> -- 
>> 2.25.1
>>


More information about the Intel-xe mailing list