Source-Changes-HG archive

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

[src/gehenna-devsw]: src/sys/dev/sbus Add the character device switch.



details:   https://anonhg.NetBSD.org/src/rev/6c6c4a4bc39b
branches:  gehenna-devsw
changeset: 527073:6c6c4a4bc39b
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 11:43:47 2002 +0000

description:
Add the character device switch.

diffstat:

 sys/dev/sbus/bpp.c   |  27 +++++++++---------
 sys/dev/sbus/magma.c |  74 +++++++++++++++++++--------------------------------
 sys/dev/sbus/p9100.c |  32 ++++++++--------------
 sys/dev/sbus/tcx.c   |  31 +++++++++------------
 4 files changed, 67 insertions(+), 97 deletions(-)

diffs (truncated from 345 to 300 lines):

diff -r 69a12eba81ac -r 6c6c4a4bc39b sys/dev/sbus/bpp.c
--- a/sys/dev/sbus/bpp.c        Thu May 16 11:41:21 2002 +0000
+++ b/sys/dev/sbus/bpp.c        Thu May 16 11:43:47 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpp.c,v 1.12 2002/03/20 20:39:15 eeh Exp $ */
+/*     $NetBSD: bpp.c,v 1.12.4.1 2002/05/16 11:43:47 gehenna Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.12 2002/03/20 20:39:15 eeh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.12.4.1 2002/05/16 11:43:47 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -57,7 +57,6 @@
 #include <machine/bus.h>
 #include <machine/intr.h>
 #include <machine/autoconf.h>
-#include <machine/conf.h>
 
 #include <dev/ic/lsi64854reg.h>
 #include <dev/ic/lsi64854var.h>
@@ -125,6 +124,18 @@
 };
 
 extern struct cfdriver bpp_cd;
+
+dev_type_open(bppopen);
+dev_type_close(bppclose);
+dev_type_write(bppwrite);
+dev_type_ioctl(bppioctl);
+dev_type_poll(bpppoll);
+
+const struct cdevsw bpp_cdevsw = {
+       bppopen, bppclose, noread, bppwrite, bppioctl,
+       nostop, notty, bpppoll, nommap,
+};
+
 #define BPPUNIT(dev)   (minor(dev))
 
 
@@ -299,16 +310,6 @@
 }
 
 int
-bppread(dev, uio, flags)
-       dev_t dev;
-       struct uio *uio;
-       int flags;
-{
-
-       return (ENXIO);
-}
-
-int
 bppwrite(dev, uio, flags)
        dev_t dev;
        struct uio *uio;
diff -r 69a12eba81ac -r 6c6c4a4bc39b sys/dev/sbus/magma.c
--- a/sys/dev/sbus/magma.c      Thu May 16 11:41:21 2002 +0000
+++ b/sys/dev/sbus/magma.c      Thu May 16 11:43:47 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: magma.c,v 1.16 2002/03/21 00:18:36 eeh Exp $   */
+/*     $NetBSD: magma.c,v 1.16.4.1 2002/05/16 11:43:47 gehenna Exp $   */
 /*
  * magma.c
  *
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.16 2002/03/21 00:18:36 eeh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.16.4.1 2002/05/16 11:43:47 gehenna Exp $");
 
 #if 0
 #define MAGMA_DEBUG
@@ -64,7 +64,6 @@
 #include <machine/bus.h>
 #include <machine/intr.h>
 #include <machine/autoconf.h>
-#include <machine/conf.h>
 
 #include <dev/sbus/sbusvar.h>
 
@@ -202,6 +201,30 @@
 extern struct cfdriver mtty_cd;
 extern struct cfdriver mbpp_cd;
 
+dev_type_open(mttyopen);
+dev_type_close(mttyclose);
+dev_type_read(mttyread);
+dev_type_write(mttywrite);
+dev_type_ioctl(mttyioctl);
+dev_type_stop(mttystop);
+dev_type_tty(mttytty);
+dev_type_poll(mttypoll);
+
+const struct cdevsw mtty_cdevsw = {
+       mttyopen, mttyclose, mttyread, mttywrite, mttyioctl,
+       mttystop, mttytty, mttypoll, nommap, D_TTY
+};
+
+dev_type_open(mbppopen);
+dev_type_close(mbppclose);
+dev_type_read(mbpp_rw);
+dev_type_ioctl(mbppioctl);
+
+const struct cdevsw mbpp_cdevsw = {
+       mbppopen, mbppclose, mbpp_rw, mbpp_rw, mbppioctl,
+       nostop, notty, nopoll, nommap,
+};
+
 /************************************************************************
  *
  *  CD1400 Routines
@@ -1451,10 +1474,7 @@
  *     mbpp_attach     attach mbpp devices
  *     mbppopen        open mbpp device
  *     mbppclose       close mbpp device
- *     mbppread        read from mbpp
- *     mbppwrite       write to mbpp
  *     mbppioctl       do ioctl on mbpp
- *     mbppselect      do select on mbpp
  *     mbpp_rw         general rw routine
  *     mbpp_timeout    rw timeout
  *     mbpp_start      rw start after delay
@@ -1574,32 +1594,6 @@
 }
 
 /*
- * Read routine
- */
-int
-mbppread(dev, uio, flags)
-       dev_t dev;
-       struct uio *uio;
-       int flags;
-{
-
-       return( mbpp_rw(dev, uio) );
-}
-
-/*
- * Write routine
- */
-int
-mbppwrite(dev, uio, flags)
-       dev_t dev;
-       struct uio *uio;
-       int flags;
-{
-
-       return( mbpp_rw(dev, uio) );
-}
-
-/*
  * ioctl routine
  */
 int
