Skip to contentSkip to conversation

regmap: debugfs: Fix misuse of IS_ENABLED

PATCH RESEND New Axel Lin 1 participant 1 message Aug 6, 2015

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH RESEND 1/1 regmap: debugfs: Fix misuse of IS_ENABLED

IS_ENABLED should only be used for CONFIG_* symbols.

I have done a small test:
#define REGMAP_ALLOW_WRITE_DEBUGFS IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

  #define REGMAP_ALLOW_WRITE_DEBUGFS 0
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

  #define REGMAP_ALLOW_WRITE_DEBUGFS 1
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 1.

  #define REGMAP_ALLOW_WRITE_DEBUGFS 2
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

So fix the misuse of IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) and switch to use #if defined(REGMAP_ALLOW_WRITE_DEBUGFS) instead.

---
Sorry, just found a typo in subject line immediately after sent the path. s/regamp/regmap/ So here is a resend.

 drivers/base/regmap/regmap-debugfs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-debugfs.c +5 -4
index 6a61e4f..f42f2ba 100644
@@ -599,10 +599,11 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
 	if (map->max_register || regmap_readable(map, 0)) {
 		umode_t registers_mode;
 
-		if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
-			registers_mode = 0600;
-		else
-			registers_mode = 0400;
+#if defined(REGMAP_ALLOW_WRITE_DEBUGFS)
+		registers_mode = 0600;
+#else
+		registers_mode = 0400;
+#endif
 
 		debugfs_create_file("registers", registers_mode, map->debugfs,
 				    map, &regmap_map_fops);
Signature · 1 line
2.1.0