| .. | .. |
|---|
| 27 | 27 | u64 |
|---|
| 28 | 28 | nvif_device_time(struct nvif_device *device) |
|---|
| 29 | 29 | { |
|---|
| 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); |
|---|
| 35 | 39 | } |
|---|
| 36 | 40 | |
|---|
| 37 | 41 | void |
|---|
| 38 | | -nvif_device_fini(struct nvif_device *device) |
|---|
| 42 | +nvif_device_dtor(struct nvif_device *device) |
|---|
| 39 | 43 | { |
|---|
| 40 | | - nvif_user_fini(device); |
|---|
| 44 | + nvif_user_dtor(device); |
|---|
| 41 | 45 | kfree(device->runlist); |
|---|
| 42 | 46 | device->runlist = NULL; |
|---|
| 43 | | - nvif_object_fini(&device->object); |
|---|
| 47 | + nvif_object_dtor(&device->object); |
|---|
| 44 | 48 | } |
|---|
| 45 | 49 | |
|---|
| 46 | 50 | 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) |
|---|
| 49 | 53 | { |
|---|
| 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); |
|---|
| 52 | 56 | device->runlist = NULL; |
|---|
| 53 | 57 | device->user.func = NULL; |
|---|
| 54 | 58 | if (ret == 0) { |
|---|