Re: [PATCH 42/44] drm/nouveau/nvenc/r535: initial support

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

 



On 10/24/23 12:51, Philipp Stanner wrote:
On Tue, 2023-09-19 at 06:21 +1000, Ben Skeggs wrote:
From: Ben Skeggs <bskeggs@xxxxxxxxxx>

Adds support for allocating VIDEO_ENCODER classes from RM.

Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx>

[...]

+static void *
+r535_nvenc_dtor(struct nvkm_engine *engine)
+{
+       struct nvkm_nvenc *nvenc = nvkm_nvenc(engine);
+
+       kfree(nvenc->engine.func);
+       return nvenc;
+}

Why is nvenc returned as void * when it's clearly always of type
struct nvkm_nvenc * ?

If it's sometimes necessary to convert it to a void-pointer I think it
would be better to do that by assigning to a void-pointer at the place
where r535_nvenc_dtor() is actually called. This void-pointer's
subsequent usage then would make it obvious why it's void *

Is it necessary to return it in an opaque form? If so, that should be
commented.

This is part of Nouveau's conventions for object-oriented programming. This would be part of the so-called "core". It's been a while since I worked with it, but the reason why it is a `void *` is because it makes other functions easier to write.

I hope this helps!

Cheers,
Martin

PS: I am not checking out Nouveau's mailing list often, so if anyone has some questions related to the kernel driver, feel free to ping me (mupuf) on #nouveau and I will try my best to provide some context or a pointer to someone else could be a good person to answer :)



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux