Skip to content

Commit

Permalink
mm/cma_debug.c: remove static scoped cma_debugfs_root
Browse files Browse the repository at this point in the history
Currently cma_debugfs_root is static storage.  That is unnecessary since
it will be only used by next cma_debugfs_add_one().  We can just pass it
to following calling to save thisspace.  Also remove useless idx
parameter.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yue Hu <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yue Hu authored and torvalds committed Mar 6, 2019
1 parent a332286 commit 5a7f1b2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mm/cma_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ struct cma_mem {
unsigned long n;
};

static struct dentry *cma_debugfs_root;

static int cma_debugfs_get(void *data, u64 *val)
{
unsigned long *p = data;
Expand Down Expand Up @@ -162,15 +160,15 @@ static int cma_alloc_write(void *data, u64 val)
}
DEFINE_SIMPLE_ATTRIBUTE(cma_alloc_fops, NULL, cma_alloc_write, "%llu\n");

static void cma_debugfs_add_one(struct cma *cma, int idx)
static void cma_debugfs_add_one(struct cma *cma, struct dentry *root_dentry)
{
struct dentry *tmp;
char name[16];
int u32s;

scnprintf(name, sizeof(name), "cma-%s", cma->name);

tmp = debugfs_create_dir(name, cma_debugfs_root);
tmp = debugfs_create_dir(name, root_dentry);

debugfs_create_file("alloc", 0200, tmp, cma, &cma_alloc_fops);
debugfs_create_file("free", 0200, tmp, cma, &cma_free_fops);
Expand All @@ -188,12 +186,13 @@ static void cma_debugfs_add_one(struct cma *cma, int idx)

static int __init cma_debugfs_init(void)
{
struct dentry *cma_debugfs_root;
int i;

cma_debugfs_root = debugfs_create_dir("cma", NULL);

for (i = 0; i < cma_area_count; i++)
cma_debugfs_add_one(&cma_areas[i], i);
cma_debugfs_add_one(&cma_areas[i], cma_debugfs_root);

return 0;
}
Expand Down

0 comments on commit 5a7f1b2

Please sign in to comment.