Commit f02ca842 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/core: add nvkm_subdev_new_() for bare subdevs

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent fa4f4c21
...@@ -24,6 +24,8 @@ struct nvkm_subdev_func { ...@@ -24,6 +24,8 @@ struct nvkm_subdev_func {
}; };
extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR]; extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR];
int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *,
int index, struct nvkm_subdev **);
void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *, void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *,
int index, struct nvkm_subdev *); int index, struct nvkm_subdev *);
void nvkm_subdev_del(struct nvkm_subdev **); void nvkm_subdev_del(struct nvkm_subdev **);
......
...@@ -221,3 +221,14 @@ nvkm_subdev_ctor(const struct nvkm_subdev_func *func, ...@@ -221,3 +221,14 @@ nvkm_subdev_ctor(const struct nvkm_subdev_func *func,
__mutex_init(&subdev->mutex, name, &nvkm_subdev_lock_class[index]); __mutex_init(&subdev->mutex, name, &nvkm_subdev_lock_class[index]);
subdev->debug = nvkm_dbgopt(device->dbgopt, name); subdev->debug = nvkm_dbgopt(device->dbgopt, name);
} }
int
nvkm_subdev_new_(const struct nvkm_subdev_func *func,
struct nvkm_device *device, int index,
struct nvkm_subdev **psubdev)
{
if (!(*psubdev = kzalloc(sizeof(**psubdev), GFP_KERNEL)))
return -ENOMEM;
nvkm_subdev_ctor(func, device, index, *psubdev);
return 0;
}
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