Commit 412dfcf3 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

drm/nouveau/disp: clean up nvkm_outp constructors

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 7786fb36
......@@ -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);
}
......@@ -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);
}
......@@ -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 *);
......
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