Commit d6adbe94 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/mc: allow construction of subclassed device

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3560e170
......@@ -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;
}
......@@ -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 **);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment