Commit 8d056d99 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fuse: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent b7a9369a
...@@ -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_fuse *fuse;
struct nvkm_gpio *gpio; struct nvkm_gpio *gpio;
struct nvkm_gsp *gsp; struct nvkm_gsp *gsp;
struct nvkm_i2c *i2c; struct nvkm_i2c *i2c;
...@@ -140,7 +139,6 @@ struct nvkm_device_chip { ...@@ -140,7 +139,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 (*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 **);
int (*gsp )(struct nvkm_device *, int idx, struct nvkm_gsp **); int (*gsp )(struct nvkm_device *, int idx, struct nvkm_gsp **);
int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **); int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **);
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios) 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_FUSE , struct nvkm_fuse , fuse)
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_FB , struct nvkm_fb , fb) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar)
......
...@@ -11,7 +11,7 @@ struct nvkm_fuse { ...@@ -11,7 +11,7 @@ struct nvkm_fuse {
u32 nvkm_fuse_read(struct nvkm_fuse *, u32 addr); u32 nvkm_fuse_read(struct nvkm_fuse *, u32 addr);
int nv50_fuse_new(struct nvkm_device *, int, struct nvkm_fuse **); int nv50_fuse_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fuse **);
int gf100_fuse_new(struct nvkm_device *, int, struct nvkm_fuse **); int gf100_fuse_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fuse **);
int gm107_fuse_new(struct nvkm_device *, int, struct nvkm_fuse **); int gm107_fuse_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fuse **);
#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_FUSE ] = "fuse",
[NVKM_SUBDEV_GPIO ] = "gpio", [NVKM_SUBDEV_GPIO ] = "gpio",
[NVKM_SUBDEV_GSP ] = "gsp", [NVKM_SUBDEV_GSP ] = "gsp",
[NVKM_SUBDEV_I2C ] = "i2c", [NVKM_SUBDEV_I2C ] = "i2c",
......
...@@ -42,12 +42,12 @@ nvkm_fuse = { ...@@ -42,12 +42,12 @@ nvkm_fuse = {
int int
nvkm_fuse_new_(const struct nvkm_fuse_func *func, struct nvkm_device *device, nvkm_fuse_new_(const struct nvkm_fuse_func *func, struct nvkm_device *device,
int index, struct nvkm_fuse **pfuse) enum nvkm_subdev_type type, int inst, struct nvkm_fuse **pfuse)
{ {
struct nvkm_fuse *fuse; struct nvkm_fuse *fuse;
if (!(fuse = *pfuse = kzalloc(sizeof(*fuse), GFP_KERNEL))) if (!(fuse = *pfuse = kzalloc(sizeof(*fuse), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_subdev_ctor(&nvkm_fuse, device, index, &fuse->subdev); nvkm_subdev_ctor(&nvkm_fuse, device, type, inst, &fuse->subdev);
fuse->func = func; fuse->func = func;
spin_lock_init(&fuse->lock); spin_lock_init(&fuse->lock);
return 0; return 0;
......
...@@ -47,7 +47,8 @@ gf100_fuse = { ...@@ -47,7 +47,8 @@ gf100_fuse = {
}; };
int int
gf100_fuse_new(struct nvkm_device *device, int index, struct nvkm_fuse **pfuse) gf100_fuse_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fuse **pfuse)
{ {
return nvkm_fuse_new_(&gf100_fuse, device, index, pfuse); return nvkm_fuse_new_(&gf100_fuse, device, type, inst, pfuse);
} }
...@@ -36,7 +36,8 @@ gm107_fuse = { ...@@ -36,7 +36,8 @@ gm107_fuse = {
}; };
int int
gm107_fuse_new(struct nvkm_device *device, int index, struct nvkm_fuse **pfuse) gm107_fuse_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fuse **pfuse)
{ {
return nvkm_fuse_new_(&gm107_fuse, device, index, pfuse); return nvkm_fuse_new_(&gm107_fuse, device, type, inst, pfuse);
} }
...@@ -45,7 +45,8 @@ nv50_fuse = { ...@@ -45,7 +45,8 @@ nv50_fuse = {
}; };
int int
nv50_fuse_new(struct nvkm_device *device, int index, struct nvkm_fuse **pfuse) nv50_fuse_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_fuse **pfuse)
{ {
return nvkm_fuse_new_(&nv50_fuse, device, index, pfuse); return nvkm_fuse_new_(&nv50_fuse, device, type, inst, pfuse);
} }
...@@ -8,6 +8,6 @@ struct nvkm_fuse_func { ...@@ -8,6 +8,6 @@ struct nvkm_fuse_func {
u32 (*read)(struct nvkm_fuse *, u32 addr); u32 (*read)(struct nvkm_fuse *, u32 addr);
}; };
int nvkm_fuse_new_(const struct nvkm_fuse_func *, struct nvkm_device *, int nvkm_fuse_new_(const struct nvkm_fuse_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
int index, struct nvkm_fuse **); struct nvkm_fuse **);
#endif #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