forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/gpu/drm/nouveau/nvif/device.c
....@@ -27,28 +27,32 @@
2727 u64
2828 nvif_device_time(struct nvif_device *device)
2929 {
30
- struct nv_device_time_v0 args = {};
31
- int ret = nvif_object_mthd(&device->object, NV_DEVICE_V0_TIME,
32
- &args, sizeof(args));
33
- WARN_ON_ONCE(ret != 0);
34
- return args.time;
30
+ if (!device->user.func) {
31
+ struct nv_device_time_v0 args = {};
32
+ int ret = nvif_object_mthd(&device->object, NV_DEVICE_V0_TIME,
33
+ &args, sizeof(args));
34
+ WARN_ON_ONCE(ret != 0);
35
+ return args.time;
36
+ }
37
+
38
+ return device->user.func->time(&device->user);
3539 }
3640
3741 void
38
-nvif_device_fini(struct nvif_device *device)
42
+nvif_device_dtor(struct nvif_device *device)
3943 {
40
- nvif_user_fini(device);
44
+ nvif_user_dtor(device);
4145 kfree(device->runlist);
4246 device->runlist = NULL;
43
- nvif_object_fini(&device->object);
47
+ nvif_object_dtor(&device->object);
4448 }
4549
4650 int
47
-nvif_device_init(struct nvif_object *parent, u32 handle, s32 oclass,
48
- void *data, u32 size, struct nvif_device *device)
51
+nvif_device_ctor(struct nvif_object *parent, const char *name, u32 handle,
52
+ s32 oclass, void *data, u32 size, struct nvif_device *device)
4953 {
50
- int ret = nvif_object_init(parent, handle, oclass, data, size,
51
- &device->object);
54
+ int ret = nvif_object_ctor(parent, name ? name : "nvifDevice", handle,
55
+ oclass, data, size, &device->object);
5256 device->runlist = NULL;
5357 device->user.func = NULL;
5458 if (ret == 0) {