diff options
author | peter <peter@FreeBSD.org> | 1997-09-14 03:19:42 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-09-14 03:19:42 +0000 |
commit | 796eb5ce0afbb92f7c829367cc09ec04472e0166 (patch) | |
tree | 0720cfdb6d407dea01c6b7bc049ac3afa3cc5020 /sys/dev/mse | |
parent | e762286917ce1de5d1fc3744a413be43a74c656b (diff) | |
download | FreeBSD-src-796eb5ce0afbb92f7c829367cc09ec04472e0166.zip FreeBSD-src-796eb5ce0afbb92f7c829367cc09ec04472e0166.tar.gz |
Update select -> poll in drivers.
Diffstat (limited to 'sys/dev/mse')
-rw-r--r-- | sys/dev/mse/mse.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 091ff8c..8be260c 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -11,7 +11,7 @@ * this software for any purpose. It is provided "as is" * without express or implied warranty. * - * $Id: mse.c,v 1.32 1997/03/24 11:23:56 bde Exp $ + * $Id: mse.c,v 1.33 1997/07/20 14:10:06 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -51,6 +51,7 @@ #include <sys/conf.h> #include <sys/proc.h> #include <sys/kernel.h> +#include <sys/poll.h> #include <sys/uio.h> #ifdef DEVFS #include <sys/devfsext.h> @@ -70,13 +71,13 @@ struct isa_driver msedriver = { static d_open_t mseopen; static d_close_t mseclose; static d_read_t mseread; -static d_select_t mseselect; +static d_poll_t msepoll; #define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { mseopen, mseclose, mseread, nowrite, /*27*/ noioc, nostop, nullreset, nodevtotty,/* mse */ - mseselect, nommap, NULL, "mse", NULL, -1 }; + msepoll, nommap, NULL, "mse", NULL, -1 }; /* @@ -365,31 +366,34 @@ mseread(dev, uio, ioflag) } /* - * mseselect: check for mouse input to be processed. + * msepoll: check for mouse input to be processed. */ static int -mseselect(dev, rw, p) +msepoll(dev, events, p) dev_t dev; - int rw; + int events; struct proc *p; { register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)]; int s; + int revents = 0; s = spltty(); - if (sc->sc_bytesread != PROTOBYTES || sc->sc_deltax != 0 || - sc->sc_deltay != 0 || (sc->sc_obuttons ^ sc->sc_buttons) != 0) { - splx(s); - return (1); - } + if (events & (POLLIN | POLLRDNORM)) + if (sc->sc_bytesread != PROTOBYTES || sc->sc_deltax != 0 || + sc->sc_deltay != 0 || + (sc->sc_obuttons ^ sc->sc_buttons) != 0) + revents |= events & (POLLIN | POLLRDNORM); + else { + /* + * Since this is an exclusive open device, any previous + * proc pointer is trash now, so we can just assign it. + */ + selrecord(p, &sc->sc_selp); + } - /* - * Since this is an exclusive open device, any previous proc. - * pointer is trash now, so we can just assign it. - */ - selrecord(p, &sc->sc_selp); splx(s); - return (0); + return (revents); } /* |