Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Trade 200-something bytes for the death of an ifdef.



details:   https://anonhg.NetBSD.org/src/rev/748b0cd6468d
branches:  trunk
changeset: 751271:748b0cd6468d
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Jan 30 23:19:55 2010 +0000

description:
Trade 200-something bytes for the death of an ifdef.

diffstat:

 sys/conf/files       |   3 +--
 sys/kern/kern_subr.c |  26 +++++++++++---------------
 2 files changed, 12 insertions(+), 17 deletions(-)

diffs (91 lines):

diff -r 7c424d9e4bec -r 748b0cd6468d sys/conf/files
--- a/sys/conf/files    Sat Jan 30 21:55:28 2010 +0000
+++ b/sys/conf/files    Sat Jan 30 23:19:55 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.971 2010/01/24 14:25:57 pooka Exp $
+#      $NetBSD: files,v 1.972 2010/01/30 23:19:55 pooka Exp $
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
 version        20090313
@@ -73,7 +73,6 @@
 defflag        opt_malloc_debug.h      MALLOC_DEBUG
 defflag        opt_pool.h              POOL_DIAGNOSTIC
 defparam opt_poollog.h         POOL_LOGSIZE
-defflag        opt_powerhook.h         POWERHOOK_DEBUG
 
 defflag        opt_revcache.h          NAMECACHE_ENTER_REVERSE
 
diff -r 7c424d9e4bec -r 748b0cd6468d sys/kern/kern_subr.c
--- a/sys/kern/kern_subr.c      Sat Jan 30 21:55:28 2010 +0000
+++ b/sys/kern/kern_subr.c      Sat Jan 30 23:19:55 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_subr.c,v 1.203 2009/11/05 18:07:19 dyoung Exp $   */
+/*     $NetBSD: kern_subr.c,v 1.204 2010/01/30 23:19:55 pooka Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,14 +79,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.203 2009/11/05 18:07:19 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.204 2010/01/30 23:19:55 pooka Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
 #include "opt_syscall_debug.h"
 #include "opt_ktrace.h"
 #include "opt_ptrace.h"
-#include "opt_powerhook.h"
 #include "opt_tftproot.h"
 
 #include <sys/param.h>
@@ -136,6 +135,7 @@
 #endif
 
 dev_t  dumpcdev;       /* for savecore */
+int    powerhook_debug = 0;
 
 static void *
 hook_establish(hook_list_t *list, void (*fn)(void *), void *arg)
@@ -426,32 +426,28 @@
 dopowerhooks(int why)
 {
        struct powerhook_desc *dp;
-
-#ifdef POWERHOOK_DEBUG
        const char *why_name;
        static const char * pwr_names[] = {PWR_NAMES};
        why_name = why < __arraycount(pwr_names) ? pwr_names[why] : "???";
-#endif
 
        if (why == PWR_RESUME || why == PWR_SOFTRESUME) {
                CIRCLEQ_FOREACH_REVERSE(dp, &powerhook_list, sfd_list) {
-#ifdef POWERHOOK_DEBUG
-                       printf("dopowerhooks %s: %s (%p)\n", why_name, dp->sfd_name, dp);
-#endif
+                       if (powerhook_debug)
+                               printf("dopowerhooks %s: %s (%p)\n",
+                                   why_name, dp->sfd_name, dp);
                        (*dp->sfd_fn)(why, dp->sfd_arg);
                }
        } else {
                CIRCLEQ_FOREACH(dp, &powerhook_list, sfd_list) {
-#ifdef POWERHOOK_DEBUG
-                       printf("dopowerhooks %s: %s (%p)\n", why_name, dp->sfd_name, dp);
-#endif
+                       if (powerhook_debug)
+                               printf("dopowerhooks %s: %s (%p)\n",
+                                   why_name, dp->sfd_name, dp);
                        (*dp->sfd_fn)(why, dp->sfd_arg);
                }
        }
 
-#ifdef POWERHOOK_DEBUG
-       printf("dopowerhooks: %s done\n", why_name);
-#endif
+       if (powerhook_debug)
+               printf("dopowerhooks: %s done\n", why_name);
 }
 
 static int



Home | Main Index | Thread Index | Old Index