Commit c6ce0861 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/i2c: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent b240b212
......@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb;
} acpi;
struct nvkm_i2c *i2c;
struct nvkm_subdev *ibus;
struct nvkm_iccsense *iccsense;
struct nvkm_instmem *imem;
......@@ -137,7 +136,6 @@ struct nvkm_device_chip {
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE
int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **);
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 **);
......
......@@ -2,6 +2,7 @@
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_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)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb)
......
......@@ -85,15 +85,15 @@ struct nvkm_i2c {
struct nvkm_i2c_bus *nvkm_i2c_bus_find(struct nvkm_i2c *, int);
struct nvkm_i2c_aux *nvkm_i2c_aux_find(struct nvkm_i2c *, int);
int nv04_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int nv4e_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int nv50_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int g94_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int gf117_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int gf119_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int gk104_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int gk110_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int gm200_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
int nv04_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int nv4e_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int nv50_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int g94_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int gf117_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int gf119_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int gk104_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int gk110_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
int gm200_i2c_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_i2c **);
static inline int
nvkm_rdi2cr(struct i2c_adapter *adap, u8 addr, u8 reg)
......
......@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h>
#undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_I2C ] = "i2c",
[NVKM_SUBDEV_IBUS ] = "priv",
[NVKM_SUBDEV_ICCSENSE] = "iccsense",
[NVKM_SUBDEV_INSTMEM ] = "imem",
......
......@@ -277,7 +277,7 @@ nvkm_i2c_drv[] = {
int
nvkm_i2c_new_(const struct nvkm_i2c_func *func, struct nvkm_device *device,
int index, struct nvkm_i2c **pi2c)
enum nvkm_subdev_type type, int inst, struct nvkm_i2c **pi2c)
{
struct nvkm_bios *bios = device->bios;
struct nvkm_i2c *i2c;
......@@ -289,7 +289,7 @@ nvkm_i2c_new_(const struct nvkm_i2c_func *func, struct nvkm_device *device,
if (!(i2c = *pi2c = kzalloc(sizeof(*i2c), GFP_KERNEL)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_i2c, device, index, &i2c->subdev);
nvkm_subdev_ctor(&nvkm_i2c, device, type, inst, &i2c->subdev);
i2c->func = func;
INIT_LIST_HEAD(&i2c->pad);
INIT_LIST_HEAD(&i2c->bus);
......
......@@ -66,7 +66,8 @@ g94_i2c = {
};
int
g94_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
g94_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&g94_i2c, device, index, pi2c);
return nvkm_i2c_new_(&g94_i2c, device, type, inst, pi2c);
}
......@@ -30,7 +30,8 @@ gf117_i2c = {
};
int
gf117_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
gf117_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&gf117_i2c, device, index, pi2c);
return nvkm_i2c_new_(&gf117_i2c, device, type, inst, pi2c);
}
......@@ -34,7 +34,8 @@ gf119_i2c = {
};
int
gf119_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
gf119_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&gf119_i2c, device, index, pi2c);
return nvkm_i2c_new_(&gf119_i2c, device, type, inst, pi2c);
}
......@@ -66,7 +66,8 @@ gk104_i2c = {
};
int
gk104_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
gk104_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&gk104_i2c, device, index, pi2c);
return nvkm_i2c_new_(&gk104_i2c, device, type, inst, pi2c);
}
......@@ -39,7 +39,8 @@ gk110_i2c = {
};
int
gk110_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
gk110_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&gk110_i2c, device, index, pi2c);
return nvkm_i2c_new_(&gk110_i2c, device, type, inst, pi2c);
}
......@@ -41,7 +41,8 @@ gm200_i2c = {
};
int
gm200_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
gm200_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&gm200_i2c, device, index, pi2c);
return nvkm_i2c_new_(&gm200_i2c, device, type, inst, pi2c);
}
......@@ -30,7 +30,8 @@ nv04_i2c = {
};
int
nv04_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
nv04_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&nv04_i2c, device, index, pi2c);
return nvkm_i2c_new_(&nv04_i2c, device, type, inst, pi2c);
}
......@@ -30,7 +30,8 @@ nv4e_i2c = {
};
int
nv4e_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
nv4e_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&nv4e_i2c, device, index, pi2c);
return nvkm_i2c_new_(&nv4e_i2c, device, type, inst, pi2c);
}
......@@ -30,7 +30,8 @@ nv50_i2c = {
};
int
nv50_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
nv50_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_i2c **pi2c)
{
return nvkm_i2c_new_(&nv50_i2c, device, index, pi2c);
return nvkm_i2c_new_(&nv50_i2c, device, type, inst, pi2c);
}
......@@ -4,8 +4,8 @@
#define nvkm_i2c(p) container_of((p), struct nvkm_i2c, subdev)
#include <subdev/i2c.h>
int nvkm_i2c_new_(const struct nvkm_i2c_func *, struct nvkm_device *,
int index, struct nvkm_i2c **);
int nvkm_i2c_new_(const struct nvkm_i2c_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_i2c **);
struct nvkm_i2c_func {
int (*pad_x_new)(struct nvkm_i2c *, int id, struct nvkm_i2c_pad **);
......
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