From 24e1c7e0a729158be36d63b821550d206a8a0436 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 8 Mar 2017 17:08:50 -0800 Subject: gpu: nvgpu: Use new kmem API functions (misc) Use the new kmem API functions in misc gk20a code. Some additional modifications were also made: o Add a struct gk20a pointer to gk20a_fence to enable proper kmem free usage. o Add gk20a pointer to alloc_session() in dbg_gpu_gk20a.c to use kmem API for allocating a session. o Plumb a gk20a pointer through the fence creation and deletion. o Use statically allocated buffers for names in file creation. Bug 1799159 Bug 1823380 Change-Id: I3678080e3ffa1f9bcf6934e3f4819a1bc531689b Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1318323 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index b5098849..7054e2a2 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c @@ -69,14 +69,14 @@ static int generate_unique_id(void) return atomic_add_return(1, &unique_id); } -static int alloc_session(struct dbg_session_gk20a **_dbg_s) +static int alloc_session(struct gk20a *g, struct dbg_session_gk20a **_dbg_s) { struct dbg_session_gk20a *dbg_s; *_dbg_s = NULL; gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, ""); - dbg_s = kzalloc(sizeof(*dbg_s), GFP_KERNEL); + dbg_s = nvgpu_kzalloc(g, sizeof(*dbg_s)); if (!dbg_s) return -ENOMEM; @@ -125,7 +125,7 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "dbg session: %s", g->name); - err = alloc_session(&dbg_session); + err = alloc_session(g, &dbg_session); if (err) goto free_ref; @@ -443,10 +443,10 @@ int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s, session_data = ch_data->session_data; list_del_init(&session_data->dbg_s_entry); - kfree(session_data); + nvgpu_kfree(dbg_s->g, session_data); fput(ch_data->ch_f); - kfree(ch_data); + nvgpu_kfree(dbg_s->g, ch_data); return 0; } @@ -545,7 +545,7 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp) nvgpu_mutex_destroy(&dbg_s->ch_list_lock); nvgpu_mutex_destroy(&dbg_s->ioctl_lock); - kfree(dbg_s); + nvgpu_kfree(g, dbg_s); gk20a_put(g); return 0; @@ -582,7 +582,7 @@ static int dbg_bind_channel_gk20a(struct dbg_session_gk20a *dbg_s, nvgpu_mutex_acquire(&g->dbg_sessions_lock); nvgpu_mutex_acquire(&ch->dbg_s_lock); - ch_data = kzalloc(sizeof(*ch_data), GFP_KERNEL); + ch_data = nvgpu_kzalloc(g, sizeof(*ch_data)); if (!ch_data) { fput(f); return -ENOMEM; @@ -592,9 +592,9 @@ static int dbg_bind_channel_gk20a(struct dbg_session_gk20a *dbg_s, ch_data->chid = ch->hw_chid; INIT_LIST_HEAD(&ch_data->ch_entry); - session_data = kzalloc(sizeof(*session_data), GFP_KERNEL); + session_data = nvgpu_kzalloc(g, sizeof(*session_data)); if (!session_data) { - kfree(ch_data); + nvgpu_kfree(g, ch_data); fput(f); return -ENOMEM; } @@ -796,7 +796,7 @@ static int nvgpu_dbg_gpu_ioctl_write_single_sm_error_state( if (sm_id >= gr->no_of_sm) return -EINVAL; - sm_error_state = kzalloc(sizeof(*sm_error_state), GFP_KERNEL); + sm_error_state = nvgpu_kzalloc(g, sizeof(*sm_error_state)); if (!sm_error_state) return -ENOMEM; @@ -829,7 +829,7 @@ static int nvgpu_dbg_gpu_ioctl_write_single_sm_error_state( gk20a_idle(g); err_free: - kfree(sm_error_state); + nvgpu_kfree(g, sm_error_state); return err; } -- cgit v1.2.2