Commit 77689f1b authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fault: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 4a34fd0e
...@@ -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_fault *fault;
struct nvkm_fb *fb; struct nvkm_fb *fb;
struct nvkm_fuse *fuse; struct nvkm_fuse *fuse;
struct nvkm_gpio *gpio; struct nvkm_gpio *gpio;
...@@ -142,7 +141,6 @@ struct nvkm_device_chip { ...@@ -142,7 +141,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 (*fault )(struct nvkm_device *, int idx, struct nvkm_fault **);
int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **); int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **);
int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **); int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **); int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **);
......
...@@ -3,5 +3,6 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios) ...@@ -3,5 +3,6 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit , devinit) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit , devinit)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar) 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_ACR , struct nvkm_acr , acr)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_CLK , struct nvkm_clk , clk)
...@@ -30,8 +30,8 @@ struct nvkm_fault_data { ...@@ -30,8 +30,8 @@ struct nvkm_fault_data {
u8 reason; u8 reason;
}; };
int gp100_fault_new(struct nvkm_device *, int, struct nvkm_fault **); int gp100_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
int gp10b_fault_new(struct nvkm_device *, int, struct nvkm_fault **); int gp10b_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
int gv100_fault_new(struct nvkm_device *, int, struct nvkm_fault **); int gv100_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
int tu102_fault_new(struct nvkm_device *, int, struct nvkm_fault **); int tu102_fault_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
#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_FAULT ] = "fault",
[NVKM_SUBDEV_FB ] = "fb", [NVKM_SUBDEV_FB ] = "fb",
[NVKM_SUBDEV_FUSE ] = "fuse", [NVKM_SUBDEV_FUSE ] = "fuse",
[NVKM_SUBDEV_GPIO ] = "gpio", [NVKM_SUBDEV_GPIO ] = "gpio",
......
...@@ -2172,7 +2172,7 @@ nv130_chipset = { ...@@ -2172,7 +2172,7 @@ nv130_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new }, .devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new, .fault = { 0x00000001, gp100_fault_new },
.fb = gp100_fb_new, .fb = gp100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2212,7 +2212,7 @@ nv132_chipset = { ...@@ -2212,7 +2212,7 @@ nv132_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new }, .devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new, .fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new, .fb = gp102_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2250,7 +2250,7 @@ nv134_chipset = { ...@@ -2250,7 +2250,7 @@ nv134_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new }, .devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new, .fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new, .fb = gp102_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2288,7 +2288,7 @@ nv136_chipset = { ...@@ -2288,7 +2288,7 @@ nv136_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new }, .devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new, .fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new, .fb = gp102_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2325,7 +2325,7 @@ nv137_chipset = { ...@@ -2325,7 +2325,7 @@ nv137_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new }, .devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new, .fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new, .fb = gp102_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2363,7 +2363,7 @@ nv138_chipset = { ...@@ -2363,7 +2363,7 @@ nv138_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new }, .devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new, .fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new, .fb = gp102_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2397,7 +2397,7 @@ nv13b_chipset = { ...@@ -2397,7 +2397,7 @@ nv13b_chipset = {
.acr = { 0x00000001, gp10b_acr_new }, .acr = { 0x00000001, gp10b_acr_new },
.bar = { 0x00000001, gm20b_bar_new }, .bar = { 0x00000001, gm20b_bar_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.fault = gp10b_fault_new, .fault = { 0x00000001, gp10b_fault_new },
.fb = gp10b_fb_new, .fb = gp10b_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.ibus = gp10b_ibus_new, .ibus = gp10b_ibus_new,
...@@ -2423,7 +2423,7 @@ nv140_chipset = { ...@@ -2423,7 +2423,7 @@ nv140_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gv100_devinit_new }, .devinit = { 0x00000001, gv100_devinit_new },
.fault = gv100_fault_new, .fault = { 0x00000001, gv100_fault_new },
.fb = gv100_fb_new, .fb = gv100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2467,7 +2467,7 @@ nv162_chipset = { ...@@ -2467,7 +2467,7 @@ nv162_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new }, .devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new, .fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new, .fb = gv100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2505,7 +2505,7 @@ nv164_chipset = { ...@@ -2505,7 +2505,7 @@ nv164_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new }, .devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new, .fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new, .fb = gv100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2544,7 +2544,7 @@ nv166_chipset = { ...@@ -2544,7 +2544,7 @@ nv166_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new }, .devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new, .fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new, .fb = gv100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2584,7 +2584,7 @@ nv167_chipset = { ...@@ -2584,7 +2584,7 @@ nv167_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new }, .devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new, .fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new, .fb = gv100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -2622,7 +2622,7 @@ nv168_chipset = { ...@@ -2622,7 +2622,7 @@ nv168_chipset = {
.bios = { 0x00000001, nvkm_bios_new }, .bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new }, .bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new }, .devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new, .fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new, .fb = gv100_fb_new,
.fuse = gm107_fuse_new, .fuse = gm107_fuse_new,
.gpio = gk104_gpio_new, .gpio = gk104_gpio_new,
...@@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
_(NVKM_SUBDEV_FAULT , fault);
_(NVKM_SUBDEV_FB , fb); _(NVKM_SUBDEV_FB , fb);
_(NVKM_SUBDEV_FUSE , fuse); _(NVKM_SUBDEV_FUSE , fuse);
_(NVKM_SUBDEV_GPIO , gpio); _(NVKM_SUBDEV_GPIO , gpio);
......
...@@ -170,12 +170,12 @@ nvkm_fault = { ...@@ -170,12 +170,12 @@ nvkm_fault = {
int int
nvkm_fault_new_(const struct nvkm_fault_func *func, struct nvkm_device *device, nvkm_fault_new_(const struct nvkm_fault_func *func, struct nvkm_device *device,
int index, struct nvkm_fault **pfault) enum nvkm_subdev_type type, int inst, struct nvkm_fault **pfault)
{ {
struct nvkm_fault *fault; struct nvkm_fault *fault;
if (!(fault = *pfault = kzalloc(sizeof(*fault), GFP_KERNEL))) if (!(fault = *pfault = kzalloc(sizeof(*fault), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_subdev_ctor(&nvkm_fault, device, index, &fault->subdev); nvkm_subdev_ctor(&nvkm_fault, device, type, inst, &fault->subdev);
fault->func = func; fault->func = func;
fault->user.ctor = nvkm_ufault_new; fault->user.ctor = nvkm_ufault_new;
fault->user.base = func->user.base; fault->user.base = func->user.base;
......
...@@ -82,8 +82,8 @@ gp100_fault = { ...@@ -82,8 +82,8 @@ gp100_fault = {
}; };
int int
gp100_fault_new(struct nvkm_device *device, int index, gp100_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fault **pfault) struct nvkm_fault **pfault)
{ {
return nvkm_fault_new_(&gp100_fault, device, index, pfault); return nvkm_fault_new_(&gp100_fault, device, type, inst, pfault);
} }
...@@ -46,8 +46,8 @@ gp10b_fault = { ...@@ -46,8 +46,8 @@ gp10b_fault = {
}; };
int int
gp10b_fault_new(struct nvkm_device *device, int index, gp10b_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fault **pfault) struct nvkm_fault **pfault)
{ {
return nvkm_fault_new_(&gp10b_fault, device, index, pfault); return nvkm_fault_new_(&gp10b_fault, device, type, inst, pfault);
} }
...@@ -228,8 +228,8 @@ gv100_fault = { ...@@ -228,8 +228,8 @@ gv100_fault = {
}; };
int int
gv100_fault_new(struct nvkm_device *device, int index, gv100_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fault **pfault) struct nvkm_fault **pfault)
{ {
return nvkm_fault_new_(&gv100_fault, device, index, pfault); return nvkm_fault_new_(&gv100_fault, device, type, inst, pfault);
} }
...@@ -18,8 +18,8 @@ struct nvkm_fault_buffer { ...@@ -18,8 +18,8 @@ struct nvkm_fault_buffer {
u64 addr; u64 addr;
}; };
int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *, int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *, enum nvkm_subdev_type,
int index, struct nvkm_fault **); int inst, struct nvkm_fault **);
struct nvkm_fault_func { struct nvkm_fault_func {
int (*oneinit)(struct nvkm_fault *); int (*oneinit)(struct nvkm_fault *);
......
...@@ -181,8 +181,8 @@ tu102_fault = { ...@@ -181,8 +181,8 @@ tu102_fault = {
}; };
int int
tu102_fault_new(struct nvkm_device *device, int index, tu102_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fault **pfault) struct nvkm_fault **pfault)
{ {
return nvkm_fault_new_(&tu102_fault, device, index, pfault); return nvkm_fault_new_(&tu102_fault, device, type, inst, pfault);
} }
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