gpu: nvgpu: Use a callback to free struct gk20a

struct gk20a is now part of nvgpu_os_linux in Linux builds. gk20a.c
still frees struct gk20a by kfree(struct gk20a *), which is wrong.
Create a new function pointer in struct gk20a for freeing the
structure and call kfree(struct nvgpu_os_linux *) instead.

JIRA NVGPU-259

Change-Id: I412ee993002cb2a42f0db015fc676de43418ec2f
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1591012
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Terje Bergstrom
2017-11-02 15:41:37 -07:00
committed by mobile promotions
parent 9f5f029ae2
commit 1e7ba4c76d
7 changed files with 43 additions and 1 deletions

View File

@@ -274,3 +274,15 @@ void nvgpu_wait_for_deferred_interrupts(struct gk20a *g)
atomic_read(&l->sw_irq_nonstall_last_handled))
<= 0, 0);
}
static void nvgpu_free_gk20a(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
kfree(l);
}
void nvgpu_init_gk20a(struct gk20a *g)
{
g->free = nvgpu_free_gk20a;
}