On Fri, 26 Jul 2024 14:37:58 +1000 Ben Skeggs <bskeggs@xxxxxxxxxx> wrote: Reviewed-by: Zhi Wang <zhiw@xxxxxxxxxx> We can also cook a patch to clean up the cli = (void *) cast in dispnv50/disp.c and nouveau_chan.c after this series is merged. > Store a pointer to struct nouveau_cli in struct nouveau_abi16 to > avoid some dubious void casts. > > Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> > --- > 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;