[PATCH v2 07/37] drm/nouveau: add nouveau_cli to nouveau_abi16

Danilo Krummrich dakr at redhat.com
Tue Jul 9 15:36:07 UTC 2024


On Fri, Jul 05, 2024 at 04:36:51AM +1000, Ben Skeggs wrote:
> Removes some dubious void casts.

Please use the imperative form:

"Store a pointer to struct nouveau_cli in struct nouveau_abi16 to avoid some
dubious void casts."

> 
> Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_abi16.c | 9 +++++----
>  drivers/gpu/drm/nouveau/nouveau_abi16.h | 1 +
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
> index d56909071de6..ac50c300d2eb 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
> @@ -50,6 +50,7 @@ nouveau_abi16(struct drm_file *file_priv)
>  				.device = ~0ULL,
>  			};
>  
> +			abi16->cli = cli;
>  			INIT_LIST_HEAD(&abi16->channels);
>  
>  			/* allocate device object targeting client's default
> @@ -82,7 +83,7 @@ nouveau_abi16_get(struct drm_file *file_priv)
>  int
>  nouveau_abi16_put(struct nouveau_abi16 *abi16, int ret)
>  {
> -	struct nouveau_cli *cli = (void *)abi16->device.object.client;
> +	struct nouveau_cli *cli = abi16->cli;
>  	mutex_unlock(&cli->mutex);
>  	return ret;
>  }
> @@ -164,7 +165,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
>  void
>  nouveau_abi16_fini(struct nouveau_abi16 *abi16)
>  {
> -	struct nouveau_cli *cli = (void *)abi16->device.object.client;
> +	struct nouveau_cli *cli = abi16->cli;
>  	struct nouveau_abi16_chan *chan, *temp;
>  
>  	/* cleanup channels */
> @@ -529,7 +530,7 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
>  
>  	if (init->handle == ~0)
>  		return nouveau_abi16_put(abi16, -EINVAL);
> -	client = abi16->device.object.client;
> +	client = &abi16->cli->base;
>  
>  	chan = nouveau_abi16_chan(abi16, init->channel);
>  	if (!chan)
> @@ -623,7 +624,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
>  	/* completely unnecessary for these chipsets... */
>  	if (unlikely(device->info.family >= NV_DEVICE_INFO_V0_FERMI))
>  		return nouveau_abi16_put(abi16, -EINVAL);
> -	client = abi16->device.object.client;
> +	client = &abi16->cli->base;
>  
>  	chan = nouveau_abi16_chan(abi16, info->channel);
>  	if (!chan)
> diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.h b/drivers/gpu/drm/nouveau/nouveau_abi16.h
> index 661b901d8ecc..0a9121e63143 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_abi16.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.h
> @@ -30,6 +30,7 @@ struct nouveau_abi16_chan {
>  };
>  
>  struct nouveau_abi16 {
> +	struct nouveau_cli *cli;
>  	struct nvif_device device;
>  	struct list_head channels;
>  	u64 handles;
> -- 
> 2.45.1
> 



More information about the Nouveau mailing list