summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/if_plip.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-01-23 14:41:04 +0000
committerpeter <peter@FreeBSD.org>2000-01-23 14:41:04 +0000
commit6ac7d76dbc27d76a75c9e1e17b1a864b92bbc1d2 (patch)
treef9eb56779017fee672a5ce875e027c1b5d840cef /sys/dev/ppbus/if_plip.c
parent805920b490e525fff0027806088b75378b97b685 (diff)
downloadFreeBSD-src-6ac7d76dbc27d76a75c9e1e17b1a864b92bbc1d2.zip
FreeBSD-src-6ac7d76dbc27d76a75c9e1e17b1a864b92bbc1d2.tar.gz
Some newbus-inspired tidy-ups. Use device_identify() rather than scanning
the resource table to locate children. The 'at ppbus?' can go again. Remove a few #if Nxxx > 0' type things, config arranges this for us. Move the newbus method glue next to the DRIVER_MODULE() stuff so we don't need extra prototypes. Don't set device descriptions until after the possibility of the probe returning an error. Remove all cdevsw_add() calls, all the drivers that did this also use make_dev() correctly, so it's not required. A couple of other minor nits.
Diffstat (limited to 'sys/dev/ppbus/if_plip.c')
-rw-r--r--sys/dev/ppbus/if_plip.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c
index 033889e..6a4117a 100644
--- a/sys/dev/ppbus/if_plip.c
+++ b/sys/dev/ppbus/if_plip.c
@@ -77,9 +77,6 @@
/*
* Update for ppbus, PLIP support only - Nicolas Souchu
*/
-#include "plip.h"
-
-#if NPLIP > 0
#include "opt_plip.h"
@@ -170,9 +167,6 @@ static u_char *ctxmith;
#define ctrecvl (ctxmith+(3*LPIPTBLSIZE))
/* Functions for the lp# interface */
-static int lp_probe(device_t dev);
-static int lp_attach(device_t dev);
-
static int lpinittables(void);
static int lpioctl(struct ifnet *, u_long, caddr_t);
static int lpoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
@@ -188,20 +182,12 @@ static void lp_intr(void *);
static devclass_t lp_devclass;
-static device_method_t lp_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, lp_probe),
- DEVMETHOD(device_attach, lp_attach),
-
- { 0, 0 }
-};
-
-static driver_t lp_driver = {
- "plip",
- lp_methods,
- sizeof(struct lp_data),
-};
+static void
+lp_identify(driver_t *driver, device_t parent)
+{
+ BUS_ADD_CHILD(parent, 0, "plip", 0);
+}
/*
* lpprobe()
*/
@@ -785,6 +771,19 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
return 0;
}
-DRIVER_MODULE(plip, ppbus, lp_driver, lp_devclass, 0, 0);
+static device_method_t lp_methods[] = {
+ /* device interface */
+ DEVMETHOD(device_identify, lp_identify),
+ DEVMETHOD(device_probe, lp_probe),
+ DEVMETHOD(device_attach, lp_attach),
+
+ { 0, 0 }
+};
+
+static driver_t lp_driver = {
+ "plip",
+ lp_methods,
+ sizeof(struct lp_data),
+};
-#endif /* NPLIP > 0 */
+DRIVER_MODULE(plip, ppbus, lp_driver, lp_devclass, 0, 0);
OpenPOWER on IntegriCloud