Commit c5f38d67 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/ibus: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent c6ce0861
...@@ -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_subdev *ibus;
struct nvkm_iccsense *iccsense; struct nvkm_iccsense *iccsense;
struct nvkm_instmem *imem; struct nvkm_instmem *imem;
struct nvkm_ltc *ltc; struct nvkm_ltc *ltc;
...@@ -136,7 +135,6 @@ struct nvkm_device_chip { ...@@ -136,7 +135,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 (*ibus )(struct nvkm_device *, int idx, struct nvkm_subdev **);
int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **); int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **);
int (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **); int (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **);
int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **); int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **);
......
/* 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_IBUS , struct nvkm_subdev , ibus)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GPIO , struct nvkm_gpio , gpio) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GPIO , struct nvkm_gpio , gpio)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_I2C , struct nvkm_i2c , i2c) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_I2C , struct nvkm_i2c , i2c)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FUSE , struct nvkm_fuse , fuse) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FUSE , struct nvkm_fuse , fuse)
......
...@@ -104,8 +104,8 @@ struct nvkm_subdev_func { ...@@ -104,8 +104,8 @@ struct nvkm_subdev_func {
}; };
extern const char *nvkm_subdev_type[NVKM_SUBDEV_NR]; extern const char *nvkm_subdev_type[NVKM_SUBDEV_NR];
int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *, int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *, enum nvkm_subdev_type,
int index, struct nvkm_subdev **); int inst, struct nvkm_subdev **);
void nvkm_subdev_ctor_(const struct nvkm_subdev_func *, bool old, struct nvkm_device *, void nvkm_subdev_ctor_(const struct nvkm_subdev_func *, bool old, struct nvkm_device *,
enum nvkm_subdev_type, int inst, struct nvkm_subdev *); enum nvkm_subdev_type, int inst, struct nvkm_subdev *);
#define nvkm_subdev_ctor_o(f,d,i, s) nvkm_subdev_ctor_((f), true, (d), (i), -1 , (s)) #define nvkm_subdev_ctor_o(f,d,i, s) nvkm_subdev_ctor_((f), true, (d), (i), -1 , (s))
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
#define __NVKM_IBUS_H__ #define __NVKM_IBUS_H__
#include <core/subdev.h> #include <core/subdev.h>
int gf100_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); int gf100_ibus_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
int gf117_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); int gf117_ibus_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
int gk104_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); int gk104_ibus_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
int gk20a_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); int gk20a_ibus_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
int gm200_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); int gm200_ibus_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
int gp10b_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); int gp10b_ibus_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
#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_IBUS ] = "priv",
[NVKM_SUBDEV_ICCSENSE] = "iccsense", [NVKM_SUBDEV_ICCSENSE] = "iccsense",
[NVKM_SUBDEV_INSTMEM ] = "imem", [NVKM_SUBDEV_INSTMEM ] = "imem",
[NVKM_SUBDEV_LTC ] = "ltc", [NVKM_SUBDEV_LTC ] = "ltc",
...@@ -253,12 +252,11 @@ nvkm_subdev_ctor_(const struct nvkm_subdev_func *func, bool old, ...@@ -253,12 +252,11 @@ nvkm_subdev_ctor_(const struct nvkm_subdev_func *func, bool old,
} }
int int
nvkm_subdev_new_(const struct nvkm_subdev_func *func, nvkm_subdev_new_(const struct nvkm_subdev_func *func, struct nvkm_device *device,
struct nvkm_device *device, int index, enum nvkm_subdev_type type, int inst, struct nvkm_subdev **psubdev)
struct nvkm_subdev **psubdev)
{ {
if (!(*psubdev = kzalloc(sizeof(**psubdev), GFP_KERNEL))) if (!(*psubdev = kzalloc(sizeof(**psubdev), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_subdev_ctor(func, device, index, *psubdev); nvkm_subdev_ctor(func, device, type, inst, *psubdev);
return 0; return 0;
} }
...@@ -115,8 +115,8 @@ gf100_ibus = { ...@@ -115,8 +115,8 @@ gf100_ibus = {
}; };
int int
gf100_ibus_new(struct nvkm_device *device, int index, gf100_ibus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pibus) struct nvkm_subdev **pibus)
{ {
return nvkm_subdev_new_(&gf100_ibus, device, index, pibus); return nvkm_subdev_new_(&gf100_ibus, device, type, inst, pibus);
} }
...@@ -40,8 +40,8 @@ gf117_ibus = { ...@@ -40,8 +40,8 @@ gf117_ibus = {
}; };
int int
gf117_ibus_new(struct nvkm_device *device, int index, gf117_ibus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pibus) struct nvkm_subdev **pibus)
{ {
return nvkm_subdev_new_(&gf117_ibus, device, index, pibus); return nvkm_subdev_new_(&gf117_ibus, device, type, inst, pibus);
} }
...@@ -118,8 +118,8 @@ gk104_ibus = { ...@@ -118,8 +118,8 @@ gk104_ibus = {
}; };
int int
gk104_ibus_new(struct nvkm_device *device, int index, gk104_ibus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pibus) struct nvkm_subdev **pibus)
{ {
return nvkm_subdev_new_(&gk104_ibus, device, index, pibus); return nvkm_subdev_new_(&gk104_ibus, device, type, inst, pibus);
} }
...@@ -78,8 +78,8 @@ gk20a_ibus = { ...@@ -78,8 +78,8 @@ gk20a_ibus = {
}; };
int int
gk20a_ibus_new(struct nvkm_device *device, int index, gk20a_ibus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pibus) struct nvkm_subdev **pibus)
{ {
return nvkm_subdev_new_(&gk20a_ibus, device, index, pibus); return nvkm_subdev_new_(&gk20a_ibus, device, type, inst, pibus);
} }
...@@ -29,8 +29,8 @@ gm200_ibus = { ...@@ -29,8 +29,8 @@ gm200_ibus = {
}; };
int int
gm200_ibus_new(struct nvkm_device *device, int index, gm200_ibus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pibus) struct nvkm_subdev **pibus)
{ {
return nvkm_subdev_new_(&gm200_ibus, device, index, pibus); return nvkm_subdev_new_(&gm200_ibus, device, type, inst, pibus);
} }
...@@ -48,8 +48,8 @@ gp10b_ibus = { ...@@ -48,8 +48,8 @@ gp10b_ibus = {
}; };
int int
gp10b_ibus_new(struct nvkm_device *device, int index, gp10b_ibus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pibus) struct nvkm_subdev **pibus)
{ {
return nvkm_subdev_new_(&gp10b_ibus, device, index, pibus); return nvkm_subdev_new_(&gp10b_ibus, device, type, inst, pibus);
} }
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