From e47d860c15222fd0ece0933935e20bf3c666d26f Mon Sep 17 00:00:00 2001
From: Andrew Morton <akpm@osdl.org>
Date: Thu, 11 Mar 2004 16:13:07 -0800
Subject: [PATCH] [PATCH] genrtc: cleanups

From: "Randy.Dunlap" <rddunlap@osdl.org>

From: Luiz Fernando Capitulino <lcapitulino@prefeitura.sp.gov.br>

remove ifdef/endif in rtc_generic_init().
use returned error code;
---
 drivers/char/genrtc.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 09d86f5e31e7..d110713e8e20 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -466,6 +466,17 @@ static int gen_rtc_read_proc(char *page, char **start, off_t off,
 	return len;
 }
 
+static int __init gen_rtc_proc_init(void)
+{
+	struct proc_dir_entry *r;
+
+	r = create_proc_read_entry("driver/rtc", 0, 0, gen_rtc_read_proc, NULL);
+	if (!r)
+		return -ENOMEM;
+	return 0;
+}
+#else
+static inline int gen_rtc_proc_init(void) { return 0; }
 #endif /* CONFIG_PROC_FS */
 
 
@@ -498,15 +509,14 @@ static int __init rtc_generic_init(void)
 	printk(KERN_INFO "Generic RTC Driver v%s\n", RTC_VERSION);
 
 	retval = misc_register(&rtc_gen_dev);
-	if(retval < 0)
+	if (retval < 0)
 		return retval;
 
-#ifdef CONFIG_PROC_FS
-	if((create_proc_read_entry ("driver/rtc", 0, 0, gen_rtc_read_proc, NULL)) == NULL){
+	retval = gen_rtc_proc_init();
+	if (retval) {
 		misc_deregister(&rtc_gen_dev);
-		return -ENOMEM;
+		return retval;
 	}
-#endif
 
 	return 0;
 }
-- 
2.30.9