Re: [Nouveau] [PATCH v2 2/6] instmem/gk20a: move memory allocation to instmem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 11, 2015 at 2:21 AM, Alexandre Courbot <gnurou@xxxxxxxxx> wrote:
> +static int
> +gk20a_instmem_fini(struct nvkm_object *object, bool suspend)
> +{
> +       struct gk20a_instmem_priv *priv = (void *)object;
> +       priv->addr = ~0ULL;
> +       return nvkm_instmem_fini(&priv->base, suspend);
> +}
> +
> +static int
> +gk20a_instmem_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
> +                  struct nvkm_oclass *oclass, void *data, u32 size,
> +                  struct nvkm_object **pobject)
> +{
> +       struct gk20a_instmem_priv *priv;
> +       int ret;
> +
> +       ret = nvkm_instmem_create(parent, engine, oclass, &priv);
> +       *pobject = nv_object(priv);
> +       if (ret)
> +               return ret;
> +
> +       spin_lock_init(&priv->lock);
> +
> +       return 0;
> +}
> +
> +struct nvkm_oclass *
> +gk20a_instmem_oclass = &(struct nvkm_instmem_impl) {
> +       .base.handle = NV_SUBDEV(INSTMEM, 0xea),
> +       .base.ofuncs = &(struct nvkm_ofuncs) {
> +               .ctor = gk20a_instmem_ctor,
> +               .dtor = _nvkm_instmem_dtor,
> +               .init = _nvkm_instmem_init,
> +               .fini = gk20a_instmem_fini,
> +       },
> +       .instobj = &gk20a_instobj_oclass.base,
> +}.base;

Minor point, but you could just reuse the nv50 functions here, instead
of redefining them (and get rid of gk20a_instmem_priv). Your call...
not like it's a ton of code being duplicated, and it would require
exposing the nv50_instmem_priv stuff.

Also, I know you're just copy/pasting the nv50 code for the instmem
stuff... but that open-coded ALIGN() is really painful to look at.

  -ilia
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux