Commit e5445ee6 authored by Axel Lin's avatar Axel Lin Committed by Greg Kroah-Hartman

memory: emif: Add ifdef CONFIG_DEBUG_FS guard for emif_debugfs_[init|exit]

Add ifdef CONFIG_DEBUG_FS guard for emif_debugfs_[init|exit], and adds stub
functions for the case CONFIG_DEBUG_FS is not set.

When CONFIG_DEBUG_FS is enabled, debugfs_create_dir and debugfs_create_file
return NULL on failure, fix it.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by : Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1980a347
...@@ -75,6 +75,7 @@ static unsigned long irq_state; ...@@ -75,6 +75,7 @@ static unsigned long irq_state;
static u32 t_ck; /* DDR clock period in ps */ static u32 t_ck; /* DDR clock period in ps */
static LIST_HEAD(device_list); static LIST_HEAD(device_list);
#ifdef CONFIG_DEBUG_FS
static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif, static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif,
struct emif_regs *regs) struct emif_regs *regs)
{ {
...@@ -166,23 +167,23 @@ static int __init_or_module emif_debugfs_init(struct emif_data *emif) ...@@ -166,23 +167,23 @@ static int __init_or_module emif_debugfs_init(struct emif_data *emif)
int ret; int ret;
dentry = debugfs_create_dir(dev_name(emif->dev), NULL); dentry = debugfs_create_dir(dev_name(emif->dev), NULL);
if (IS_ERR(dentry)) { if (!dentry) {
ret = PTR_ERR(dentry); ret = -ENOMEM;
goto err0; goto err0;
} }
emif->debugfs_root = dentry; emif->debugfs_root = dentry;
dentry = debugfs_create_file("regcache_dump", S_IRUGO, dentry = debugfs_create_file("regcache_dump", S_IRUGO,
emif->debugfs_root, emif, &emif_regdump_fops); emif->debugfs_root, emif, &emif_regdump_fops);
if (IS_ERR(dentry)) { if (!dentry) {
ret = PTR_ERR(dentry); ret = -ENOMEM;
goto err1; goto err1;
} }
dentry = debugfs_create_file("mr4", S_IRUGO, dentry = debugfs_create_file("mr4", S_IRUGO,
emif->debugfs_root, emif, &emif_mr4_fops); emif->debugfs_root, emif, &emif_mr4_fops);
if (IS_ERR(dentry)) { if (!dentry) {
ret = PTR_ERR(dentry); ret = -ENOMEM;
goto err1; goto err1;
} }
...@@ -198,6 +199,16 @@ static void __exit emif_debugfs_exit(struct emif_data *emif) ...@@ -198,6 +199,16 @@ static void __exit emif_debugfs_exit(struct emif_data *emif)
debugfs_remove_recursive(emif->debugfs_root); debugfs_remove_recursive(emif->debugfs_root);
emif->debugfs_root = NULL; emif->debugfs_root = NULL;
} }
#else
static inline int __init_or_module emif_debugfs_init(struct emif_data *emif)
{
return 0;
}
static inline void __exit emif_debugfs_exit(struct emif_data *emif)
{
}
#endif
/* /*
* Calculate the period of DDR clock from frequency value * Calculate the period of DDR clock from frequency value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment