drm/nouveau/mc: allow construction of subclassed device
authorBen Skeggs <bskeggs@redhat.com>
Sun, 29 May 2016 23:23:06 +0000 (09:23 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 14 Jul 2016 01:53:25 +0000 (11:53 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h

index 60d5c956f676f29ae7d66789cce1eb13430c4d2e..fa6b9932d327687300f0e066209a3c99de4f7c1e 100644 (file)
@@ -148,16 +148,21 @@ nvkm_mc = {
        .fini = nvkm_mc_fini,
 };
 
+void
+nvkm_mc_ctor(const struct nvkm_mc_func *func, struct nvkm_device *device,
+            int index, struct nvkm_mc *mc)
+{
+       nvkm_subdev_ctor(&nvkm_mc, device, index, &mc->subdev);
+       mc->func = func;
+}
+
 int
 nvkm_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device,
             int index, struct nvkm_mc **pmc)
 {
        struct nvkm_mc *mc;
-
        if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL)))
                return -ENOMEM;
-
-       nvkm_subdev_ctor(&nvkm_mc, device, index, &mc->subdev);
-       mc->func = func;
+       nvkm_mc_ctor(func, device, index, *pmc);
        return 0;
 }
index a1203811851238b462981a3d5e1a38717926ee33..536b8bd7cc906d31928147b013f64569b6beccc0 100644 (file)
@@ -3,6 +3,8 @@
 #define nvkm_mc(p) container_of((p), struct nvkm_mc, subdev)
 #include <subdev/mc.h>
 
+void nvkm_mc_ctor(const struct nvkm_mc_func *, struct nvkm_device *,
+                 int index, struct nvkm_mc *);
 int nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *,
                 int index, struct nvkm_mc **);