Skip to contentSkip to conversation

misc: ifdef KMOD, saving some bytes probably

PATCH In review Jiri Olsa 2 participants 2 messages Feb 8, 2008 Char and misc drivers

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 misc: ifdef KMOD, saving some bytes probably

found some code in misc.c that could be ifdef'ed for KMOD

---
 drivers/char/misc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/char/misc.c +6 -1
index a39101f..3455b09 100644
@@ -126,7 +126,8 @@ static int misc_open(struct inode * inode, struct file * file)
 			break;
 		}
 	}
-		
+
+#if defined(CONFIG_KMOD)
 	if (!new_fops) {
 		mutex_unlock(&misc_mtx);
 		request_module("char-major-%d-%d", MISC_MAJOR, minor);
@@ -141,6 +142,10 @@ static int misc_open(struct inode * inode, struct file * file)
 		if (!new_fops)
 			goto fail;
 	}
+#else
+	if (!new_fops)
+		goto fail;
+#endif
 
 	err = 0;
 	old_fops = file->f_op;
#1 lore raw
Quoted 2 lines · Jiri Olsa

found some code in misc.c that could be ifdef'ed for KMOD

We need very good arguments in order to introduce #ifdef/#endif in code.
So this patch needs to come with hard fatcs about .text savings and where it matters.

Sam