Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau/client: store default device by handle, not reference

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+9 -16
+1 -1
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
··· 5 5 struct nvkm_client { 6 6 struct nvkm_namedb namedb; 7 7 struct nvkm_handle *root; 8 - struct nvkm_device *device; 8 + u64 device; 9 9 char name[32]; 10 10 u32 debug; 11 11 struct nvkm_vm *vm;
+1 -1
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 507 507 508 508 dev->irq_enabled = false; 509 509 client = nvxx_client(&drm->client.base); 510 - device = client->device; 510 + device = nvkm_device_find(client->device); 511 511 drm_put_dev(dev); 512 512 513 513 nvkm_device_del(&device);
+2 -9
drivers/gpu/drm/nouveau/nvkm/core/client.c
··· 219 219 nvkm_client_fini(client, false); 220 220 for (i = 0; i < ARRAY_SIZE(client->notify); i++) 221 221 nvkm_client_notify_del(client, i); 222 - nvkm_object_ref(NULL, (struct nvkm_object **)&client->device); 223 222 nvkm_handle_destroy(client->root); 224 223 nvkm_namedb_destroy(&client->namedb); 225 224 *pclient = NULL; ··· 232 233 }; 233 234 234 235 int 235 - nvkm_client_new(const char *name, u64 devname, const char *cfg, 236 + nvkm_client_new(const char *name, u64 device, const char *cfg, 236 237 const char *dbg, struct nvkm_client **pclient) 237 238 { 238 - struct nvkm_device *device; 239 239 struct nvkm_client *client; 240 240 int ret; 241 - 242 - device = nvkm_device_find(devname); 243 - if (!device) 244 - return -ENODEV; 245 241 246 242 ret = nvkm_namedb_create(NULL, NULL, &nvkm_client_oclass, 247 243 NV_CLIENT_CLASS, nvkm_client_sclass, ··· 253 259 /* prevent init/fini being called, os in in charge of this */ 254 260 atomic_set(&nv_object(client)->usecount, 2); 255 261 256 - nvkm_object_ref(&device->engine.subdev.object, 257 - (struct nvkm_object **)&client->device); 262 + client->device = device; 258 263 snprintf(client->name, sizeof(client->name), "%s", name); 259 264 client->debug = nvkm_dbgopt(dbg, "CLIENT"); 260 265 return 0;
+5 -5
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
··· 258 258 oclass = &nvkm_udevice_oclass_super; 259 259 260 260 /* find the device subdev that matches what the client requested */ 261 - device = client->device; 262 - if (args->v0.device != ~0) { 261 + if (args->v0.device != ~0) 263 262 device = nvkm_device_find(args->v0.device); 264 - if (!device) 265 - return -ENODEV; 266 - } 263 + else 264 + device = nvkm_device_find(client->device); 265 + if (!device) 266 + return -ENODEV; 267 267 268 268 ret = nvkm_parent_create(parent, NULL, oclass, 0, nvkm_control_oclass, 269 269 (1ULL << NVDEV_ENGINE_DMAOBJ) |