drm/nouveau/fault: switch to instanced constructor

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
This commit is contained in:
Ben Skeggs 2020-12-04 11:07:41 +10:00
Родитель 4a34fd0e88
Коммит 77689f1b6b
11 изменённых файлов: 30 добавлений и 33 удалений

Просмотреть файл

@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb;
} acpi;
struct nvkm_fault *fault;
struct nvkm_fb *fb;
struct nvkm_fuse *fuse;
struct nvkm_gpio *gpio;
@ -142,7 +141,6 @@ struct nvkm_device_chip {
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#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 (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **);

Просмотреть файл

@ -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_BUS , struct nvkm_bus , bus)
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_CLK , struct nvkm_clk , clk)

Просмотреть файл

@ -30,8 +30,8 @@ struct nvkm_fault_data {
u8 reason;
};
int gp100_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
int gp10b_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
int gv100_fault_new(struct nvkm_device *, int, struct nvkm_fault **);
int tu102_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 *, enum nvkm_subdev_type, int inst, 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 *, enum nvkm_subdev_type, int inst, struct nvkm_fault **);
#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_FAULT ] = "fault",
[NVKM_SUBDEV_FB ] = "fb",
[NVKM_SUBDEV_FUSE ] = "fuse",
[NVKM_SUBDEV_GPIO ] = "gpio",

Просмотреть файл

@ -2172,7 +2172,7 @@ nv130_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new,
.fault = { 0x00000001, gp100_fault_new },
.fb = gp100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2212,7 +2212,7 @@ nv132_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new,
.fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2250,7 +2250,7 @@ nv134_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new,
.fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2288,7 +2288,7 @@ nv136_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new,
.fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2325,7 +2325,7 @@ nv137_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new,
.fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2363,7 +2363,7 @@ nv138_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gm200_devinit_new },
.fault = gp100_fault_new,
.fault = { 0x00000001, gp100_fault_new },
.fb = gp102_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2397,7 +2397,7 @@ nv13b_chipset = {
.acr = { 0x00000001, gp10b_acr_new },
.bar = { 0x00000001, gm20b_bar_new },
.bus = { 0x00000001, gf100_bus_new },
.fault = gp10b_fault_new,
.fault = { 0x00000001, gp10b_fault_new },
.fb = gp10b_fb_new,
.fuse = gm107_fuse_new,
.ibus = gp10b_ibus_new,
@ -2423,7 +2423,7 @@ nv140_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, gv100_devinit_new },
.fault = gv100_fault_new,
.fault = { 0x00000001, gv100_fault_new },
.fb = gv100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2467,7 +2467,7 @@ nv162_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new,
.fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2505,7 +2505,7 @@ nv164_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new,
.fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2544,7 +2544,7 @@ nv166_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new,
.fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2584,7 +2584,7 @@ nv167_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new,
.fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -2622,7 +2622,7 @@ nv168_chipset = {
.bios = { 0x00000001, nvkm_bios_new },
.bus = { 0x00000001, gf100_bus_new },
.devinit = { 0x00000001, tu102_devinit_new },
.fault = tu102_fault_new,
.fault = { 0x00000001, tu102_fault_new },
.fb = gv100_fb_new,
.fuse = gm107_fuse_new,
.gpio = gk104_gpio_new,
@ -3248,7 +3248,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE
_(NVKM_SUBDEV_FAULT , fault);
_(NVKM_SUBDEV_FB , fb);
_(NVKM_SUBDEV_FUSE , fuse);
_(NVKM_SUBDEV_GPIO , gpio);

Просмотреть файл

@ -170,12 +170,12 @@ nvkm_fault = {
int
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;
if (!(fault = *pfault = kzalloc(sizeof(*fault), GFP_KERNEL)))
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->user.ctor = nvkm_ufault_new;
fault->user.base = func->user.base;

Просмотреть файл

@ -82,8 +82,8 @@ gp100_fault = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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 {
u64 addr;
};
int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *,
int index, struct nvkm_fault **);
int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *, enum nvkm_subdev_type,
int inst, struct nvkm_fault **);
struct nvkm_fault_func {
int (*oneinit)(struct nvkm_fault *);

Просмотреть файл

@ -181,8 +181,8 @@ tu102_fault = {
};
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)
{
return nvkm_fault_new_(&tu102_fault, device, index, pfault);
return nvkm_fault_new_(&tu102_fault, device, type, inst, pfault);
}