Message ID | 59a4d62438e529a398709d44d8fc7931f1d73822.1723129920.git.jani.nikula@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/xe & drm/i915: drvdata usage changes | expand |
Quoting Jani Nikula (2024-08-08 12:15:46-03:00) >xe_call_for_each_device() has been unused since commit 57ecead343e7 >("drm/xe/tests: Convert xe_mocs live tests"). Remove it and the related >dev_to_xe_device_fn() and struct kunit_test_data. > >Cc: Gustavo Sousa <gustavo.sousa@intel.com> >Cc: Lucas De Marchi <lucas.demarchi@intel.com> >Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com> >--- > drivers/gpu/drm/xe/tests/xe_pci.c | 52 -------------------------- > drivers/gpu/drm/xe/tests/xe_pci_test.h | 1 - > 2 files changed, 53 deletions(-) > >diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c >index 577ee7d14381..67404863087e 100644 >--- a/drivers/gpu/drm/xe/tests/xe_pci.c >+++ b/drivers/gpu/drm/xe/tests/xe_pci.c >@@ -12,58 +12,6 @@ > #include <kunit/test-bug.h> > #include <kunit/visibility.h> > >-struct kunit_test_data { >- int ndevs; >- xe_device_fn xe_fn; >-}; >- >-static int dev_to_xe_device_fn(struct device *dev, void *__data) >- >-{ >- struct drm_device *drm = dev_get_drvdata(dev); >- struct kunit_test_data *data = __data; >- int ret = 0; >- int idx; >- >- data->ndevs++; >- >- if (drm_dev_enter(drm, &idx)) >- ret = data->xe_fn(to_xe_device(dev_get_drvdata(dev))); >- drm_dev_exit(idx); >- >- return ret; >-} >- >-/** >- * xe_call_for_each_device - Iterate over all devices this driver binds to >- * @xe_fn: Function to call for each device. >- * >- * This function iterated over all devices this driver binds to, and calls >- * @xe_fn: for each one of them. If the called function returns anything else >- * than 0, iteration is stopped and the return value is returned by this >- * function. Across each function call, drm_dev_enter() / drm_dev_exit() is >- * called for the corresponding drm device. >- * >- * 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) >-{ >- int ret; >- struct kunit_test_data data = { >- .xe_fn = xe_fn, >- .ndevs = 0, >- }; >- >- ret = driver_for_each_device(&xe_pci_driver.driver, NULL, >- &data, dev_to_xe_device_fn); >- >- if (!data.ndevs) >- kunit_skip(current->kunit_test, "test runs only on hardware\n"); >- >- return ret ?: data.ndevs; >-} >- > /** > * xe_call_for_each_graphics_ip - Iterate over all recognized graphics IPs > * @xe_fn: Function to call for each device. >diff --git a/drivers/gpu/drm/xe/tests/xe_pci_test.h b/drivers/gpu/drm/xe/tests/xe_pci_test.h >index 3e2558bc3c90..ede46800aff1 100644 >--- a/drivers/gpu/drm/xe/tests/xe_pci_test.h >+++ b/drivers/gpu/drm/xe/tests/xe_pci_test.h >@@ -19,7 +19,6 @@ typedef int (*xe_device_fn)(struct xe_device *); > typedef void (*xe_graphics_fn)(const struct xe_graphics_desc *); > typedef void (*xe_media_fn)(const struct xe_media_desc *); > >-int xe_call_for_each_device(xe_device_fn xe_fn); > void xe_call_for_each_graphics_ip(xe_graphics_fn xe_fn); > void xe_call_for_each_media_ip(xe_media_fn xe_fn); > >-- >2.39.2 >
diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c index 577ee7d14381..67404863087e 100644 --- a/drivers/gpu/drm/xe/tests/xe_pci.c +++ b/drivers/gpu/drm/xe/tests/xe_pci.c @@ -12,58 +12,6 @@ #include <kunit/test-bug.h> #include <kunit/visibility.h> -struct kunit_test_data { - int ndevs; - xe_device_fn xe_fn; -}; - -static int dev_to_xe_device_fn(struct device *dev, void *__data) - -{ - struct drm_device *drm = dev_get_drvdata(dev); - struct kunit_test_data *data = __data; - int ret = 0; - int idx; - - data->ndevs++; - - if (drm_dev_enter(drm, &idx)) - ret = data->xe_fn(to_xe_device(dev_get_drvdata(dev))); - drm_dev_exit(idx); - - return ret; -} - -/** - * xe_call_for_each_device - Iterate over all devices this driver binds to - * @xe_fn: Function to call for each device. - * - * This function iterated over all devices this driver binds to, and calls - * @xe_fn: for each one of them. If the called function returns anything else - * than 0, iteration is stopped and the return value is returned by this - * function. Across each function call, drm_dev_enter() / drm_dev_exit() is - * called for the corresponding drm device. - * - * 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) -{ - int ret; - struct kunit_test_data data = { - .xe_fn = xe_fn, - .ndevs = 0, - }; - - ret = driver_for_each_device(&xe_pci_driver.driver, NULL, - &data, dev_to_xe_device_fn); - - if (!data.ndevs) - kunit_skip(current->kunit_test, "test runs only on hardware\n"); - - return ret ?: data.ndevs; -} - /** * xe_call_for_each_graphics_ip - Iterate over all recognized graphics IPs * @xe_fn: Function to call for each device. diff --git a/drivers/gpu/drm/xe/tests/xe_pci_test.h b/drivers/gpu/drm/xe/tests/xe_pci_test.h index 3e2558bc3c90..ede46800aff1 100644 --- a/drivers/gpu/drm/xe/tests/xe_pci_test.h +++ b/drivers/gpu/drm/xe/tests/xe_pci_test.h @@ -19,7 +19,6 @@ typedef int (*xe_device_fn)(struct xe_device *); typedef void (*xe_graphics_fn)(const struct xe_graphics_desc *); typedef void (*xe_media_fn)(const struct xe_media_desc *); -int xe_call_for_each_device(xe_device_fn xe_fn); void xe_call_for_each_graphics_ip(xe_graphics_fn xe_fn); void xe_call_for_each_media_ip(xe_media_fn xe_fn);
xe_call_for_each_device() has been unused since commit 57ecead343e7 ("drm/xe/tests: Convert xe_mocs live tests"). Remove it and the related dev_to_xe_device_fn() and struct kunit_test_data. Cc: Gustavo Sousa <gustavo.sousa@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/xe/tests/xe_pci.c | 52 -------------------------- drivers/gpu/drm/xe/tests/xe_pci_test.h | 1 - 2 files changed, 53 deletions(-)