Module Name:    src
Committed By:   dyoung
Date:           Fri Jan 14 18:34:44 UTC 2011

Modified Files:
        src/share/man/man9: evcnt.9

Log Message:
In the EXAMPLES section, use device_t and accessors instead of struct
device.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/share/man/man9/evcnt.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/evcnt.9
diff -u src/share/man/man9/evcnt.9:1.20 src/share/man/man9/evcnt.9:1.21
--- src/share/man/man9/evcnt.9:1.20	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/evcnt.9	Fri Jan 14 18:34:44 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: evcnt.9,v 1.20 2010/12/02 12:54:13 wiz Exp $
+.\" $NetBSD: evcnt.9,v 1.21 2011/01/14 18:34:44 dyoung Exp $
 .\"
 .\" Copyright (c) 2000 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
 .\"
-.Dd August 7, 2010
+.Dd January 14, 2011
 .Dt EVCNT 9
 .Os
 .Sh NAME
@@ -226,7 +226,6 @@
 interrupts) a device driver might use:
 .Bd -literal
 struct foo_softc {
-	struct device sc_dev;		/* generic device information */
 	[ . . . ]
 	struct evcnt sc_ev_intr;	/* interrupt count */
 	struct evcnt sc_ev_intr_rd;	/* 'readable' interrupt count */
@@ -241,21 +240,19 @@
 function, using code like:
 .Bd -literal
 void
-fooattach(parent, self, aux)
-	struct device *parent, *self;
-	void *aux;
+fooattach(device_t parent, device_t self, void *aux)
 {
-	struct foo_softc *sc = (struct foo_softc *)self;
+	struct foo_softc *sc = device_private(self);
 
 	[ . . . ]
 
 	/* Initialize and attach event counters. */
 	evcnt_attach_dynamic(\*[Am]sc-\*[Gt]sc_ev, EVCNT_TYPE_INTR,
-	    NULL, sc-\*[Gt]sc_dev.dv_xname, "intr");
+	    NULL, device_xname(self), "intr");
 	evcnt_attach_dynamic(\*[Am]sc-\*[Gt]sc_ev_rd, EVCNT_TYPE_INTR,
-	    \*[Am]sc-\*[Gt]sc_ev, sc-\*[Gt]sc_dev.dv_xname, "intr rd");
+	    \*[Am]sc-\*[Gt]sc_ev, device_xname(self), "intr rd");
 	evcnt_attach_dynamic(\*[Am]sc-\*[Gt]sc_ev_wr, EVCNT_TYPE_INTR,
-	    \*[Am]sc-\*[Gt]sc_ev, sc-\*[Gt]sc_dev.dv_xname, "intr wr");
+	    \*[Am]sc-\*[Gt]sc_ev, device_xname(self), "intr wr");
 
 	[ . . . ]
 }

Reply via email to