[PATCH] drm/i915: move struct_mutex from drm_device to drm_i915_private

Dmitry Baryshkov dmitry.baryshkov at oss.qualcomm.com
Sun Aug 3 11:49:49 UTC 2025


On Fri, Jul 18, 2025 at 01:17:25PM -0300, Luiz Otavio Mello wrote:
> i915 is the only remaining user of struct_mutex lock.
> 
> Move it from drm_device to drm_i915_private so it is only used within
> the i915 driver.
> 
> Signed-off-by: Luiz Otavio Mello <luiz.mello at estudante.ufscar.br>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 4 ++--
>  drivers/gpu/drm/i915/i915_drv.h            | 8 ++++++++

You need to perform actual move: call mutex_init() somewhere, drop the
fields from struct drm_device, etc.

>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> index e8a04e476c57..7135fdb0ebb4 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> @@ -678,7 +678,7 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level)
>  	if (level < GUC_LOG_LEVEL_DISABLED || level > GUC_LOG_LEVEL_MAX)
>  		return -EINVAL;
>  
> -	mutex_lock(&i915->drm.struct_mutex);
> +	mutex_lock(&i915->struct_mutex);
>  
>  	if (log->level == level)
>  		goto out_unlock;
> @@ -696,7 +696,7 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level)
>  	log->level = level;
>  
>  out_unlock:
> -	mutex_unlock(&i915->drm.struct_mutex);
> +	mutex_unlock(&i915->struct_mutex);
>  
>  	return ret;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index d0e1980dcba2..c585569b6036 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -224,6 +224,14 @@ struct drm_i915_private {
>  
>  	bool irqs_enabled;
>  
> +	/*
> +	 * Currently, struct_mutex is only used by the i915 driver as a replacement
> +	 * for BLK. 
> +	 * 
> +	 * For this reason, it is no longer part of struct drm_device.
> +	*/
> +	struct mutex struct_mutex;
> +
>  	/* LPT/WPT IOSF sideband protection */
>  	struct mutex sbi_lock;
>  
> -- 
> 2.49.0
> 

-- 
With best wishes
Dmitry


More information about the dri-devel mailing list