Commit 0aec69c7 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/therm: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent e4b15b4c
...@@ -60,7 +60,6 @@ struct nvkm_device { ...@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb; struct notifier_block nb;
} acpi; } acpi;
struct nvkm_therm *therm;
struct nvkm_timer *timer; struct nvkm_timer *timer;
struct nvkm_top *top; struct nvkm_top *top;
struct nvkm_volt *volt; struct nvkm_volt *volt;
...@@ -127,7 +126,6 @@ struct nvkm_device_chip { ...@@ -127,7 +126,6 @@ struct nvkm_device_chip {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **);
int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **); int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **);
int (*top )(struct nvkm_device *, int idx, struct nvkm_top **); int (*top )(struct nvkm_device *, int idx, struct nvkm_top **);
int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **); int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **);
......
...@@ -18,5 +18,6 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT , struct nvkm_fault , fault) ...@@ -18,5 +18,6 @@ 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_ACR , struct nvkm_acr , acr)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PMU , struct nvkm_pmu , pmu) 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_ICCSENSE, struct nvkm_iccsense, iccsense)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_THERM , struct nvkm_therm , therm)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
...@@ -107,13 +107,13 @@ void nvkm_therm_clkgate_init(struct nvkm_therm *, ...@@ -107,13 +107,13 @@ void nvkm_therm_clkgate_init(struct nvkm_therm *,
void nvkm_therm_clkgate_enable(struct nvkm_therm *); void nvkm_therm_clkgate_enable(struct nvkm_therm *);
void nvkm_therm_clkgate_fini(struct nvkm_therm *, bool); void nvkm_therm_clkgate_fini(struct nvkm_therm *, bool);
int nv40_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int nv40_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int nv50_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int nv50_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int g84_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int g84_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int gt215_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int gf119_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int gk104_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int gk104_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int gm107_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int gm200_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int gm200_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
int gp100_therm_new(struct nvkm_device *, int, struct nvkm_therm **); int gp100_therm_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_therm **);
#endif #endif
...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = { ...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_THERM ] = "therm",
[NVKM_SUBDEV_TIMER ] = "tmr", [NVKM_SUBDEV_TIMER ] = "tmr",
[NVKM_SUBDEV_TOP ] = "top", [NVKM_SUBDEV_TOP ] = "top",
[NVKM_SUBDEV_VOLT ] = "volt", [NVKM_SUBDEV_VOLT ] = "volt",
......
...@@ -421,10 +421,10 @@ nvkm_therm = { ...@@ -421,10 +421,10 @@ nvkm_therm = {
}; };
void void
nvkm_therm_ctor(struct nvkm_therm *therm, struct nvkm_device *device, nvkm_therm_ctor(struct nvkm_therm *therm, struct nvkm_device *device, enum nvkm_subdev_type type,
int index, const struct nvkm_therm_func *func) int inst, const struct nvkm_therm_func *func)
{ {
nvkm_subdev_ctor(&nvkm_therm, device, index, &therm->subdev); nvkm_subdev_ctor(&nvkm_therm, device, type, inst, &therm->subdev);
therm->func = func; therm->func = func;
nvkm_alarm_init(&therm->alarm, nvkm_therm_alarm); nvkm_alarm_init(&therm->alarm, nvkm_therm_alarm);
...@@ -443,13 +443,13 @@ nvkm_therm_ctor(struct nvkm_therm *therm, struct nvkm_device *device, ...@@ -443,13 +443,13 @@ nvkm_therm_ctor(struct nvkm_therm *therm, struct nvkm_device *device,
int int
nvkm_therm_new_(const struct nvkm_therm_func *func, struct nvkm_device *device, nvkm_therm_new_(const struct nvkm_therm_func *func, struct nvkm_device *device,
int index, struct nvkm_therm **ptherm) enum nvkm_subdev_type type, int inst, struct nvkm_therm **ptherm)
{ {
struct nvkm_therm *therm; struct nvkm_therm *therm;
if (!(therm = *ptherm = kzalloc(sizeof(*therm), GFP_KERNEL))) if (!(therm = *ptherm = kzalloc(sizeof(*therm), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_therm_ctor(therm, device, index, func); nvkm_therm_ctor(therm, device, type, inst, func);
return 0; return 0;
} }
...@@ -223,12 +223,13 @@ g84_therm = { ...@@ -223,12 +223,13 @@ g84_therm = {
}; };
int int
g84_therm_new(struct nvkm_device *device, int index, struct nvkm_therm **ptherm) g84_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm)
{ {
struct nvkm_therm *therm; struct nvkm_therm *therm;
int ret; int ret;
ret = nvkm_therm_new_(&g84_therm, device, index, &therm); ret = nvkm_therm_new_(&g84_therm, device, type, inst, &therm);
*ptherm = therm; *ptherm = therm;
if (ret) if (ret)
return ret; return ret;
......
...@@ -146,8 +146,8 @@ gf119_therm = { ...@@ -146,8 +146,8 @@ gf119_therm = {
}; };
int int
gf119_therm_new(struct nvkm_device *device, int index, gf119_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&gf119_therm, device, index, ptherm); return nvkm_therm_new_(&gf119_therm, device, type, inst, ptherm);
} }
...@@ -106,9 +106,8 @@ gk104_therm_func = { ...@@ -106,9 +106,8 @@ gk104_therm_func = {
}; };
static int static int
gk104_therm_new_(const struct nvkm_therm_func *func, gk104_therm_new_(const struct nvkm_therm_func *func, struct nvkm_device *device,
struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
int index,
const struct gk104_clkgate_engine_info *clkgate_order, const struct gk104_clkgate_engine_info *clkgate_order,
const struct gf100_idle_filter *idle_filter, const struct gf100_idle_filter *idle_filter,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
...@@ -118,19 +117,17 @@ gk104_therm_new_(const struct nvkm_therm_func *func, ...@@ -118,19 +117,17 @@ gk104_therm_new_(const struct nvkm_therm_func *func,
if (!therm) if (!therm)
return -ENOMEM; return -ENOMEM;
nvkm_therm_ctor(&therm->base, device, index, func); nvkm_therm_ctor(&therm->base, device, type, inst, func);
*ptherm = &therm->base; *ptherm = &therm->base;
therm->clkgate_order = clkgate_order; therm->clkgate_order = clkgate_order;
therm->idle_filter = idle_filter; therm->idle_filter = idle_filter;
return 0; return 0;
} }
int int
gk104_therm_new(struct nvkm_device *device, gk104_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_therm **ptherm)
int index, struct nvkm_therm **ptherm)
{ {
return gk104_therm_new_(&gk104_therm_func, device, index, return gk104_therm_new_(&gk104_therm_func, device, type, inst,
gk104_clkgate_engine_info, &gk104_idle_filter, gk104_clkgate_engine_info, &gk104_idle_filter,
ptherm); ptherm);
} }
...@@ -68,8 +68,8 @@ gm107_therm = { ...@@ -68,8 +68,8 @@ gm107_therm = {
}; };
int int
gm107_therm_new(struct nvkm_device *device, int index, gm107_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&gm107_therm, device, index, ptherm); return nvkm_therm_new_(&gm107_therm, device, type, inst, ptherm);
} }
...@@ -32,8 +32,8 @@ gm200_therm = { ...@@ -32,8 +32,8 @@ gm200_therm = {
}; };
int int
gm200_therm_new(struct nvkm_device *device, int index, gm200_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&gm200_therm, device, index, ptherm); return nvkm_therm_new_(&gm200_therm, device, type, inst, ptherm);
} }
...@@ -49,8 +49,8 @@ gp100_therm = { ...@@ -49,8 +49,8 @@ gp100_therm = {
}; };
int int
gp100_therm_new(struct nvkm_device *device, int index, gp100_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&gp100_therm, device, index, ptherm); return nvkm_therm_new_(&gp100_therm, device, type, inst, ptherm);
} }
...@@ -68,8 +68,8 @@ gt215_therm = { ...@@ -68,8 +68,8 @@ gt215_therm = {
}; };
int int
gt215_therm_new(struct nvkm_device *device, int index, gt215_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&gt215_therm, device, index, ptherm); return nvkm_therm_new_(&gt215_therm, device, type, inst, ptherm);
} }
...@@ -197,8 +197,8 @@ nv40_therm = { ...@@ -197,8 +197,8 @@ nv40_therm = {
}; };
int int
nv40_therm_new(struct nvkm_device *device, int index, nv40_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&nv40_therm, device, index, ptherm); return nvkm_therm_new_(&nv40_therm, device, type, inst, ptherm);
} }
...@@ -169,8 +169,8 @@ nv50_therm = { ...@@ -169,8 +169,8 @@ nv50_therm = {
}; };
int int
nv50_therm_new(struct nvkm_device *device, int index, nv50_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_therm **ptherm) struct nvkm_therm **ptherm)
{ {
return nvkm_therm_new_(&nv50_therm, device, index, ptherm); return nvkm_therm_new_(&nv50_therm, device, type, inst, ptherm);
} }
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#include <subdev/bios/gpio.h> #include <subdev/bios/gpio.h>
#include <subdev/bios/perf.h> #include <subdev/bios/perf.h>
int nvkm_therm_new_(const struct nvkm_therm_func *, struct nvkm_device *, int nvkm_therm_new_(const struct nvkm_therm_func *, struct nvkm_device *, enum nvkm_subdev_type,
int index, struct nvkm_therm **); int, struct nvkm_therm **);
void nvkm_therm_ctor(struct nvkm_therm *therm, struct nvkm_device *device, void nvkm_therm_ctor(struct nvkm_therm *, struct nvkm_device *, enum nvkm_subdev_type, int,
int index, const struct nvkm_therm_func *func); const struct nvkm_therm_func *);
struct nvkm_fan { struct nvkm_fan {
struct nvkm_therm *parent; struct nvkm_therm *parent;
......
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