summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/ppi.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/ppi.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/ppi.c')
-rw-r--r--sys/dev/ppbus/ppi.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c
index 74b3e76..2015fce 100644
--- a/sys/dev/ppbus/ppi.c
+++ b/sys/dev/ppbus/ppi.c
@@ -26,10 +26,6 @@
* $FreeBSD$
*
*/
-#include "ppi.h"
-
-#if NPPI > 0
-
#include "opt_ppb_1284.h"
#include <sys/param.h>
@@ -83,26 +79,8 @@ struct ppi_data {
#define UNITODEVICE(unit) \
(devclass_get_device(ppi_devclass, (unit)))
-static int ppi_probe(device_t);
-static int ppi_attach(device_t);
-static void ppiintr(void *arg);
-
static devclass_t ppi_devclass;
-static device_method_t ppi_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, ppi_probe),
- DEVMETHOD(device_attach, ppi_attach),
-
- { 0, 0 }
-};
-
-static driver_t ppi_driver = {
- "ppi",
- ppi_methods,
- sizeof(struct ppi_data),
-};
-
static d_open_t ppiopen;
static d_close_t ppiclose;
static d_ioctl_t ppiioctl;
@@ -155,6 +133,13 @@ ppi_disable_intr(device_t ppidev)
#endif /* PERIPH_1284 */
+static void
+ppi_identify(driver_t *driver, device_t parent)
+{
+
+ BUS_ADD_CHILD(parent, 0, "ppi", 0);
+}
+
/*
* ppi_probe()
*/
@@ -162,14 +147,10 @@ static int
ppi_probe(device_t dev)
{
struct ppi_data *ppi;
- static int once;
/* probe is always ok */
device_set_desc(dev, "Parallel I/O");
- if (!once++)
- cdevsw_add(&ppi_cdevsw);
-
ppi = DEVTOSOFTC(dev);
bzero(ppi, sizeof(struct ppi_data));
@@ -574,6 +555,18 @@ ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
-DRIVER_MODULE(ppi, ppbus, ppi_driver, ppi_devclass, 0, 0);
+static device_method_t ppi_methods[] = {
+ /* device interface */
+ DEVMETHOD(device_identify, ppi_identify),
+ DEVMETHOD(device_probe, ppi_probe),
+ DEVMETHOD(device_attach, ppi_attach),
-#endif /* NPPI */
+ { 0, 0 }
+};
+
+static driver_t ppi_driver = {
+ "ppi",
+ ppi_methods,
+ sizeof(struct ppi_data),
+};
+DRIVER_MODULE(ppi, ppbus, ppi_driver, ppi_devclass, 0, 0);
OpenPOWER on IntegriCloud