[PATCH v2 19/37] drm/nouveau/nvif: remove client device arg

Danilo Krummrich dakr at redhat.com
Tue Jul 9 16:16:19 UTC 2024


On Fri, Jul 05, 2024 at 04:37:03AM +1000, Ben Skeggs wrote:
> This was once used by userspace tools (with nvkm built as a library), as
> a way to select a "default device".
> 
> The DRM code doesn't need this at all as clients only have access to a
> single device already, so the value can be inherited from its parent.

"so inherit the value from its parent."

> 
> Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
> ---
>  drivers/gpu/drm/nouveau/include/nvif/client.h | 3 +--
>  drivers/gpu/drm/nouveau/include/nvif/if0000.h | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c         | 4 +---
>  drivers/gpu/drm/nouveau/nvif/client.c         | 5 ++---
>  drivers/gpu/drm/nouveau/nvif/driver.c         | 2 +-
>  drivers/gpu/drm/nouveau/nvkm/core/client.c    | 2 +-
>  6 files changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/include/nvif/client.h b/drivers/gpu/drm/nouveau/include/nvif/client.h
> index 5210007d7669..2c8e9bec3f79 100644
> --- a/drivers/gpu/drm/nouveau/include/nvif/client.h
> +++ b/drivers/gpu/drm/nouveau/include/nvif/client.h
> @@ -10,8 +10,7 @@ struct nvif_client {
>  	u64 version;
>  };
>  
> -int  nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
> -		      struct nvif_client *);
> +int  nvif_client_ctor(struct nvif_client *parent, const char *name, struct nvif_client *);
>  void nvif_client_dtor(struct nvif_client *);
>  int  nvif_client_ioctl(struct nvif_client *, void *, u32);
>  int  nvif_client_suspend(struct nvif_client *);
> diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0000.h b/drivers/gpu/drm/nouveau/include/nvif/if0000.h
> index f7b8f8f48760..a93f91d56a09 100644
> --- a/drivers/gpu/drm/nouveau/include/nvif/if0000.h
> +++ b/drivers/gpu/drm/nouveau/include/nvif/if0000.h
> @@ -5,7 +5,6 @@
>  struct nvif_client_v0 {
>  	__u8  version;
>  	__u8  pad01[7];
> -	__u64 device;
>  	char  name[32];
>  };
>  
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index e0e1fcfcab1e..8951a0805239 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -241,7 +241,6 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
>  		{ NVIF_CLASS_VMM_NV04 , -1 },
>  		{}
>  	};
> -	u64 device = nouveau_name(drm->dev->dev);
>  	int ret;
>  
>  	snprintf(cli->name, sizeof(cli->name), "%s", sname);
> @@ -254,8 +253,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
>  
>  	if (cli != &drm->master) {
>  		mutex_lock(&drm->master.lock);
> -		ret = nvif_client_ctor(&drm->master.base, cli->name, device,
> -				       &cli->base);
> +		ret = nvif_client_ctor(&drm->master.base, cli->name, &cli->base);
>  		mutex_unlock(&drm->master.lock);
>  	}
>  	if (ret) {
> diff --git a/drivers/gpu/drm/nouveau/nvif/client.c b/drivers/gpu/drm/nouveau/nvif/client.c
> index 85ad5091e8e2..bbfc80fcff43 100644
> --- a/drivers/gpu/drm/nouveau/nvif/client.c
> +++ b/drivers/gpu/drm/nouveau/nvif/client.c
> @@ -55,10 +55,9 @@ nvif_client_dtor(struct nvif_client *client)
>  }
>  
>  int
> -nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
> -		 struct nvif_client *client)
> +nvif_client_ctor(struct nvif_client *parent, const char *name, struct nvif_client *client)
>  {
> -	struct nvif_client_v0 args = { .device = device };
> +	struct nvif_client_v0 args = {};
>  	struct {
>  		struct nvif_ioctl_v0 ioctl;
>  		struct nvif_ioctl_nop_v0 nop;
> diff --git a/drivers/gpu/drm/nouveau/nvif/driver.c b/drivers/gpu/drm/nouveau/nvif/driver.c
> index acb708df2559..78706e97a6a2 100644
> --- a/drivers/gpu/drm/nouveau/nvif/driver.c
> +++ b/drivers/gpu/drm/nouveau/nvif/driver.c
> @@ -36,5 +36,5 @@ nvif_driver_init(const char *drv, const char *cfg, const char *dbg,
>  	if (ret)
>  		return ret;
>  
> -	return nvif_client_ctor(client, name, device, client);
> +	return nvif_client_ctor(client, name, client);
>  }
> diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c
> index 95cbb5b682f2..6baa3a4fa0a4 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/core/client.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c
> @@ -42,7 +42,7 @@ nvkm_uclient_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
>  
>  	if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, false))){
>  		args->v0.name[sizeof(args->v0.name) - 1] = 0;
> -		ret = nvkm_client_new(args->v0.name, args->v0.device, NULL,
> +		ret = nvkm_client_new(args->v0.name, oclass->client->device, NULL,
>  				      NULL, oclass->client->event, &client);
>  		if (ret)
>  			return ret;
> -- 
> 2.45.1
> 



More information about the Nouveau mailing list