From 821d1cab904d055264bc5d62b0c0d5187417ff13 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 8 Jun 2017 10:13:51 -0700 Subject: gpu: nvgpu: Move error notifier free to Linux module Freeing error notifier involves calling dma_buf API, which is Linux specific. Move the free to happen in Linux specific channel close path. JIRA NVGPU-65 Change-Id: Ifd8b31bb8c8af13975c34add00f51dd869cfd76a Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1498583 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman --- drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 2c9fac0b..a083cb81 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -180,6 +180,19 @@ static int gk20a_channel_set_wdt_status(struct channel_gk20a *ch, return 0; } +static void gk20a_channel_free_error_notifiers(struct channel_gk20a *ch) +{ + nvgpu_mutex_acquire(&ch->error_notifier_mutex); + if (ch->error_notifier_ref) { + dma_buf_vunmap(ch->error_notifier_ref, ch->error_notifier_va); + dma_buf_put(ch->error_notifier_ref); + ch->error_notifier_ref = NULL; + ch->error_notifier = NULL; + ch->error_notifier_va = NULL; + } + nvgpu_mutex_release(&ch->error_notifier_mutex); +} + static int gk20a_init_error_notifier(struct channel_gk20a *ch, struct nvgpu_set_error_notifier *args) { @@ -262,6 +275,8 @@ int gk20a_channel_release(struct inode *inode, struct file *filp) trace_gk20a_channel_release(dev_name(g->dev)); gk20a_channel_close(ch); + gk20a_channel_free_error_notifiers(ch); + gk20a_idle(g); channel_release: -- cgit v1.2.2