Source-Changes-HG archive

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

[src/trunk]: src/sys Move device_printf() from ath_netbsd.c to subr_prf.c for...



details:   https://anonhg.NetBSD.org/src/rev/4ef44d06dbc3
branches:  trunk
changeset: 761234:4ef44d06dbc3
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Fri Jan 21 17:46:19 2011 +0000

description:
Move device_printf() from ath_netbsd.c to subr_prf.c for reuse in a new
driver.

diffstat:

 sys/dev/ic/ath_netbsd.c |  16 ++--------------
 sys/dev/ic/ath_netbsd.h |   4 +---
 sys/kern/subr_prf.c     |  16 ++++++++++++++--
 sys/sys/systm.h         |  25 +++++++++++++------------
 4 files changed, 30 insertions(+), 31 deletions(-)

diffs (161 lines):

diff -r a02bd1a39063 -r 4ef44d06dbc3 sys/dev/ic/ath_netbsd.c
--- a/sys/dev/ic/ath_netbsd.c   Fri Jan 21 16:56:38 2011 +0000
+++ b/sys/dev/ic/ath_netbsd.c   Fri Jan 21 17:46:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ath_netbsd.c,v 1.17 2009/10/19 23:19:39 rmind Exp $ */
+/*     $NetBSD: ath_netbsd.c,v 1.18 2011/01/21 17:46:19 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004 David Young
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c,v 1.17 2009/10/19 23:19:39 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c,v 1.18 2011/01/21 17:46:19 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -57,18 +57,6 @@
 #include <dev/ic/ath_netbsd.h>
 #include <dev/ic/athvar.h>
 
-void
-device_printf(device_t dev, const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       printf("%s: ", device_xname(dev));
-       vprintf(fmt, ap);
-       va_end(ap);
-       return;
-}
-
 /*
  * Setup sysctl(3) MIB, hw.ath.*.
  *
diff -r a02bd1a39063 -r 4ef44d06dbc3 sys/dev/ic/ath_netbsd.h
--- a/sys/dev/ic/ath_netbsd.h   Fri Jan 21 16:56:38 2011 +0000
+++ b/sys/dev/ic/ath_netbsd.h   Fri Jan 21 17:46:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ath_netbsd.h,v 1.10 2010/03/19 01:31:11 dyoung Exp $ */
+/*     $NetBSD: ath_netbsd.h,v 1.11 2011/01/21 17:46:19 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004 David Young
@@ -119,8 +119,6 @@
            SYSCTL_DESCR(__descr), NULL, 0, &ath_##__var, 0, CTL_CREATE,\
            CTL_EOL)
 
-extern void device_printf(device_t, const char *fmt, ...)
-    __attribute__((__format__(__printf__,2,3)));
 const struct sysctlnode *ath_sysctl_treetop(struct sysctllog **);
 const struct sysctlnode *ath_sysctl_instance(const char *, struct sysctllog **);
 
diff -r a02bd1a39063 -r 4ef44d06dbc3 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Fri Jan 21 16:56:38 2011 +0000
+++ b/sys/kern/subr_prf.c       Fri Jan 21 17:46:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.138 2010/01/26 12:59:50 he Exp $        */
+/*     $NetBSD: subr_prf.c,v 1.139 2011/01/21 17:46:19 dyoung Exp $    */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.138 2010/01/26 12:59:50 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.139 2011/01/21 17:46:19 dyoung Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipkdb.h"
@@ -1138,6 +1138,18 @@
        }                                                               \
 }
 
+void
+device_printf(device_t dev, const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       printf("%s: ", device_xname(dev));
+       vprintf(fmt, ap);
+       va_end(ap);
+       return;
+}
+
 /*
  * Guts of kernel printf.  Note, we already expect to be in a mutex!
  */
diff -r a02bd1a39063 -r 4ef44d06dbc3 sys/sys/systm.h
--- a/sys/sys/systm.h   Fri Jan 21 16:56:38 2011 +0000
+++ b/sys/sys/systm.h   Fri Jan 21 17:46:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systm.h,v 1.245 2010/12/30 16:49:25 pooka Exp $        */
+/*     $NetBSD: systm.h,v 1.246 2011/01/21 17:46:19 dyoung Exp $       */
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -48,10 +48,10 @@
 
 #ifdef _KERNEL
 #include <sys/types.h>
+#include <sys/device_if.h>
 #endif
 
 struct clockframe;
-struct device;
 struct lwp;
 struct proc;
 struct timeval;
@@ -89,7 +89,7 @@
 
 extern dev_t rootdev;          /* root device */
 extern struct vnode *rootvp;   /* vnode equivalent to above */
-extern struct device *root_device; /* device equivalent to above */
+extern device_t root_device; /* device equivalent to above */
 extern const char *rootspec;   /* how root device was specified */
 
 extern int ncpu;               /* number of CPUs configured */
@@ -187,17 +187,18 @@
 void   aprint_debug(const char *, ...)
     __attribute__((__format__(__printf__,1,2)));
 
-struct device;
+void device_printf(device_t, const char *fmt, ...)
+    __attribute__((__format__(__printf__,2,3)));
 
-void   aprint_normal_dev(struct device *, const char *, ...)
-    __attribute__((__format__(__printf__,2,3)));
-void   aprint_error_dev(struct device *, const char *, ...)
+void   aprint_normal_dev(device_t, const char *, ...)
     __attribute__((__format__(__printf__,2,3)));
-void   aprint_naive_dev(struct device *, const char *, ...)
+void   aprint_error_dev(device_t, const char *, ...)
+    __attribute__((__format__(__printf__,2,3)));
+void   aprint_naive_dev(device_t, const char *, ...)
     __attribute__((__format__(__printf__,2,3)));
-void   aprint_verbose_dev(struct device *, const char *, ...)
+void   aprint_verbose_dev(device_t, const char *, ...)
     __attribute__((__format__(__printf__,2,3)));
-void   aprint_debug_dev(struct device *, const char *, ...)
+void   aprint_debug_dev(device_t, const char *, ...)
     __attribute__((__format__(__printf__,2,3)));
 
 struct ifnet;
@@ -367,10 +368,10 @@
 #define        ROOT_FSTYPE_ANY "?"
 
 extern const char *rootfstype;
-void   *mountroothook_establish(void (*)(struct device *), struct device *);
+void   *mountroothook_establish(void (*)(device_t), device_t);
 void   mountroothook_disestablish(void *);
 void   mountroothook_destroy(void);
-void   domountroothook(struct device *);
+void   domountroothook(device_t);
 
 /*
  * Exec hooks. Subsystems may want to do cleanup when a process



Home | Main Index | Thread Index | Old Index