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 {
struct notifier_block nb;
} acpi;
struct nvkm_subdev *ibus;
struct nvkm_iccsense *iccsense;
struct nvkm_instmem *imem;
struct nvkm_ltc *ltc;
......@@ -136,7 +135,6 @@ struct nvkm_device_chip {
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#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 (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **);
int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **);
......
/* SPDX-License-Identifier: MIT */
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_IBUS , struct nvkm_subdev , ibus)
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_FUSE , struct nvkm_fuse , fuse)
......
......@@ -104,8 +104,8 @@ struct nvkm_subdev_func {
};
extern const char *nvkm_subdev_type[NVKM_SUBDEV_NR];
int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *,
int index, struct nvkm_subdev **);
int nvkm_subdev_new_(const struct nvkm_subdev_func *, struct nvkm_device *, enum nvkm_subdev_type,
int inst, struct nvkm_subdev **);
void nvkm_subdev_ctor_(const struct nvkm_subdev_func *, bool old, struct nvkm_device *,
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))
......
......@@ -3,10 +3,10 @@
#define __NVKM_IBUS_H__
#include <core/subdev.h>
int gf100_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
int gf117_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
int gk104_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
int gk20a_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
int gm200_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
int gp10b_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 *, enum nvkm_subdev_type, int inst, 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 *, enum nvkm_subdev_type, int inst, 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 *, enum nvkm_subdev_type, int inst, struct nvkm_subdev **);
#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_IBUS ] = "priv",
[NVKM_SUBDEV_ICCSENSE] = "iccsense",
[NVKM_SUBDEV_INSTMEM ] = "imem",
[NVKM_SUBDEV_LTC ] = "ltc",
......@@ -253,12 +252,11 @@ nvkm_subdev_ctor_(const struct nvkm_subdev_func *func, bool old,
}
int
nvkm_subdev_new_(const struct nvkm_subdev_func *func,
struct nvkm_device *device, int index,
struct nvkm_subdev **psubdev)
nvkm_subdev_new_(const struct nvkm_subdev_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_subdev **psubdev)
{
if (!(*psubdev = kzalloc(sizeof(**psubdev), GFP_KERNEL)))
return -ENOMEM;
nvkm_subdev_ctor(func, device, index, *psubdev);
nvkm_subdev_ctor(func, device, type, inst, *psubdev);
return 0;
}
......@@ -115,8 +115,8 @@ gf100_ibus = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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