diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-09-24 23:54:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-26 16:56:03 -0400 |
commit | e5445ee6a62329f6eb28b8ebd8ff4c4659ca0209 (patch) | |
tree | d4c5166d5506c0051dc9b9e98ccde212a26d20a6 /drivers/memory/emif.c | |
parent | 1980a347a71693a41663a1780c2da869174a0025 (diff) |
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: Axel Lin <axel.lin@ingics.com>
Acked-by : Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/memory/emif.c')
-rw-r--r-- | drivers/memory/emif.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 1424ae38e53b..06d31c99e6ac 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c | |||
@@ -75,6 +75,7 @@ static unsigned long irq_state; | |||
75 | static u32 t_ck; /* DDR clock period in ps */ | 75 | static u32 t_ck; /* DDR clock period in ps */ |
76 | static LIST_HEAD(device_list); | 76 | static LIST_HEAD(device_list); |
77 | 77 | ||
78 | #ifdef CONFIG_DEBUG_FS | ||
78 | static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif, | 79 | static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif, |
79 | struct emif_regs *regs) | 80 | struct emif_regs *regs) |
80 | { | 81 | { |
@@ -166,23 +167,23 @@ static int __init_or_module emif_debugfs_init(struct emif_data *emif) | |||
166 | int ret; | 167 | int ret; |
167 | 168 | ||
168 | dentry = debugfs_create_dir(dev_name(emif->dev), NULL); | 169 | dentry = debugfs_create_dir(dev_name(emif->dev), NULL); |
169 | if (IS_ERR(dentry)) { | 170 | if (!dentry) { |
170 | ret = PTR_ERR(dentry); | 171 | ret = -ENOMEM; |
171 | goto err0; | 172 | goto err0; |
172 | } | 173 | } |
173 | emif->debugfs_root = dentry; | 174 | emif->debugfs_root = dentry; |
174 | 175 | ||
175 | dentry = debugfs_create_file("regcache_dump", S_IRUGO, | 176 | dentry = debugfs_create_file("regcache_dump", S_IRUGO, |
176 | emif->debugfs_root, emif, &emif_regdump_fops); | 177 | emif->debugfs_root, emif, &emif_regdump_fops); |
177 | if (IS_ERR(dentry)) { | 178 | if (!dentry) { |
178 | ret = PTR_ERR(dentry); | 179 | ret = -ENOMEM; |
179 | goto err1; | 180 | goto err1; |
180 | } | 181 | } |
181 | 182 | ||
182 | dentry = debugfs_create_file("mr4", S_IRUGO, | 183 | dentry = debugfs_create_file("mr4", S_IRUGO, |
183 | emif->debugfs_root, emif, &emif_mr4_fops); | 184 | emif->debugfs_root, emif, &emif_mr4_fops); |
184 | if (IS_ERR(dentry)) { | 185 | if (!dentry) { |
185 | ret = PTR_ERR(dentry); | 186 | ret = -ENOMEM; |
186 | goto err1; | 187 | goto err1; |
187 | } | 188 | } |
188 | 189 | ||
@@ -198,6 +199,16 @@ static void __exit emif_debugfs_exit(struct emif_data *emif) | |||
198 | debugfs_remove_recursive(emif->debugfs_root); | 199 | debugfs_remove_recursive(emif->debugfs_root); |
199 | emif->debugfs_root = NULL; | 200 | emif->debugfs_root = NULL; |
200 | } | 201 | } |
202 | #else | ||
203 | static inline int __init_or_module emif_debugfs_init(struct emif_data *emif) | ||
204 | { | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static inline void __exit emif_debugfs_exit(struct emif_data *emif) | ||
209 | { | ||
210 | } | ||
211 | #endif | ||
201 | 212 | ||
202 | /* | 213 | /* |
203 | * Calculate the period of DDR clock from frequency value | 214 | * Calculate the period of DDR clock from frequency value |