fbdev: mbx: fix up debugfs file creation
There is no need to keep the dentries around for the individual debugfs files, just delete the whole directory all at once at shutdown instead. This also fixes a tiny memory leak where the memory for the pointers to the file dentries was never freed when the device shut down, as well as making the logic of the code a lot simpler. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
This commit is contained in:
parent
60d2fa0dad
commit
72aed9e313
@ -211,36 +211,22 @@ static const struct file_operations misc_fops = {
|
||||
static void mbxfb_debugfs_init(struct fb_info *fbi)
|
||||
{
|
||||
struct mbxfb_info *mfbi = fbi->par;
|
||||
struct mbxfb_debugfs_data *dbg;
|
||||
struct dentry *dir;
|
||||
|
||||
dbg = kzalloc(sizeof(struct mbxfb_debugfs_data), GFP_KERNEL);
|
||||
mfbi->debugfs_data = dbg;
|
||||
dir = debugfs_create_dir("mbxfb", NULL);
|
||||
mbfi->debugfs_dir = dir;
|
||||
|
||||
dbg->dir = debugfs_create_dir("mbxfb", NULL);
|
||||
dbg->sysconf = debugfs_create_file("sysconf", 0444, dbg->dir,
|
||||
fbi, &sysconf_fops);
|
||||
dbg->clock = debugfs_create_file("clock", 0444, dbg->dir,
|
||||
fbi, &clock_fops);
|
||||
dbg->display = debugfs_create_file("display", 0444, dbg->dir,
|
||||
fbi, &display_fops);
|
||||
dbg->gsctl = debugfs_create_file("gsctl", 0444, dbg->dir,
|
||||
fbi, &gsctl_fops);
|
||||
dbg->sdram = debugfs_create_file("sdram", 0444, dbg->dir,
|
||||
fbi, &sdram_fops);
|
||||
dbg->misc = debugfs_create_file("misc", 0444, dbg->dir,
|
||||
fbi, &misc_fops);
|
||||
debugfs_create_file("sysconf", 0444, dir, fbi, &sysconf_fops);
|
||||
debugfs_create_file("clock", 0444, dir, fbi, &clock_fops);
|
||||
debugfs_create_file("display", 0444, dir, fbi, &display_fops);
|
||||
debugfs_create_file("gsctl", 0444, dir, fbi, &gsctl_fops);
|
||||
debugfs_create_file("sdram", 0444, dir, fbi, &sdram_fops);
|
||||
debugfs_create_file("misc", 0444, dir, fbi, &misc_fops);
|
||||
}
|
||||
|
||||
static void mbxfb_debugfs_remove(struct fb_info *fbi)
|
||||
{
|
||||
struct mbxfb_info *mfbi = fbi->par;
|
||||
struct mbxfb_debugfs_data *dbg = mfbi->debugfs_data;
|
||||
|
||||
debugfs_remove(dbg->misc);
|
||||
debugfs_remove(dbg->sdram);
|
||||
debugfs_remove(dbg->gsctl);
|
||||
debugfs_remove(dbg->display);
|
||||
debugfs_remove(dbg->clock);
|
||||
debugfs_remove(dbg->sysconf);
|
||||
debugfs_remove(dbg->dir);
|
||||
debugfs_remove_recursive(mfbi->debugfs_dir);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ struct mbxfb_info {
|
||||
|
||||
u32 pseudo_palette[MAX_PALETTES];
|
||||
#ifdef CONFIG_FB_MBX_DEBUG
|
||||
void *debugfs_data;
|
||||
struct dentry *debugfs_dir;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user