public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Andrew Morton <akpm@osdl.org>, Pavel Machek <pavel@ucw.cz>
Cc: linux-mtd@lists.infradead.org,
	Thomas Gleixner <tglx@linutronix.de>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: [2.6 patch] drivers/mtd/mtdcore.c: less PROC_FS=n #ifdef's
Date: Sun, 26 Mar 2006 14:25:04 +0200	[thread overview]
Message-ID: <20060326122504.GI4053@stusta.de> (raw)

I'm surprised that kill-ifdefs-in-mtdcorec.patch in -mm that removes
#ifdef's for the PROC_FS=n case wasn't tested with PROC_FS=n...

<--  snip  -->

...
  CC      drivers/mtd/mtdcore.o
drivers/mtd/mtdcore.c: In function 'init_mtd':
drivers/mtd/mtdcore.c:352: error: 'proc_mtd' undeclared (first use in this function)
drivers/mtd/mtdcore.c:352: error: (Each undeclared identifier is reported only once
drivers/mtd/mtdcore.c:352: error: for each function it appears in.)
drivers/mtd/mtdcore.c:353: error: 'mtd_read_proc' undeclared (first use in this function)
drivers/mtd/mtdcore.c: In function 'cleanup_mtd':
drivers/mtd/mtdcore.c:359: error: 'proc_mtd' undeclared (first use in this function)
make[2]: *** [drivers/mtd/mtdcore.o] Error 1

<--  snip  -->


The patch below tries to do it in a correct way.

cu
Adrian


<--  snip  -->


This patch reduces the number of #ifdef's for CONFIG_PROC_FS=n.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/mtd/mtdcore.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

--- linux-2.6.16-mm1-full/drivers/mtd/mtdcore.c.old	2006-03-25 23:22:06.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/mtd/mtdcore.c	2006-03-25 23:23:03.000000000 +0100
@@ -19,9 +19,7 @@
 #include <linux/ioctl.h>
 #include <linux/init.h>
 #include <linux/mtd/compatmac.h>
-#ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
-#endif
 
 #include <linux/mtd/mtd.h>
 
@@ -296,10 +294,11 @@
 EXPORT_SYMBOL(default_mtd_writev);
 EXPORT_SYMBOL(default_mtd_readv);
 
+#ifdef CONFIG_PROC_FS
+
 /*====================================================================*/
 /* Support for /proc/mtd */
 
-#ifdef CONFIG_PROC_FS
 static struct proc_dir_entry *proc_mtd;
 
 static inline int mtd_proc_info (char *buf, int i)
@@ -344,31 +343,27 @@
         return ((count < begin+len-off) ? count : begin+len-off);
 }
 
-#endif /* CONFIG_PROC_FS */
-
 /*====================================================================*/
 /* Init code */
 
 static int __init init_mtd(void)
 {
-#ifdef CONFIG_PROC_FS
 	if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
 		proc_mtd->read_proc = mtd_read_proc;
-#endif
 	return 0;
 }
 
 static void __exit cleanup_mtd(void)
 {
-#ifdef CONFIG_PROC_FS
         if (proc_mtd)
 		remove_proc_entry( "mtd", NULL);
-#endif
 }
 
 module_init(init_mtd);
 module_exit(cleanup_mtd);
 
+#endif /* CONFIG_PROC_FS */
+
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");

             reply	other threads:[~2006-03-26 12:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-26 12:25 Adrian Bunk [this message]
2006-03-27  9:38 ` [2.6 patch] drivers/mtd/mtdcore.c: less PROC_FS=n #ifdef's Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060326122504.GI4053@stusta.de \
    --to=bunk@stusta.de \
    --cc=akpm@osdl.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=pavel@ucw.cz \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox