drm/nouveau/mc: allow construction of subclassed device
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
3560e1703f
commit
d6adbe949d
2 changed files with 11 additions and 4 deletions
|
@ -148,16 +148,21 @@ nvkm_mc = {
|
||||||
.fini = nvkm_mc_fini,
|
.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
|
int
|
||||||
nvkm_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device,
|
nvkm_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device,
|
||||||
int index, struct nvkm_mc **pmc)
|
int index, struct nvkm_mc **pmc)
|
||||||
{
|
{
|
||||||
struct nvkm_mc *mc;
|
struct nvkm_mc *mc;
|
||||||
|
|
||||||
if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL)))
|
if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL)))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
nvkm_mc_ctor(func, device, index, *pmc);
|
||||||
nvkm_subdev_ctor(&nvkm_mc, device, index, &mc->subdev);
|
|
||||||
mc->func = func;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#define nvkm_mc(p) container_of((p), struct nvkm_mc, subdev)
|
#define nvkm_mc(p) container_of((p), struct nvkm_mc, subdev)
|
||||||
#include <subdev/mc.h>
|
#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 nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *,
|
||||||
int index, struct nvkm_mc **);
|
int index, struct nvkm_mc **);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue