[PATCH i-g-t 10/10] lib/igt_sysfs: Drop xe_sysfs_driver_do()

Francois Dugast francois.dugast at intel.com
Mon Apr 14 11:03:20 UTC 2025


On Thu, Apr 10, 2025 at 03:49:00PM -0700, Lucas De Marchi wrote:
> All users are converted to igt_kmod_{unbind,bind,rebind}, so drop this
> implementation.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Francois Dugast <francois.dugast at intel.com>

> ---
>  lib/igt_sysfs.c | 50 --------------------------------------------------
>  lib/igt_sysfs.h |  8 --------
>  2 files changed, 58 deletions(-)
> 
> diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
> index a76af54eb..bc68cf61b 100644
> --- a/lib/igt_sysfs.c
> +++ b/lib/igt_sysfs.c
> @@ -1479,56 +1479,6 @@ int xe_sysfs_get_num_tiles(int xe_device)
>  	return num_tiles;
>  }
>  
> -/**
> - * xe_sysfs_driver_do:
> - * @xe_device: fd of the device
> - * @pci_slot: PCI slot of the device
> - * @action: the action to perform through sysfs on the driver
> - *
> - * Use sysfs to perform an action on the driver.
> - *
> - * Returns: fd of the device, which renewed if needed
> - */
> -int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_action action)
> -{
> -	int sysfs;
> -
> -	sysfs = open("/sys/bus/pci/drivers/xe", O_DIRECTORY);
> -	igt_assert(sysfs);
> -
> -	switch(action) {
> -	case XE_SYSFS_DRIVER_BIND:
> -		igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
> -		close(sysfs);
> -		break;
> -	case XE_SYSFS_DRIVER_TRY_BIND:
> -		igt_sysfs_set(sysfs, "bind", pci_slot);
> -		close(sysfs);
> -		break;
> -	case XE_SYSFS_DRIVER_REBIND:
> -		igt_assert(igt_sysfs_set(sysfs, "unbind", pci_slot));
> -
> -		/*
> -		 * We need to close the client for a proper release, before
> -		 * binding back again.
> -		 */
> -		close(xe_device);
> -
> -		igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
> -		close(sysfs);
> -
> -		/* Renew the client connection */
> -		xe_device = drm_open_driver(DRIVER_XE);
> -		igt_assert(xe_device);
> -
> -		break;
> -	default:
> -		igt_assert(!"missing");
> -	}
> -
> -	return xe_device;
> -}
> -
>  /**
>   * xe_sysfs_engine_class_get_property
>   * @xe_device: fd of the device
> diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
> index 5bc733168..265f77d4d 100644
> --- a/lib/igt_sysfs.h
> +++ b/lib/igt_sysfs.h
> @@ -183,14 +183,6 @@ int xe_sysfs_get_num_tiles(int xe_device);
>  char *xe_sysfs_engine_path(int xe_device, int gt, int class, char *path, int pathlen);
>  int xe_sysfs_engine_open(int xe_device, int gt, int class);
>  
> -enum xe_sysfs_driver_action {
> -	XE_SYSFS_DRIVER_BIND,
> -	XE_SYSFS_DRIVER_TRY_BIND,
> -	XE_SYSFS_DRIVER_REBIND,
> -};
> -
> -int xe_sysfs_driver_do(int xe_device, char pci_slot[], enum xe_sysfs_driver_action action);
> -
>  bool xe_sysfs_engine_class_get_property(int xe_device, int gt, uint16_t class, const char *property,
>  					uint32_t *value);
>  bool xe_sysfs_engine_class_set_property(int xe_device, int gt, uint16_t class, const char *property,
> 
> -- 
> 2.49.0
> 


More information about the igt-dev mailing list