Commit c5f38d67 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

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
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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 **);
+1 −0
Original line number Diff line number Diff line
/* 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)
+2 −2
Original line number Diff line number Diff line
@@ -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))
+6 −6
Original line number Diff line number Diff line
@@ -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
+3 −5
Original line number Diff line number Diff line
@@ -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;
}
Loading