@@ -52,7 +52,7 @@ static int
5252nouveau_channel_killed (struct nvif_event * event , void * repv , u32 repc )
5353{
5454 struct nouveau_channel * chan = container_of (event , typeof (* chan ), kill );
55- struct nouveau_cli * cli = ( void * ) chan -> user . client ;
55+ struct nouveau_cli * cli = chan -> cli ;
5656
5757 NV_PRINTK (warn , cli , "channel %d killed!\n" , chan -> chid );
5858
6666nouveau_channel_idle (struct nouveau_channel * chan )
6767{
6868 if (likely (chan && chan -> fence && !atomic_read (& chan -> killed ))) {
69- struct nouveau_cli * cli = ( void * ) chan -> user . client ;
69+ struct nouveau_cli * cli = chan -> cli ;
7070 struct nouveau_fence * fence = NULL ;
7171 int ret ;
7272
@@ -142,10 +142,11 @@ nouveau_channel_wait(struct nvif_push *push, u32 size)
142142}
143143
144144static int
145- nouveau_channel_prep (struct nouveau_drm * drm , struct nvif_device * device ,
145+ nouveau_channel_prep (struct nouveau_cli * cli ,
146146 u32 size , struct nouveau_channel * * pchan )
147147{
148- struct nouveau_cli * cli = (void * )device -> object .client ;
148+ struct nouveau_drm * drm = cli -> drm ;
149+ struct nvif_device * device = & cli -> device ;
149150 struct nv_dma_v0 args = {};
150151 struct nouveau_channel * chan ;
151152 u32 target ;
@@ -155,6 +156,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
155156 if (!chan )
156157 return - ENOMEM ;
157158
159+ chan -> cli = cli ;
158160 chan -> device = device ;
159161 chan -> drm = drm ;
160162 chan -> vmm = nouveau_cli_vmm (cli );
@@ -254,7 +256,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
254256}
255257
256258static int
257- nouveau_channel_ctor (struct nouveau_drm * drm , struct nvif_device * device , bool priv , u64 runm ,
259+ nouveau_channel_ctor (struct nouveau_cli * cli , bool priv , u64 runm ,
258260 struct nouveau_channel * * pchan )
259261{
260262 const struct nvif_mclass hosts [] = {
@@ -279,7 +281,7 @@ nouveau_channel_ctor(struct nouveau_drm *drm, struct nvif_device *device, bool p
279281 struct nvif_chan_v0 chan ;
280282 char name [TASK_COMM_LEN + 16 ];
281283 } args ;
282- struct nouveau_cli * cli = ( void * ) device -> object . client ;
284+ struct nvif_device * device = & cli -> device ;
283285 struct nouveau_channel * chan ;
284286 const u64 plength = 0x10000 ;
285287 const u64 ioffset = plength ;
@@ -298,7 +300,7 @@ nouveau_channel_ctor(struct nouveau_drm *drm, struct nvif_device *device, bool p
298300 size = ioffset + ilength ;
299301
300302 /* allocate dma push buffer */
301- ret = nouveau_channel_prep (drm , device , size , & chan );
303+ ret = nouveau_channel_prep (cli , size , & chan );
302304 * pchan = chan ;
303305 if (ret )
304306 return ret ;
@@ -493,13 +495,12 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
493495}
494496
495497int
496- nouveau_channel_new (struct nouveau_drm * drm , struct nvif_device * device ,
498+ nouveau_channel_new (struct nouveau_cli * cli ,
497499 bool priv , u64 runm , u32 vram , u32 gart , struct nouveau_channel * * pchan )
498500{
499- struct nouveau_cli * cli = (void * )device -> object .client ;
500501 int ret ;
501502
502- ret = nouveau_channel_ctor (drm , device , priv , runm , pchan );
503+ ret = nouveau_channel_ctor (cli , priv , runm , pchan );
503504 if (ret ) {
504505 NV_PRINTK (dbg , cli , "channel create, %d\n" , ret );
505506 return ret ;
0 commit comments