Fri Feb 11 23:19:34 2022 UTC ()
driver(9): Delete outdated info about softc and struct device.


(riastradh)
diff -r1.32 -r1.33 src/share/man/man9/driver.9

cvs diff -r1.32 -r1.33 src/share/man/man9/driver.9 (expand / switch to unified diff)

--- src/share/man/man9/driver.9 2017/11/17 07:42:29 1.32
+++ src/share/man/man9/driver.9 2022/02/11 23:19:34 1.33
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: driver.9,v 1.32 2017/11/17 07:42:29 wiz Exp $ 1.\" $NetBSD: driver.9,v 1.33 2022/02/11 23:19:34 riastradh Exp $
2.\" 2.\"
3.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Gregory McGarry. 7.\" by Gregory McGarry.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -91,34 +91,26 @@ structure should adopt the standard @@ -91,34 +91,26 @@ structure should adopt the standard
91configuration and naming conventions. 91configuration and naming conventions.
92For example, the 92For example, the
93.Em softc 93.Em softc
94structure for driver 94structure for driver
95.Dq foo 95.Dq foo
96is defined with: 96is defined with:
97.Bd -literal 97.Bd -literal
98struct foo_softc { 98struct foo_softc {
99 device_t sc_dev; /* generic device info */ 99 device_t sc_dev; /* generic device info */
100 /* device-specific state */ 100 /* device-specific state */
101}; 101};
102.Ed 102.Ed
103.Pp 103.Pp
104The autoconfiguration framework mandates that the first member of the 
105.Em softc 
106structure must be the driver-independent 
107.Em device_t . 
108Probably its most useful aspect to the driver is that it contains the 
109device-instance name 
110.Em dv_xname . 
111.Pp 
112If a driver has character device interfaces accessed from userland, the driver 104If a driver has character device interfaces accessed from userland, the driver
113must define the 105must define the
114.Em cdevsw 106.Em cdevsw
115structure. 107structure.
116The structure is constant and is defined inside the driver. 108The structure is constant and is defined inside the driver.
117For example, the 109For example, the
118.Em cdevsw 110.Em cdevsw
119structure for driver 111structure for driver
120.Dq foo 112.Dq foo
121is defined with: 113is defined with:
122.Bd -literal 114.Bd -literal
123const struct cdevsw foo_cdevsw { 115const struct cdevsw foo_cdevsw {
124 int (*d_open)(dev_t, int, int, struct lwp *); 116 int (*d_open)(dev_t, int, int, struct lwp *);