From 3ab4a992e10cd0a312a865a4937b90162978356c Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 8 Mar 2017 16:58:49 -0800 Subject: gpu: nvgpu: Use new kmem API functions (gp10b/*) Use the new kmem API functions in gp10b/*. Bug 1799159 Bug 1823380 Change-Id: Ia643c704aca2e23e3762c9b7dbdf1aa1f2363811 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1318309 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 13 ++++++------ .../gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | 23 ++++++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 4898502d..6de6b599 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c @@ -21,6 +21,9 @@ #include #include +#include +#include + #include "gk20a/gk20a.h" #include "gk20a/gr_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" @@ -29,8 +32,6 @@ #include "gp10b/gr_gp10b.h" #include "gp10b_sysfs.h" -#include - #include #include #include @@ -1479,7 +1480,7 @@ static int gr_gp10b_load_smid_config(struct gk20a *g) u32 tpc_index, gpc_index; u32 max_gpcs = nvgpu_get_litter_value(g, GPU_LIT_NUM_GPCS); - tpc_sm_id = kcalloc(gr_cwd_sm_id__size_1_v(), sizeof(u32), GFP_KERNEL); + tpc_sm_id = nvgpu_kcalloc(g, gr_cwd_sm_id__size_1_v(), sizeof(u32)); if (!tpc_sm_id) return -ENOMEM; @@ -1512,7 +1513,7 @@ static int gr_gp10b_load_smid_config(struct gk20a *g) for (i = 0; i < gr_cwd_sm_id__size_1_v(); i++) gk20a_writel(g, gr_cwd_sm_id_r(i), tpc_sm_id[i]); - kfree(tpc_sm_id); + nvgpu_kfree(g, tpc_sm_id); return 0; } @@ -2224,7 +2225,7 @@ static int gp10b_gr_fuse_override(struct gk20a *g) if (count <= 0) return count; - fuses = kmalloc(sizeof(u32) * count * 2, GFP_KERNEL); + fuses = nvgpu_kmalloc(g, sizeof(u32) * count * 2); if (!fuses) return -ENOMEM; of_property_read_u32_array(np, "fuse-overrides", fuses, count * 2); @@ -2247,7 +2248,7 @@ static int gp10b_gr_fuse_override(struct gk20a *g) } } - kfree(fuses); + nvgpu_kfree(g, fuses); return 0; } diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c index 27db9c12..8e8792f6 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c @@ -16,18 +16,19 @@ #include #include #include -#include #include #include #include #include #include - #include #include #include +#include + +#include #include "clk.h" @@ -540,11 +541,13 @@ static int ecc_stat_create(struct device *dev, num_hw_units = g->gr.tpc_count; /* Allocate arrays */ - dev_attr_array = kzalloc(sizeof(struct device_attribute) * num_hw_units, GFP_KERNEL); - ecc_stat->counters = kzalloc(sizeof(u32) * num_hw_units, GFP_KERNEL); - ecc_stat->names = kzalloc(sizeof(char *) * num_hw_units, GFP_KERNEL); + dev_attr_array = nvgpu_kzalloc(g, sizeof(struct device_attribute) * + num_hw_units); + ecc_stat->counters = nvgpu_kzalloc(g, sizeof(u32) * num_hw_units); + ecc_stat->names = nvgpu_kzalloc(g, sizeof(char *) * num_hw_units); for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) { - ecc_stat->names[hw_unit] = kzalloc(sizeof(char) * ECC_STAT_NAME_MAX_SIZE, GFP_KERNEL); + ecc_stat->names[hw_unit] = nvgpu_kzalloc(g, sizeof(char) * + ECC_STAT_NAME_MAX_SIZE); } for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) { @@ -604,12 +607,12 @@ static void ecc_stat_remove(struct device *dev, hash_del(&ecc_stat->hash_node); /* Free arrays */ - kfree(ecc_stat->counters); + nvgpu_kfree(g, ecc_stat->counters); for (hw_unit = 0; hw_unit < num_hw_units; hw_unit++) { - kfree(ecc_stat->names[hw_unit]); + nvgpu_kfree(g, ecc_stat->names[hw_unit]); } - kfree(ecc_stat->names); - kfree(dev_attr_array); + nvgpu_kfree(g, ecc_stat->names); + nvgpu_kfree(g, dev_attr_array); } void gr_gp10b_create_sysfs(struct device *dev) -- cgit v1.2.2