Commit d9691a22 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/instmem: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 4dea1a96
...@@ -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_instmem *imem;
struct nvkm_ltc *ltc; struct nvkm_ltc *ltc;
struct nvkm_mc *mc; struct nvkm_mc *mc;
struct nvkm_mmu *mmu; struct nvkm_mmu *mmu;
...@@ -134,7 +133,6 @@ struct nvkm_device_chip { ...@@ -134,7 +133,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 (*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 **);
int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **); int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **);
int (*mmu )(struct nvkm_device *, int idx, struct nvkm_mmu **); int (*mmu )(struct nvkm_device *, int idx, struct nvkm_mmu **);
......
...@@ -6,6 +6,7 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GPIO , struct nvkm_gpio , gpio) ...@@ -6,6 +6,7 @@ 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_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_FB , struct nvkm_fb , fb) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FB , struct nvkm_fb , fb)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT , struct nvkm_fault , fault) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_FAULT , struct nvkm_fault , fault)
......
...@@ -30,8 +30,8 @@ int nvkm_instobj_new(struct nvkm_instmem *, u32 size, u32 align, bool zero, ...@@ -30,8 +30,8 @@ int nvkm_instobj_new(struct nvkm_instmem *, u32 size, u32 align, bool zero,
struct nvkm_memory **); struct nvkm_memory **);
int nv04_instmem_new(struct nvkm_device *, int, struct nvkm_instmem **); int nv04_instmem_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_instmem **);
int nv40_instmem_new(struct nvkm_device *, int, struct nvkm_instmem **); int nv40_instmem_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_instmem **);
int nv50_instmem_new(struct nvkm_device *, int, struct nvkm_instmem **); int nv50_instmem_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_instmem **);
int gk20a_instmem_new(struct nvkm_device *, int, struct nvkm_instmem **); int gk20a_instmem_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_instmem **);
#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_INSTMEM ] = "imem",
[NVKM_SUBDEV_LTC ] = "ltc", [NVKM_SUBDEV_LTC ] = "ltc",
[NVKM_SUBDEV_MC ] = "mc", [NVKM_SUBDEV_MC ] = "mc",
[NVKM_SUBDEV_MMU ] = "mmu", [NVKM_SUBDEV_MMU ] = "mmu",
......
...@@ -234,11 +234,10 @@ nvkm_instmem = { ...@@ -234,11 +234,10 @@ nvkm_instmem = {
}; };
void void
nvkm_instmem_ctor(const struct nvkm_instmem_func *func, nvkm_instmem_ctor(const struct nvkm_instmem_func *func, struct nvkm_device *device,
struct nvkm_device *device, int index, enum nvkm_subdev_type type, int inst, struct nvkm_instmem *imem)
struct nvkm_instmem *imem)
{ {
nvkm_subdev_ctor(&nvkm_instmem, device, index, &imem->subdev); nvkm_subdev_ctor(&nvkm_instmem, device, type, inst, &imem->subdev);
imem->func = func; imem->func = func;
spin_lock_init(&imem->lock); spin_lock_init(&imem->lock);
INIT_LIST_HEAD(&imem->list); INIT_LIST_HEAD(&imem->list);
......
...@@ -568,7 +568,7 @@ gk20a_instmem = { ...@@ -568,7 +568,7 @@ gk20a_instmem = {
}; };
int int
gk20a_instmem_new(struct nvkm_device *device, int index, gk20a_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_instmem **pimem) struct nvkm_instmem **pimem)
{ {
struct nvkm_device_tegra *tdev = device->func->tegra(device); struct nvkm_device_tegra *tdev = device->func->tegra(device);
...@@ -576,7 +576,7 @@ gk20a_instmem_new(struct nvkm_device *device, int index, ...@@ -576,7 +576,7 @@ gk20a_instmem_new(struct nvkm_device *device, int index,
if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL))) if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_instmem_ctor(&gk20a_instmem, device, index, &imem->base); nvkm_instmem_ctor(&gk20a_instmem, device, type, inst, &imem->base);
mutex_init(&imem->lock); mutex_init(&imem->lock);
*pimem = &imem->base; *pimem = &imem->base;
......
...@@ -217,14 +217,14 @@ nv04_instmem = { ...@@ -217,14 +217,14 @@ nv04_instmem = {
}; };
int int
nv04_instmem_new(struct nvkm_device *device, int index, nv04_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_instmem **pimem) struct nvkm_instmem **pimem)
{ {
struct nv04_instmem *imem; struct nv04_instmem *imem;
if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL))) if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_instmem_ctor(&nv04_instmem, device, index, &imem->base); nvkm_instmem_ctor(&nv04_instmem, device, type, inst, &imem->base);
*pimem = &imem->base; *pimem = &imem->base;
return 0; return 0;
} }
...@@ -235,7 +235,7 @@ nv40_instmem = { ...@@ -235,7 +235,7 @@ nv40_instmem = {
}; };
int int
nv40_instmem_new(struct nvkm_device *device, int index, nv40_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_instmem **pimem) struct nvkm_instmem **pimem)
{ {
struct nv40_instmem *imem; struct nv40_instmem *imem;
...@@ -243,7 +243,7 @@ nv40_instmem_new(struct nvkm_device *device, int index, ...@@ -243,7 +243,7 @@ nv40_instmem_new(struct nvkm_device *device, int index,
if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL))) if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_instmem_ctor(&nv40_instmem, device, index, &imem->base); nvkm_instmem_ctor(&nv40_instmem, device, type, inst, &imem->base);
*pimem = &imem->base; *pimem = &imem->base;
/* map bar */ /* map bar */
......
...@@ -386,14 +386,14 @@ nv50_instmem = { ...@@ -386,14 +386,14 @@ nv50_instmem = {
}; };
int int
nv50_instmem_new(struct nvkm_device *device, int index, nv50_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_instmem **pimem) struct nvkm_instmem **pimem)
{ {
struct nv50_instmem *imem; struct nv50_instmem *imem;
if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL))) if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
nvkm_instmem_ctor(&nv50_instmem, device, index, &imem->base); nvkm_instmem_ctor(&nv50_instmem, device, type, inst, &imem->base);
INIT_LIST_HEAD(&imem->lru); INIT_LIST_HEAD(&imem->lru);
*pimem = &imem->base; *pimem = &imem->base;
return 0; return 0;
......
...@@ -16,7 +16,7 @@ struct nvkm_instmem_func { ...@@ -16,7 +16,7 @@ struct nvkm_instmem_func {
}; };
void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *, void nvkm_instmem_ctor(const struct nvkm_instmem_func *, struct nvkm_device *,
int index, struct nvkm_instmem *); enum nvkm_subdev_type, int, struct nvkm_instmem *);
void nvkm_instmem_boot(struct nvkm_instmem *); void nvkm_instmem_boot(struct nvkm_instmem *);
#include <core/memory.h> #include <core/memory.h>
......
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