diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2016-12-13 11:11:21 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2017-02-17 08:14:30 +0300 |
commit | e72da6e04f739253b175cd87aab47337c4646a66 (patch) | |
tree | 4274ba8cca8b5e7e7cb880bb733a02ec35a4833b /drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | |
parent | 31214108ad08766075bf111df90c1f26520b0159 (diff) | |
download | linux-e72da6e04f739253b175cd87aab47337c4646a66.tar.xz |
drm/nouveau/pmu: add nvkm_pmu_ctor() function
Add a PMU constructor so implementations that extend the nvkm_pmu
structure can have all base members properly initialized.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c index e611ce80f8ef..b7edde42789c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -129,15 +129,22 @@ nvkm_pmu = { }; int -nvkm_pmu_new_(const struct nvkm_pmu_func *func, struct nvkm_device *device, - int index, struct nvkm_pmu **ppmu) +nvkm_pmu_ctor(const struct nvkm_pmu_func *func, struct nvkm_device *device, + int index, struct nvkm_pmu *pmu) { - struct nvkm_pmu *pmu; - if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL))) - return -ENOMEM; nvkm_subdev_ctor(&nvkm_pmu, device, index, &pmu->subdev); pmu->func = func; INIT_WORK(&pmu->recv.work, nvkm_pmu_recv); init_waitqueue_head(&pmu->recv.wait); return 0; } + +int +nvkm_pmu_new_(const struct nvkm_pmu_func *func, struct nvkm_device *device, + int index, struct nvkm_pmu **ppmu) +{ + struct nvkm_pmu *pmu; + if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL))) + return -ENOMEM; + return nvkm_pmu_ctor(func, device, index, *ppmu); +} |