Commit 9aad54d5 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/tmr: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 93834cb9
......@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb;
} acpi;
struct nvkm_timer *timer;
struct nvkm_top *top;
struct nvkm_volt *volt;
......@@ -126,7 +125,6 @@ struct nvkm_device_chip {
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE
int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **);
int (*top )(struct nvkm_device *, int idx, struct nvkm_top **);
int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **);
......
......@@ -9,6 +9,7 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FUSE , struct nvkm_fuse , fuse)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MXM , struct nvkm_subdev , mxm)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MC , struct nvkm_mc , mc)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TIMER , struct nvkm_timer , timer)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_INSTMEM , struct nvkm_instmem , imem)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_LTC , struct nvkm_ltc , ltc)
......
......@@ -76,8 +76,8 @@ s64 nvkm_timer_wait_test(struct nvkm_timer_wait *);
#define nvkm_wait_msec(d,m,addr,mask,data) \
nvkm_wait_usec((d), (m) * 1000, (addr), (mask), (data))
int nv04_timer_new(struct nvkm_device *, int, struct nvkm_timer **);
int nv40_timer_new(struct nvkm_device *, int, struct nvkm_timer **);
int nv41_timer_new(struct nvkm_device *, int, struct nvkm_timer **);
int gk20a_timer_new(struct nvkm_device *, int, struct nvkm_timer **);
int nv04_timer_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_timer **);
int nv40_timer_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_timer **);
int nv41_timer_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_timer **);
int gk20a_timer_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_timer **);
#endif
......@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h>
#undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_TIMER ] = "tmr",
[NVKM_SUBDEV_TOP ] = "top",
[NVKM_SUBDEV_VOLT ] = "volt",
[NVKM_ENGINE_BSP ] = "bsp",
......
......@@ -183,14 +183,14 @@ nvkm_timer = {
int
nvkm_timer_new_(const struct nvkm_timer_func *func, struct nvkm_device *device,
int index, struct nvkm_timer **ptmr)
enum nvkm_subdev_type type, int inst, struct nvkm_timer **ptmr)
{
struct nvkm_timer *tmr;
if (!(tmr = *ptmr = kzalloc(sizeof(*tmr), GFP_KERNEL)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_timer, device, index, &tmr->subdev);
nvkm_subdev_ctor(&nvkm_timer, device, type, inst, &tmr->subdev);
tmr->func = func;
INIT_LIST_HEAD(&tmr->alarms);
spin_lock_init(&tmr->lock);
......
......@@ -33,7 +33,8 @@ gk20a_timer = {
};
int
gk20a_timer_new(struct nvkm_device *device, int index, struct nvkm_timer **ptmr)
gk20a_timer_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_timer **ptmr)
{
return nvkm_timer_new_(&gk20a_timer, device, index, ptmr);
return nvkm_timer_new_(&gk20a_timer, device, type, inst, ptmr);
}
......@@ -145,7 +145,8 @@ nv04_timer = {
};
int
nv04_timer_new(struct nvkm_device *device, int index, struct nvkm_timer **ptmr)
nv04_timer_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_timer **ptmr)
{
return nvkm_timer_new_(&nv04_timer, device, index, ptmr);
return nvkm_timer_new_(&nv04_timer, device, type, inst, ptmr);
}
......@@ -82,7 +82,8 @@ nv40_timer = {
};
int
nv40_timer_new(struct nvkm_device *device, int index, struct nvkm_timer **ptmr)
nv40_timer_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_timer **ptmr)
{
return nvkm_timer_new_(&nv40_timer, device, index, ptmr);
return nvkm_timer_new_(&nv40_timer, device, type, inst, ptmr);
}
......@@ -79,7 +79,8 @@ nv41_timer = {
};
int
nv41_timer_new(struct nvkm_device *device, int index, struct nvkm_timer **ptmr)
nv41_timer_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_timer **ptmr)
{
return nvkm_timer_new_(&nv41_timer, device, index, ptmr);
return nvkm_timer_new_(&nv41_timer, device, type, inst, ptmr);
}
......@@ -4,8 +4,8 @@
#define nvkm_timer(p) container_of((p), struct nvkm_timer, subdev)
#include <subdev/timer.h>
int nvkm_timer_new_(const struct nvkm_timer_func *, struct nvkm_device *,
int index, struct nvkm_timer **);
int nvkm_timer_new_(const struct nvkm_timer_func *, struct nvkm_device *, enum nvkm_subdev_type,
int, struct nvkm_timer **);
struct nvkm_timer_func {
void (*init)(struct nvkm_timer *);
......
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