Commit e4b15b4c authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/pmu: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 9b70cd54
......@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb;
} acpi;
struct nvkm_pmu *pmu;
struct nvkm_therm *therm;
struct nvkm_timer *timer;
struct nvkm_top *top;
......@@ -128,7 +127,6 @@ struct nvkm_device_chip {
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE
int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **);
int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **);
int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **);
int (*top )(struct nvkm_device *, int idx, struct nvkm_top **);
......
......@@ -16,6 +16,7 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MMU , struct nvkm_mmu , mmu)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT , struct nvkm_fault , fault)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR , struct nvkm_acr , acr)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PMU , struct nvkm_pmu , pmu)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ICCSENSE, struct nvkm_iccsense, iccsense)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
......@@ -40,18 +40,18 @@ int nvkm_pmu_send(struct nvkm_pmu *, u32 reply[2], u32 process,
void nvkm_pmu_pgob(struct nvkm_pmu *, bool enable);
bool nvkm_pmu_fan_controlled(struct nvkm_device *);
int gt215_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gf100_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gf119_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gk104_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gk110_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gk208_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gk20a_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gm107_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gm200_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gm20b_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gp102_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gp10b_pmu_new(struct nvkm_device *, int, struct nvkm_pmu **);
int gt215_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gf100_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gf119_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gk104_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gk110_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gk208_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gk20a_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gm107_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gm200_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gm20b_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gp102_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
int gp10b_pmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pmu **);
/* interface to MEMX process running on PMU */
struct nvkm_memx;
......
......@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h>
#undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_PMU ] = "pmu",
[NVKM_SUBDEV_THERM ] = "therm",
[NVKM_SUBDEV_TIMER ] = "tmr",
[NVKM_SUBDEV_TOP ] = "top",
......
......@@ -163,11 +163,11 @@ nvkm_pmu = {
int
nvkm_pmu_ctor(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
int index, struct nvkm_pmu *pmu)
enum nvkm_subdev_type type, int inst, struct nvkm_pmu *pmu)
{
int ret;
nvkm_subdev_ctor(&nvkm_pmu, device, index, &pmu->subdev);
nvkm_subdev_ctor(&nvkm_pmu, device, type, inst, &pmu->subdev);
mutex_init(&pmu->send.mutex);
......@@ -197,10 +197,10 @@ nvkm_pmu_ctor(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
int
nvkm_pmu_new_(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
int index, struct nvkm_pmu **ppmu)
enum nvkm_subdev_type type, int inst, struct nvkm_pmu **ppmu)
{
struct nvkm_pmu *pmu;
if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL)))
return -ENOMEM;
return nvkm_pmu_ctor(fwif, device, index, *ppmu);
return nvkm_pmu_ctor(fwif, device, type, inst, *ppmu);
}
......@@ -69,7 +69,8 @@ gf100_pmu_fwif[] = {
};
int
gf100_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gf100_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gf100_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gf100_pmu_fwif, device, type, inst, ppmu);
}
......@@ -47,7 +47,8 @@ gf119_pmu_fwif[] = {
};
int
gf119_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gf119_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gf119_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gf119_pmu_fwif, device, type, inst, ppmu);
}
......@@ -127,7 +127,8 @@ gk104_pmu_fwif[] = {
};
int
gk104_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gk104_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gk104_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gk104_pmu_fwif, device, type, inst, ppmu);
}
......@@ -106,7 +106,8 @@ gk110_pmu_fwif[] = {
};
int
gk110_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gk110_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gk110_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gk110_pmu_fwif, device, type, inst, ppmu);
}
......@@ -48,7 +48,8 @@ gk208_pmu_fwif[] = {
};
int
gk208_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gk208_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gk208_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gk208_pmu_fwif, device, type, inst, ppmu);
}
......@@ -210,7 +210,8 @@ gk20a_pmu_fwif[] = {
};
int
gk20a_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gk20a_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
struct gk20a_pmu *pmu;
int ret;
......@@ -219,7 +220,7 @@ gk20a_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
return -ENOMEM;
*ppmu = &pmu->base;
ret = nvkm_pmu_ctor(gk20a_pmu_fwif, device, index, &pmu->base);
ret = nvkm_pmu_ctor(gk20a_pmu_fwif, device, type, inst, &pmu->base);
if (ret)
return ret;
......
......@@ -49,7 +49,8 @@ gm107_pmu_fwif[] = {
};
int
gm107_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gm107_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gm107_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gm107_pmu_fwif, device, type, inst, ppmu);
}
......@@ -45,7 +45,8 @@ gm200_pmu_fwif[] = {
};
int
gm200_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gm200_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gm200_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gm200_pmu_fwif, device, type, inst, ppmu);
}
......@@ -240,7 +240,8 @@ gm20b_pmu_fwif[] = {
};
int
gm20b_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gm20b_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gm20b_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gm20b_pmu_fwif, device, type, inst, ppmu);
}
......@@ -51,7 +51,8 @@ gp102_pmu_fwif[] = {
};
int
gp102_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gp102_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gp102_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gp102_pmu_fwif, device, type, inst, ppmu);
}
......@@ -99,7 +99,8 @@ gp10b_pmu_fwif[] = {
};
int
gp10b_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gp10b_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gp10b_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gp10b_pmu_fwif, device, type, inst, ppmu);
}
......@@ -282,7 +282,8 @@ gt215_pmu_fwif[] = {
};
int
gt215_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
gt215_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_pmu **ppmu)
{
return nvkm_pmu_new_(gt215_pmu_fwif, device, index, ppmu);
return nvkm_pmu_new_(gt215_pmu_fwif, device, type, inst, ppmu);
}
......@@ -62,8 +62,8 @@ int gf100_pmu_nofw(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
int gm200_pmu_nofw(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
int gm20b_pmu_load(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
int nvkm_pmu_ctor(const struct nvkm_pmu_fwif *, struct nvkm_device *,
int index, struct nvkm_pmu *);
int nvkm_pmu_new_(const struct nvkm_pmu_fwif *, struct nvkm_device *,
int index, struct nvkm_pmu **);
int nvkm_pmu_ctor(const struct nvkm_pmu_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_pmu *);
int nvkm_pmu_new_(const struct nvkm_pmu_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_pmu **);
#endif
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