aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-04-24 21:35:18 -0400
committerBen Skeggs <bskeggs@redhat.com>2013-04-26 01:38:12 -0400
commit066a5d0938c64bec665866b145d8538d9f96bcda (patch)
tree1d279110415ada5e4ff79837f6621454aec1ce78
parent9aecbada751e6343e47cbefade718e571a8ecbbc (diff)
drm/nouveau/device: enable proper constructor/destructor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/base.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/base.c b/drivers/gpu/drm/nouveau/core/engine/device/base.c
index 30723ee8114c..497d5f60a195 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/base.c
@@ -419,6 +419,20 @@ nouveau_device_sclass[] = {
419 {} 419 {}
420}; 420};
421 421
422static int
423nouveau_device_fini(struct nouveau_object *object, bool suspend)
424{
425 struct nouveau_device *device = (void *)object;
426 return nouveau_subdev_fini(&device->base, suspend);
427}
428
429static int
430nouveau_device_init(struct nouveau_object *object)
431{
432 struct nouveau_device *device = (void *)object;
433 return nouveau_subdev_init(&device->base);
434}
435
422static void 436static void
423nouveau_device_dtor(struct nouveau_object *object) 437nouveau_device_dtor(struct nouveau_object *object)
424{ 438{
@@ -439,6 +453,8 @@ nouveau_device_oclass = {
439 .handle = NV_ENGINE(DEVICE, 0x00), 453 .handle = NV_ENGINE(DEVICE, 0x00),
440 .ofuncs = &(struct nouveau_ofuncs) { 454 .ofuncs = &(struct nouveau_ofuncs) {
441 .dtor = nouveau_device_dtor, 455 .dtor = nouveau_device_dtor,
456 .init = nouveau_device_init,
457 .fini = nouveau_device_fini,
442 }, 458 },
443}; 459};
444 460
@@ -462,7 +478,6 @@ nouveau_device_create_(struct pci_dev *pdev, u64 name, const char *sname,
462 if (ret) 478 if (ret)
463 goto done; 479 goto done;
464 480
465 atomic_set(&nv_object(device)->usecount, 2);
466 device->pdev = pdev; 481 device->pdev = pdev;
467 device->handle = name; 482 device->handle = name;
468 device->cfgopt = cfg; 483 device->cfgopt = cfg;