@@ -1648,23 +1642,11 @@
        return(error);
 }
 
-/*
- * poll routine
- */
 int
-mbpppoll(dev, rw, p)
-       dev_t dev;
-       int rw;
-       struct proc *p;
-{
-
-       return(ENODEV);
-}
-
-int
-mbpp_rw(dev, uio)
+mbpp_rw(dev, uio, flag)
        dev_t dev;
        struct uio *uio;
+       int flag;
 {
        int card = MAGMA_CARD(dev);
        int port = MAGMA_PORT(dev);
diff -r 69a12eba81ac -r 6c6c4a4bc39b sys/dev/sbus/p9100.c
--- a/sys/dev/sbus/p9100.c      Thu May 16 11:41:21 2002 +0000
+++ b/sys/dev/sbus/p9100.c      Thu May 16 11:43:47 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p9100.c,v 1.8 2002/03/11 16:00:57 pk Exp $ */
+/*     $NetBSD: p9100.c,v 1.8.4.1 2002/05/16 11:43:47 gehenna Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.8 2002/03/11 16:00:57 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.8.4.1 2002/05/16 11:43:47 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -76,8 +76,6 @@
 #include <sparc/dev/tctrlvar.h>/*XXX*/
 #endif
 
-#include <machine/conf.h>
-
 /* per-display variables */
 struct p9100_softc {
        struct device   sc_dev;         /* base device */
@@ -124,18 +122,24 @@
 static void    p9100unblank(struct device *);
 static void    p9100_shutdown(void *);
 
-/* cdevsw prototypes */
-cdev_decl(p9100);
-
 struct cfattach pnozz_ca = {
        sizeof(struct p9100_softc), p9100_sbus_match, p9100_sbus_attach
 };
 
 extern struct cfdriver pnozz_cd;
 
+dev_type_open(p9100open);
+dev_type_ioctl(p9100ioctl);
+dev_type_mmap(p9100mmap);
+
+const struct cdevsw pnozz_cdevsw = {
+       p9100open, nullclose, noread, nowrite, p9100ioctl,
+       nostop, notty, nopoll, p9100mmap,
+};
+
 /* frame buffer generic driver */
 static struct fbdriver p9100fbdriver = {
-       p9100unblank, p9100open, p9100close, p9100ioctl, p9100poll,
+       p9100unblank, p9100open, nullclose, p9100ioctl, nopoll,
        p9100mmap
 };
 
@@ -339,12 +343,6 @@
 }
 
 int
-p9100close(dev_t dev, int flags, int mode, struct proc *p)
-{
-       return (0);
-}
-
-int
 p9100ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
 {
        struct p9100_softc *sc = pnozz_cd.cd_devs[minor(dev)];
@@ -398,12 +396,6 @@
        return (0);
 }
 
-int
-p9100poll(dev_t dev, int events, struct proc *p)
-{
-       return seltrue(dev, events, p);
-}
-
 static uint32_t
 p9100_ctl_read_4(struct p9100_softc *sc, bus_size_t off)
 {
diff -r 69a12eba81ac -r 6c6c4a4bc39b sys/dev/sbus/tcx.c
--- a/sys/dev/sbus/tcx.c        Thu May 16 11:41:21 2002 +0000
+++ b/sys/dev/sbus/tcx.c        Thu May 16 11:43:47 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcx.c,v 1.7 2002/03/27 10:14:17 darrenr Exp $ */
+/*     $NetBSD: tcx.c,v 1.7.2.1 2002/05/16 11:43:47 gehenna Exp $ */
 
 /*
  *  Copyright (c) 1996,1998 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.7 2002/03/27 10:14:17 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.7.2.1 2002/05/16 11:43:47 gehenna Exp $");
 
 /*
  * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5;
@@ -79,8 +79,6 @@
 #include <dev/sbus/sbusvar.h>
 #include <dev/sbus/tcxreg.h>
 
-#include <machine/conf.h>
-
 /* per-display variables */
 struct tcx_softc {
        struct device   sc_dev;         /* base device */
@@ -119,18 +117,25 @@
 static int     tcxmatch __P((struct device *, struct cfdata *, void *));



Home | Main Index | Thread Index | Old Index