summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2022-06-01 12:46:25 +0200
committerDave Airlie <airlied@redhat.com>2022-07-27 01:05:45 +0200
commit412dfcf34e0695fa1714ad422b2a5d0ed1406437 (patch)
tree5b9d73e577640f8cff51a7a11a2a51d781a97a02
parentdrm/nouveau/disp: collapse nvkm_dp into nvkm_outp (diff)
downloadlinux-412dfcf34e0695fa1714ad422b2a5d0ed1406437.tar.xz
linux-412dfcf34e0695fa1714ad422b2a5d0ed1406437.zip
drm/nouveau/disp: clean up nvkm_outp constructors
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c32
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c12
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h7
3 files changed, 19 insertions, 32 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
index 00d9bd3f9a6c..54ba9f22533c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
@@ -762,22 +762,26 @@ nvkm_dp_func = {
.disable = nvkm_dp_disable,
};
-static int
-nvkm_dp_ctor(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
- struct nvkm_i2c_aux *aux, struct nvkm_outp *outp)
+int
+nvkm_dp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE, struct nvkm_outp **poutp)
{
struct nvkm_device *device = disp->engine.subdev.device;
struct nvkm_bios *bios = device->bios;
struct nvkm_i2c *i2c = device->i2c;
+ struct nvkm_outp *outp;
u8 hdr, cnt, len;
u32 data;
int ret;
- ret = nvkm_outp_ctor(&nvkm_dp_func, disp, index, dcbE, outp);
+ ret = nvkm_outp_new_(&nvkm_dp_func, disp, index, dcbE, poutp);
+ outp = *poutp;
if (ret)
return ret;
- outp->dp.aux = aux;
+ if (dcbE->location == 0)
+ outp->dp.aux = nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_CCB(dcbE->i2c_index));
+ else
+ outp->dp.aux = nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_EXT(dcbE->extdev));
if (!outp->dp.aux) {
OUTP_ERR(outp, "no aux");
return -EINVAL;
@@ -812,21 +816,3 @@ nvkm_dp_ctor(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
atomic_set(&outp->dp.lt.done, 0);
return 0;
}
-
-int
-nvkm_dp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE, struct nvkm_outp **poutp)
-{
- struct nvkm_i2c *i2c = disp->engine.subdev.device->i2c;
- struct nvkm_i2c_aux *aux;
- struct nvkm_outp *outp;
-
- if (dcbE->location == 0)
- aux = nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_CCB(dcbE->i2c_index));
- else
- aux = nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_EXT(dcbE->extdev));
-
- if (!(outp = *poutp = kzalloc(sizeof(*outp), GFP_KERNEL)))
- return -ENOMEM;
-
- return nvkm_dp_ctor(disp, index, dcbE, aux, outp);
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c
index 129982fef7ef..3c5f1476d811 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c
@@ -294,13 +294,17 @@ nvkm_outp_del(struct nvkm_outp **poutp)
}
int
-nvkm_outp_ctor(const struct nvkm_outp_func *func, struct nvkm_disp *disp,
- int index, struct dcb_output *dcbE, struct nvkm_outp *outp)
+nvkm_outp_new_(const struct nvkm_outp_func *func, struct nvkm_disp *disp,
+ int index, struct dcb_output *dcbE, struct nvkm_outp **poutp)
{
struct nvkm_i2c *i2c = disp->engine.subdev.device->i2c;
+ struct nvkm_outp *outp;
enum nvkm_ior_proto proto;
enum nvkm_ior_type type;
+ if (!(outp = *poutp = kzalloc(sizeof(*outp), GFP_KERNEL)))
+ return -ENOMEM;
+
outp->func = func;
outp->disp = disp;
outp->index = index;
@@ -330,7 +334,5 @@ int
nvkm_outp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
struct nvkm_outp **poutp)
{
- if (!(*poutp = kzalloc(sizeof(**poutp), GFP_KERNEL)))
- return -ENOMEM;
- return nvkm_outp_ctor(&nvkm_outp, disp, index, dcbE, *poutp);
+ return nvkm_outp_new_(&nvkm_outp, disp, index, dcbE, poutp);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
index 8745d6a8139c..a72c123e9ca5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
@@ -55,10 +55,9 @@ struct nvkm_outp {
};
};
-int nvkm_outp_ctor(const struct nvkm_outp_func *, struct nvkm_disp *,
- int index, struct dcb_output *, struct nvkm_outp *);
-int nvkm_outp_new(struct nvkm_disp *, int index, struct dcb_output *,
- struct nvkm_outp **);
+int nvkm_outp_new_(const struct nvkm_outp_func *, struct nvkm_disp *, int index,
+ struct dcb_output *, struct nvkm_outp **);
+int nvkm_outp_new(struct nvkm_disp *, int index, struct dcb_output *, struct nvkm_outp **);
void nvkm_outp_del(struct nvkm_outp **);
void nvkm_outp_init(struct nvkm_outp *);
void nvkm_outp_fini(struct nvkm_outp *);