Commit 0a7bff10 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/mxm: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 353108a4
...@@ -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 *mxm;
struct nvkm_pci *pci; struct nvkm_pci *pci;
struct nvkm_pmu *pmu; struct nvkm_pmu *pmu;
struct nvkm_therm *therm; struct nvkm_therm *therm;
...@@ -130,7 +129,6 @@ struct nvkm_device_chip { ...@@ -130,7 +129,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 (*mxm )(struct nvkm_device *, int idx, struct nvkm_subdev **);
int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **); int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **);
int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **); int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **);
int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **);
......
...@@ -5,6 +5,7 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_IBUS , struct nvkm_subdev , ibus) ...@@ -5,6 +5,7 @@ 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)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MXM , struct nvkm_subdev , mxm)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MC , struct nvkm_mc , mc) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_MC , struct nvkm_mc , mc)
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_INSTMEM , struct nvkm_instmem , imem) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_INSTMEM , struct nvkm_instmem , imem)
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
#define __NVKM_MXM_H__ #define __NVKM_MXM_H__
#include <core/subdev.h> #include <core/subdev.h>
int nv50_mxm_new(struct nvkm_device *, int, struct nvkm_subdev **); int nv50_mxm_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_MXM ] = "mxm",
[NVKM_SUBDEV_PCI ] = "pci", [NVKM_SUBDEV_PCI ] = "pci",
[NVKM_SUBDEV_PMU ] = "pmu", [NVKM_SUBDEV_PMU ] = "pmu",
[NVKM_SUBDEV_THERM ] = "therm", [NVKM_SUBDEV_THERM ] = "therm",
......
...@@ -230,7 +230,8 @@ nvkm_mxm = { ...@@ -230,7 +230,8 @@ nvkm_mxm = {
}; };
int int
nvkm_mxm_new_(struct nvkm_device *device, int index, struct nvkm_mxm **pmxm) nvkm_mxm_new_(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_mxm **pmxm)
{ {
struct nvkm_bios *bios = device->bios; struct nvkm_bios *bios = device->bios;
struct nvkm_mxm *mxm; struct nvkm_mxm *mxm;
...@@ -240,7 +241,7 @@ nvkm_mxm_new_(struct nvkm_device *device, int index, struct nvkm_mxm **pmxm) ...@@ -240,7 +241,7 @@ nvkm_mxm_new_(struct nvkm_device *device, int index, struct nvkm_mxm **pmxm)
if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL))) if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_subdev_ctor(&nvkm_mxm, device, index, &mxm->subdev); nvkm_subdev_ctor(&nvkm_mxm, device, type, inst, &mxm->subdev);
data = mxm_table(bios, &ver, &len); data = mxm_table(bios, &ver, &len);
if (!data || !(ver = nvbios_rd08(bios, data))) { if (!data || !(ver = nvbios_rd08(bios, data))) {
......
...@@ -201,12 +201,13 @@ mxm_dcb_sanitise(struct nvkm_mxm *mxm) ...@@ -201,12 +201,13 @@ mxm_dcb_sanitise(struct nvkm_mxm *mxm)
} }
int int
nv50_mxm_new(struct nvkm_device *device, int index, struct nvkm_subdev **pmxm) nv50_mxm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev **pmxm)
{ {
struct nvkm_mxm *mxm; struct nvkm_mxm *mxm;
int ret; int ret;
ret = nvkm_mxm_new_(device, index, &mxm); ret = nvkm_mxm_new_(device, type, inst, &mxm);
if (mxm) if (mxm)
*pmxm = &mxm->subdev; *pmxm = &mxm->subdev;
if (ret) if (ret)
......
...@@ -12,5 +12,5 @@ struct nvkm_mxm { ...@@ -12,5 +12,5 @@ struct nvkm_mxm {
u8 *mxms; u8 *mxms;
}; };
int nvkm_mxm_new_(struct nvkm_device *, int index, struct nvkm_mxm **); int nvkm_mxm_new_(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_mxm **);
#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