From 1525749fb89da5e6992ed4d61159727e5f0e49b5 Mon Sep 17 00:00:00 2001 From: visa Date: Sat, 2 Jul 2022 08:50:41 +0000 Subject: [PATCH] Remove unused device poll functions. Also remove unneeded includes of and . Some addenda from jsg@. OK miod@ mpi@ --- sys/arch/macppc/dev/adb.c | 4 +- sys/arch/macppc/dev/akbd_machdep.c | 4 +- sys/arch/sh/dev/scif.c | 13 +----- sys/arch/sparc64/dev/vldcp.c | 46 +-------------------- sys/dev/audio.c | 63 +---------------------------- sys/dev/cons.c | 23 +---------- sys/dev/cons.h | 3 +- sys/dev/fdt/exuart.c | 3 +- sys/dev/fdt/imxuart.c | 3 +- sys/dev/gpio/gpiodcf.c | 4 +- sys/dev/hotplug.c | 18 +-------- sys/dev/ic/pluart.c | 3 +- sys/dev/midi.c | 34 +--------------- sys/dev/pci/bktr/bktr_os.c | 4 +- sys/dev/pci/drm/drm_drv.c | 29 -------------- sys/dev/sbus/magma.c | 12 +----- sys/dev/sbus/spif.c | 8 +--- sys/dev/usb/dwc2/dwc2.c | 3 +- sys/dev/usb/fido.c | 4 +- sys/dev/usb/ubsa.c | 4 +- sys/dev/usb/ucom.c | 4 +- sys/dev/usb/udcf.c | 4 +- sys/dev/usb/ugen.c | 64 +----------------------------- sys/dev/usb/uhid.c | 30 +------------- sys/dev/usb/ujoy.c | 4 +- sys/dev/usb/umbg.c | 4 +- sys/dev/usb/umct.c | 4 +- sys/dev/usb/umidi.c | 4 +- sys/dev/usb/umidi_quirks.c | 4 +- sys/dev/usb/umodem.c | 4 +- sys/dev/usb/uplcom.c | 4 +- sys/dev/usb/usb.c | 4 +- sys/dev/usb/uvideo.c | 4 +- sys/dev/usb/uvscom.c | 3 +- sys/dev/video.c | 51 +----------------------- sys/dev/vscsi.c | 28 +------------ sys/dev/wscons/wsdisplay.c | 21 +--------- sys/dev/wscons/wsevent.c | 23 +---------- sys/dev/wscons/wseventvar.h | 3 +- sys/dev/wscons/wskbd.c | 13 +----- sys/dev/wscons/wsmouse.c | 13 +----- sys/dev/wscons/wsmux.c | 21 +--------- sys/kern/subr_log.c | 19 +-------- sys/kern/tty.c | 35 +--------------- sys/kern/tty_pty.c | 52 +----------------------- sys/kern/tty_tty.c | 9 +---- sys/miscfs/fuse/fuse_device.c | 28 +------------ sys/net/bpf.c | 44 +------------------- sys/net/if_pppx.c | 45 +-------------------- sys/net/if_tun.c | 48 +--------------------- sys/net/pipex.c | 3 +- sys/scsi/mpath.c | 4 +- sys/scsi/mpath_emc.c | 4 +- sys/scsi/mpath_hds.c | 4 +- sys/scsi/mpath_rdac.c | 4 +- sys/scsi/mpath_sym.c | 4 +- sys/sys/tty.h | 4 +- 57 files changed, 57 insertions(+), 849 deletions(-) diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c index b949afe6511..57df0ff4e74 100644 --- a/sys/arch/macppc/dev/adb.c +++ b/sys/arch/macppc/dev/adb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb.c,v 1.45 2022/03/13 12:33:01 mpi Exp $ */ +/* $OpenBSD: adb.c,v 1.46 2022/07/02 08:50:41 visa Exp $ */ /* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */ /* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */ @@ -87,8 +87,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/sys/arch/macppc/dev/akbd_machdep.c b/sys/arch/macppc/dev/akbd_machdep.c index c63777c302a..8767d4d6255 100644 --- a/sys/arch/macppc/dev/akbd_machdep.c +++ b/sys/arch/macppc/dev/akbd_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: akbd_machdep.c,v 1.2 2019/09/03 17:51:52 deraadt Exp $ */ +/* $OpenBSD: akbd_machdep.c,v 1.3 2022/07/02 08:50:41 visa Exp $ */ /* $NetBSD: akbd.c,v 1.13 2001/01/25 14:08:55 tsubai Exp $ */ /* @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/sys/arch/sh/dev/scif.c b/sys/arch/sh/dev/scif.c index 14e1254341d..e4592d99e64 100644 --- a/sys/arch/sh/dev/scif.c +++ b/sys/arch/sh/dev/scif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scif.c,v 1.21 2022/04/06 18:59:27 naddy Exp $ */ +/* $OpenBSD: scif.c,v 1.22 2022/07/02 08:50:41 visa Exp $ */ /* $NetBSD: scif.c,v 1.47 2006/07/23 22:06:06 ad Exp $ */ /*- @@ -801,17 +801,6 @@ scifwrite(dev_t dev, struct uio *uio, int flag) return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); } -#if 0 -int -scifpoll(dev_t dev, int events, struct proc *p) -{ - struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; - struct tty *tp = sc->sc_tty; - - return ((*linesw[tp->t_line].l_poll)(tp, events, p)); -} -#endif - struct tty * sciftty(dev_t dev) { diff --git a/sys/arch/sparc64/dev/vldcp.c b/sys/arch/sparc64/dev/vldcp.c index 1dea00796e8..6d686388f8e 100644 --- a/sys/arch/sparc64/dev/vldcp.c +++ b/sys/arch/sparc64/dev/vldcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vldcp.c,v 1.22 2021/10/24 17:05:04 mpi Exp $ */ +/* $OpenBSD: vldcp.c,v 1.23 2022/07/02 08:50:41 visa Exp $ */ /* * Copyright (c) 2009, 2012 Mark Kettenis * @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -578,49 +577,6 @@ vldcpioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return (0); } -int -vldcppoll(dev_t dev, int events, struct proc *p) -{ - struct vldcp_softc *sc; - struct ldc_conn *lc; - uint64_t head, tail, state; - int revents = 0; - int s, err; - - sc = vldcp_lookup(dev); - if (sc == NULL) - return (POLLERR); - lc = &sc->sc_lc; - - s = spltty(); - if (events & (POLLIN | POLLRDNORM)) { - err = hv_ldc_rx_get_state(lc->lc_id, &head, &tail, &state); - - if (err == 0 && state == LDC_CHANNEL_UP && head != tail) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) { - err = hv_ldc_tx_get_state(lc->lc_id, &head, &tail, &state); - - if (err == 0 && state == LDC_CHANNEL_UP && head != tail) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) { - cbus_intr_setenabled(sc->sc_bustag, sc->sc_rx_ino, - INTR_ENABLED); - selrecord(p, &sc->sc_rsel); - } - if (events & (POLLOUT | POLLWRNORM)) { - cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, - INTR_ENABLED); - selrecord(p, &sc->sc_wsel); - } - } - splx(s); - return revents; -} - void filt_vldcprdetach(struct knote *kn) { diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 7f560e011f6..19c7bef725b 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.198 2022/03/21 19:22:39 miod Exp $ */ +/* $OpenBSD: audio.c,v 1.199 2022/07/02 08:50:41 visa Exp $ */ /* * Copyright (c) 2015 Alexandre Ratchov * @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -2050,22 +2049,6 @@ audio_mixer_read(struct audio_softc *sc, struct uio *uio, int ioflag) return 0; } -int -audio_mixer_poll(struct audio_softc *sc, int events, struct proc *p) -{ - int revents = 0; - - mtx_enter(&audio_lock); - if (sc->mix_isopen && sc->mix_pending) - revents |= events & (POLLIN | POLLRDNORM); - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->mix_sel); - } - mtx_leave(&audio_lock); - return revents; -} - int audio_mixer_open(struct audio_softc *sc, int flags) { @@ -2098,26 +2081,6 @@ audio_mixer_close(struct audio_softc *sc, int flags) return 0; } -int -audio_poll(struct audio_softc *sc, int events, struct proc *p) -{ - int revents = 0; - - mtx_enter(&audio_lock); - if ((sc->mode & AUMODE_RECORD) && sc->rec.used > 0) - revents |= events & (POLLIN | POLLRDNORM); - if ((sc->mode & AUMODE_PLAY) && sc->play.used < sc->play.len) - revents |= events & (POLLOUT | POLLWRNORM); - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->rec.sel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &sc->play.sel); - } - mtx_leave(&audio_lock); - return revents; -} - int audioopen(dev_t dev, int flags, int mode, struct proc *p) { @@ -2250,30 +2213,6 @@ audioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) return error; } -int -audiopoll(dev_t dev, int events, struct proc *p) -{ - struct audio_softc *sc; - int revents; - - sc = (struct audio_softc *)device_lookup(&audio_cd, AUDIO_UNIT(dev)); - if (sc == NULL) - return POLLERR; - switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_AUDIO: - revents = audio_poll(sc, events, p); - break; - case AUDIO_DEV_AUDIOCTL: - revents = audio_mixer_poll(sc, events, p); - break; - default: - revents = 0; - break; - } - device_unref(&sc->dev); - return revents; -} - int audiokqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/cons.c b/sys/dev/cons.c index c6694411df0..df69994f3e1 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cons.c,v 1.29 2020/04/03 08:24:52 mpi Exp $ */ +/* $OpenBSD: cons.c,v 1.30 2022/07/02 08:50:41 visa Exp $ */ /* $NetBSD: cons.c,v 1.30 1996/04/08 19:57:30 jonathan Exp $ */ /* @@ -45,7 +45,6 @@ #include #include #include -#include #include @@ -179,26 +178,6 @@ cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p)); } -/*ARGSUSED*/ -int -cnpoll(dev_t dev, int rw, struct proc *p) -{ - - /* - * Redirect the poll, if that's appropriate. - * I don't want to think of the possible side effects - * of console redirection here. - */ - if (constty != NULL) - dev = constty->t_dev; - else if (cn_tab == NULL) - return POLLERR; - else - dev = cn_tab->cn_dev; - return (ttpoll(dev, rw, p)); -} - - int cnkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/cons.h b/sys/dev/cons.h index 13689ce5b15..7dedd481a1f 100644 --- a/sys/dev/cons.h +++ b/sys/dev/cons.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cons.h,v 1.18 2016/05/17 23:43:47 bluhm Exp $ */ +/* $OpenBSD: cons.h,v 1.19 2022/07/02 08:50:41 visa Exp $ */ /* $NetBSD: cons.h,v 1.14 1996/03/14 19:08:35 christos Exp $ */ /* @@ -81,7 +81,6 @@ int cnclose(dev_t, int, int, struct proc *); int cnread(dev_t, struct uio *, int); int cnwrite(dev_t, struct uio *, int); int cnioctl(dev_t, u_long, caddr_t, int, struct proc *); -int cnpoll(dev_t, int, struct proc *); int cnkqfilter(dev_t, struct knote *); int cngetc(void); void cnputc(int); diff --git a/sys/dev/fdt/exuart.c b/sys/dev/fdt/exuart.c index 151035d35aa..34d5df59907 100644 --- a/sys/dev/fdt/exuart.c +++ b/sys/dev/fdt/exuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exuart.c,v 1.10 2022/04/06 18:59:28 naddy Exp $ */ +/* $OpenBSD: exuart.c,v 1.11 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/sys/dev/fdt/imxuart.c b/sys/dev/fdt/imxuart.c index 03031aaa769..3dab7c81653 100644 --- a/sys/dev/fdt/imxuart.c +++ b/sys/dev/fdt/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.12 2021/10/24 17:52:26 mpi Exp $ */ +/* $OpenBSD: imxuart.c,v 1.13 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/sys/dev/gpio/gpiodcf.c b/sys/dev/gpio/gpiodcf.c index b839c60bccc..bc83c70e48f 100644 --- a/sys/dev/gpio/gpiodcf.c +++ b/sys/dev/gpio/gpiodcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpiodcf.c,v 1.9 2020/06/24 22:03:41 cheloha Exp $ */ +/* $OpenBSD: gpiodcf.c,v 1.10 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2008 Marc Balmer @@ -20,11 +20,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include diff --git a/sys/dev/hotplug.c b/sys/dev/hotplug.c index e1e7bad95c9..7743db33592 100644 --- a/sys/dev/hotplug.c +++ b/sys/dev/hotplug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hotplug.c,v 1.21 2020/12/25 12:59:52 visa Exp $ */ +/* $OpenBSD: hotplug.c,v 1.22 2022/07/02 08:50:41 visa Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko * @@ -25,7 +25,6 @@ #include #include #include -#include #include #define HOTPLUG_MAXEVENTS 64 @@ -180,21 +179,6 @@ hotplugioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return (0); } -int -hotplugpoll(dev_t dev, int events, struct proc *p) -{ - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (evqueue_count > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &hotplug_sel); - } - - return (revents); -} - int hotplugkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/ic/pluart.c b/sys/dev/ic/pluart.c index b329521da52..8a91d92d59d 100644 --- a/sys/dev/ic/pluart.c +++ b/sys/dev/ic/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.13 2022/06/28 16:28:08 anton Exp $ */ +/* $OpenBSD: pluart.c,v 1.14 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2014 Patrick Wildt * Copyright (c) 2005 Dale Rahn @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/sys/dev/midi.c b/sys/dev/midi.c index 24099d4ca70..14b3fbbf2f6 100644 --- a/sys/dev/midi.c +++ b/sys/dev/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.54 2022/04/06 18:59:27 naddy Exp $ */ +/* $OpenBSD: midi.c,v 1.55 2022/07/02 08:50:41 visa Exp $ */ /* * Copyright (c) 2003, 2004 Alexandre Ratchov @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -39,7 +38,6 @@ int midiopen(dev_t, int, int, struct proc *); int midiclose(dev_t, int, int, struct proc *); int midiread(dev_t, struct uio *, int); int midiwrite(dev_t, struct uio *, int); -int midipoll(dev_t, int, struct proc *); int midikqfilter(dev_t, struct knote *); int midiioctl(dev_t, u_long, caddr_t, int, struct proc *); int midiprobe(struct device *, void *, void *); @@ -331,36 +329,6 @@ done: return error; } -int -midipoll(dev_t dev, int events, struct proc *p) -{ - struct midi_softc *sc; - int revents; - - sc = (struct midi_softc *)device_lookup(&midi_cd, minor(dev)); - if (sc == NULL) - return POLLERR; - revents = 0; - mtx_enter(&audio_lock); - if (events & (POLLIN | POLLRDNORM)) { - if (!MIDIBUF_ISEMPTY(&sc->inbuf)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) { - if (!MIDIBUF_ISFULL(&sc->outbuf)) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->inbuf.sel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &sc->outbuf.sel); - } - mtx_leave(&audio_lock); - device_unref(&sc->dev); - return (revents); -} - int midikqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c index 8b463c49160..c6018b9b4b2 100644 --- a/sys/dev/pci/bktr/bktr_os.c +++ b/sys/dev/pci/bktr/bktr_os.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_os.c,v 1.36 2022/03/21 19:22:41 miod Exp $ */ +/* $OpenBSD: bktr_os.c,v 1.37 2022/07/02 08:50:42 visa Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp $ */ /* @@ -60,8 +60,6 @@ #include #include #include -#include -#include #include #if NRADIO > 0 #include diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index a0a1deaabb1..ec6681cbd38 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -1864,34 +1863,6 @@ out: return (gotone); } -int -drmpoll(dev_t kdev, int events, struct proc *p) -{ - struct drm_device *dev = drm_get_device_from_kdev(kdev); - struct drm_file *file_priv; - int revents = 0; - - if (dev == NULL) - return (POLLERR); - - mutex_lock(&dev->filelist_mutex); - file_priv = drm_find_file_by_minor(dev, minor(kdev)); - mutex_unlock(&dev->filelist_mutex); - if (file_priv == NULL) - return (POLLERR); - - mtx_enter(&dev->event_lock); - if (events & (POLLIN | POLLRDNORM)) { - if (!list_empty(&file_priv->event_list)) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &file_priv->rsel); - } - mtx_leave(&dev->event_lock); - - return (revents); -} - paddr_t drmmmap(dev_t kdev, off_t offset, int prot) { diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index bd564d3ea8c..cc6a624c91a 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.34 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: magma.c,v 1.35 2022/07/02 08:50:42 visa Exp $ */ /*- * Copyright (c) 1998 Iain Hibbert @@ -1340,7 +1340,6 @@ mtty_param(struct tty *tp, struct termios *t) * mbppread read from mbpp * mbppwrite write to mbpp * mbppioctl do ioctl on mbpp - * mbpppoll do poll on mbpp * mbppkqfilter kqueue on mbpp * mbpp_rw general rw routine * mbpp_timeout rw timeout @@ -1508,15 +1507,6 @@ mbppioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (error); } -/* - * poll routine - */ -int -mbpppoll(dev_t dev, int events, struct proc *p) -{ - return (seltrue(dev, events, p)); -} - int mbppkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index ceffc6ef139..76d5adca310 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.26 2022/03/13 13:34:54 mpi Exp $ */ +/* $OpenBSD: spif.c,v 1.27 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net) @@ -90,7 +90,6 @@ int sbppread(dev_t, struct uio *, int); int sbppwrite(dev_t, struct uio *, int); int sbpp_rw(dev_t, struct uio *); int spifppcintr(void *); -int sbpppoll(dev_t, int, struct proc *); int sbppkqfilter(dev_t, struct knote *); int sbppioctl(dev_t, u_long, caddr_t, int, struct proc *); @@ -1040,11 +1039,6 @@ sbpp_rw(dev_t dev, struct uio *uio) return (ENXIO); } -int -sbpppoll(dev_t dev, int events, struct proc *p) -{ - return (seltrue(dev, events, p)); -} int sbppkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c index ea2317e4754..15ea1612a9e 100644 --- a/sys/dev/usb/dwc2/dwc2.c +++ b/sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.61 2022/05/01 10:28:54 mglocker Exp $ */ +/* $OpenBSD: dwc2.c,v 1.62 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/sys/dev/usb/fido.c b/sys/dev/usb/fido.c index c40257e4f0b..edec714d3cf 100644 --- a/sys/dev/usb/fido.c +++ b/sys/dev/usb/fido.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fido.c,v 1.4 2021/11/15 15:36:24 anton Exp $ */ +/* $OpenBSD: fido.c,v 1.5 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2019 Reyk Floeter @@ -27,10 +27,8 @@ #include #include #include -#include #include #include -#include #include #include diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 69fc2965211..22f534cc487 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsa.c,v 1.68 2022/04/09 20:07:44 naddy Exp $ */ +/* $OpenBSD: ubsa.c,v 1.69 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev . @@ -63,8 +63,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index e2e41ce2451..d87006f7290 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.73 2022/06/27 13:14:49 jan Exp $ */ +/* $OpenBSD: ucom.c,v 1.74 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -42,10 +42,8 @@ #include #include #include -#include #include #include -#include #include diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c index bf837e1683a..4b0b2f05e83 100644 --- a/sys/dev/usb/udcf.c +++ b/sys/dev/usb/udcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udcf.c,v 1.64 2020/06/24 22:03:41 cheloha Exp $ */ +/* $OpenBSD: udcf.c,v 1.65 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Marc Balmer @@ -19,9 +19,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 450a39d9055..bf82f843e9f 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.115 2021/02/05 08:17:22 mglocker Exp $ */ +/* $OpenBSD: ugen.c,v 1.116 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -44,7 +44,6 @@ #include #include #include -#include #include @@ -1245,67 +1244,6 @@ ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) return (error); } -int -ugenpoll(dev_t dev, int events, struct proc *p) -{ - struct ugen_softc *sc; - struct ugen_endpoint *sce; - int revents = 0; - int s; - - sc = ugen_cd.cd_devs[UGENUNIT(dev)]; - - if (usbd_is_dying(sc->sc_udev)) - return (POLLERR); - - /* XXX always IN */ - sce = &sc->sc_endpoints[UGENENDPOINT(dev)][IN]; - if (sce == NULL) - return (POLLERR); -#ifdef DIAGNOSTIC - if (!sce->edesc) { - printf("ugenpoll: no edesc\n"); - return (POLLERR); - } - if (!sce->pipeh) { - printf("ugenpoll: no pipe\n"); - return (POLLERR); - } -#endif - s = splusb(); - switch (UE_GET_XFERTYPE(sce->edesc->bmAttributes)) { - case UE_INTERRUPT: - if (events & (POLLIN | POLLRDNORM)) { - if (sce->q.c_cc > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sce->rsel); - } - break; - case UE_ISOCHRONOUS: - if (events & (POLLIN | POLLRDNORM)) { - if (sce->cur != sce->fill) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sce->rsel); - } - break; - case UE_BULK: - /* - * We have no easy way of determining if a read will - * yield any data or a write will happen. - * Pretend they will. - */ - revents |= events & - (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM); - break; - default: - break; - } - splx(s); - return (revents); -} - void filt_ugenrdetach(struct knote *); int filt_ugenread_intr(struct knote *, long); int filt_ugenread_isoc(struct knote *, long); diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index c5325f9c0a8..01b4a017a47 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.88 2021/11/15 15:36:24 anton Exp $ */ +/* $OpenBSD: uhid.c,v 1.89 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -50,7 +50,6 @@ #include #include #include -#include #include #include @@ -414,33 +413,6 @@ uhidioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) return (error); } -int -uhidpoll(dev_t dev, int events, struct proc *p) -{ - struct uhid_softc *sc; - int revents = 0; - int s; - - if ((sc = uhid_lookup(dev)) == NULL) - return (POLLERR); - - if (usbd_is_dying(sc->sc_hdev.sc_udev)) - return (POLLHUP); - - s = splusb(); - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - if (events & (POLLIN | POLLRDNORM)) { - if (sc->sc_q.c_cc > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sc->sc_rsel); - } - - splx(s); - return (revents); -} - void filt_uhidrdetach(struct knote *); int filt_uhidread(struct knote *, long); int uhidkqfilter(dev_t, struct knote *); diff --git a/sys/dev/usb/ujoy.c b/sys/dev/usb/ujoy.c index ce02e1fb964..8728e4b215b 100644 --- a/sys/dev/usb/ujoy.c +++ b/sys/dev/usb/ujoy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ujoy.c,v 1.3 2021/11/15 15:36:24 anton Exp $ */ +/* $OpenBSD: ujoy.c,v 1.4 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2021 Thomas Frohwein @@ -26,10 +26,8 @@ #include #include #include -#include #include #include -#include #include #include diff --git a/sys/dev/usb/umbg.c b/sys/dev/usb/umbg.c index 3656090633f..62e5bd017c7 100644 --- a/sys/dev/usb/umbg.c +++ b/sys/dev/usb/umbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umbg.c,v 1.27 2020/07/31 10:49:33 mglocker Exp $ */ +/* $OpenBSD: umbg.c,v 1.28 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2007 Marc Balmer @@ -20,9 +20,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index c97bf622fce..31e9fac33c8 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umct.c,v 1.49 2022/04/09 20:07:44 naddy Exp $ */ +/* $OpenBSD: umct.c,v 1.50 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -42,9 +42,7 @@ #include #include #include -#include #include -#include #include #include diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c index 1f4e2cb615c..2fc5a091c50 100644 --- a/sys/dev/usb/umidi.c +++ b/sys/dev/usb/umidi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umidi.c,v 1.55 2022/03/21 19:22:42 miod Exp $ */ +/* $OpenBSD: umidi.c,v 1.56 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,8 +37,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/dev/usb/umidi_quirks.c b/sys/dev/usb/umidi_quirks.c index df4f6953991..9f1e5d7227e 100644 --- a/sys/dev/usb/umidi_quirks.c +++ b/sys/dev/usb/umidi_quirks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umidi_quirks.c,v 1.16 2018/01/18 18:09:38 ratchov Exp $ */ +/* $OpenBSD: umidi_quirks.c,v 1.17 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: umidi_quirks.c,v 1.4 2002/06/19 13:55:30 tshiozak Exp $ */ /* @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 3906bbbe193..b1b24920045 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umodem.c,v 1.68 2022/04/09 20:07:44 naddy Exp $ */ +/* $OpenBSD: umodem.c,v 1.69 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: umodem.c,v 1.45 2002/09/23 05:51:23 simonb Exp $ */ /* @@ -49,9 +49,7 @@ #include #include #include -#include #include -#include #include #include diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index c182279e94e..603bfb3cd91 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uplcom.c,v 1.79 2022/04/09 20:07:44 naddy Exp $ */ +/* $OpenBSD: uplcom.c,v 1.80 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: uplcom.c,v 1.29 2002/09/23 05:51:23 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -44,9 +44,7 @@ #include #include #include -#include #include -#include #include #include diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index ad5246507ee..2d9c26e6930 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.129 2022/01/09 05:43:02 jsg Exp $ */ +/* $OpenBSD: usb.c,v 1.130 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -49,8 +49,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index e5c7425818b..a21e1df70c0 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.216 2022/03/21 19:22:42 miod Exp $ */ +/* $OpenBSD: uvideo.c,v 1.217 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2008 Robert Nagy @@ -25,10 +25,8 @@ #include #include #include -#include #include #include -#include #include #include #include diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index d64f7495a30..66003c7b520 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvscom.c,v 1.41 2022/04/09 20:07:44 naddy Exp $ */ +/* $OpenBSD: uvscom.c,v 1.42 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: uvscom.c,v 1.9 2003/02/12 15:36:20 ichiro Exp $ */ /*- * Copyright (c) 2001-2002, Shunsuke Akiyama . @@ -44,7 +44,6 @@ #include #include #include -#include #include #include diff --git a/sys/dev/video.c b/sys/dev/video.c index f16c47eba76..5fc93e303ba 100644 --- a/sys/dev/video.c +++ b/sys/dev/video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: video.c,v 1.56 2022/04/06 18:59:27 naddy Exp $ */ +/* $OpenBSD: video.c,v 1.57 2022/07/02 08:50:41 visa Exp $ */ /* * Copyright (c) 2008 Robert Nagy @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -390,54 +389,6 @@ videoioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (error); } -int -videopoll(dev_t dev, int events, struct proc *p) -{ - int unit = VIDEOUNIT(dev); - struct video_softc *sc; - int error, revents = 0; - - KERNEL_ASSERT_LOCKED(); - - if (unit >= video_cd.cd_ndevs || - (sc = video_cd.cd_devs[unit]) == NULL) - return (POLLERR); - - if (sc->sc_dying) - return (POLLERR); - - if ((error = video_claim(sc, p->p_p))) - return (error); - - DPRINTF(1, "%s: events=0x%x\n", __func__, events); - - if (events & (POLLIN | POLLRDNORM)) { - if (sc->sc_frames_ready > 0) - revents |= events & (POLLIN | POLLRDNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) { - /* - * Start the stream in read() mode if not already - * started. If the user wanted mmap() mode, - * he should have called mmap() before now. - */ - if (sc->sc_vidmode == VIDMODE_NONE && - sc->hw_if->start_read) { - error = sc->hw_if->start_read(sc->hw_hdl); - if (error) - return (POLLERR); - sc->sc_vidmode = VIDMODE_READ; - } - selrecord(p, &sc->sc_rsel); - } - } - - DPRINTF(1, "%s: revents=0x%x\n", __func__, revents); - - return (revents); -} - paddr_t videommap(dev_t dev, off_t off, int prot) { diff --git a/sys/dev/vscsi.c b/sys/dev/vscsi.c index c78d197bd30..0c39f1a0897 100644 --- a/sys/dev/vscsi.c +++ b/sys/dev/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.60 2022/04/16 19:19:58 naddy Exp $ */ +/* $OpenBSD: vscsi.c,v 1.61 2022/07/02 08:50:41 visa Exp $ */ /* * Copyright (c) 2008 David Gwynne @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -527,31 +526,6 @@ gone: free(dt, M_TEMP, sizeof(*dt)); } -int -vscsipoll(dev_t dev, int events, struct proc *p) -{ - struct vscsi_softc *sc = DEV2SC(dev); - int revents = 0; - - if (sc == NULL) - return (POLLERR); - - if (events & (POLLIN | POLLRDNORM)) { - mtx_enter(&sc->sc_state_mtx); - if (!TAILQ_EMPTY(&sc->sc_ccb_i2t)) - revents |= events & (POLLIN | POLLRDNORM); - mtx_leave(&sc->sc_state_mtx); - } - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->sc_sel); - } - - device_unref(&sc->sc_dev); - return (revents); -} - int vscsikqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 8e1b2543e7c..4bbbe38b5d1 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.145 2022/06/20 16:28:42 gnezdo Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.146 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -45,7 +45,6 @@ #include #include #include -#include #include #include @@ -1406,24 +1405,6 @@ wsdisplaymmap(dev_t dev, off_t offset, int prot) return ((*sc->sc_accessops->mmap)(sc->sc_accesscookie, offset, prot)); } -int -wsdisplaypoll(dev_t dev, int events, struct proc *p) -{ - struct wsdisplay_softc *sc = wsdisplay_cd.cd_devs[WSDISPLAYUNIT(dev)]; - struct wsscreen *scr; - - if (ISWSDISPLAYCTL(dev)) - return (0); - - if ((scr = sc->sc_scr[WSDISPLAYSCREEN(dev)]) == NULL) - return (POLLERR); - - if (!WSSCREEN_HAS_TTY(scr)) - return (POLLERR); - - return (ttpoll(dev, events, p)); -} - int wsdisplaykqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index 2aacd702078..89ff7840601 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsevent.c,v 1.25 2020/12/25 12:59:52 visa Exp $ */ +/* $OpenBSD: wsevent.c,v 1.26 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: wsevent.c,v 1.16 2003/08/07 16:31:29 agc Exp $ */ /* @@ -79,8 +79,6 @@ #include #include #include -#include -#include #include #include @@ -140,7 +138,7 @@ wsevent_fini(struct wseventvar *ev) } /* - * User-level interface: read, poll. + * User-level interface: read, kqueue. * (User cannot write an event queue.) */ int @@ -200,23 +198,6 @@ wsevent_read(struct wseventvar *ev, struct uio *uio, int flags) return (error); } -int -wsevent_poll(struct wseventvar *ev, int events, struct proc *p) -{ - int revents = 0; - int s = splwsevent(); - - if (events & (POLLIN | POLLRDNORM)) { - if (ev->get != ev->put) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &ev->sel); - } - - splx(s); - return (revents); -} - int wsevent_kqfilter(struct wseventvar *ev, struct knote *kn) { diff --git a/sys/dev/wscons/wseventvar.h b/sys/dev/wscons/wseventvar.h index 5042b81cb9c..fc1cc7da286 100644 --- a/sys/dev/wscons/wseventvar.h +++ b/sys/dev/wscons/wseventvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wseventvar.h,v 1.10 2019/05/22 18:52:14 anton Exp $ */ +/* $OpenBSD: wseventvar.h,v 1.11 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: wseventvar.h,v 1.1 1998/03/22 14:24:03 drochner Exp $ */ /* @@ -107,7 +107,6 @@ struct wseventvar { int wsevent_init(struct wseventvar *); void wsevent_fini(struct wseventvar *); int wsevent_read(struct wseventvar *, struct uio *, int); -int wsevent_poll(struct wseventvar *, int, struct proc *); int wsevent_kqfilter(struct wseventvar *, struct knote *); /* diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index 62ba44a8d49..892fb05ef4b 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.112 2022/04/06 18:59:30 naddy Exp $ */ +/* $OpenBSD: wskbd.c,v 1.113 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */ /* @@ -94,7 +94,6 @@ #include #include #include -#include #include @@ -1256,16 +1255,6 @@ getkeyrepeat: return (error); } -int -wskbdpoll(dev_t dev, int events, struct proc *p) -{ - struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)]; - - if (sc->sc_base.me_evp == NULL) - return (POLLERR); - return (wsevent_poll(sc->sc_base.me_evp, events, p)); -} - int wskbdkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c index 20347cfcbf9..c786af18208 100644 --- a/sys/dev/wscons/wsmouse.c +++ b/sys/dev/wscons/wsmouse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmouse.c,v 1.68 2022/04/06 18:59:30 naddy Exp $ */ +/* $OpenBSD: wsmouse.c,v 1.69 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */ /* @@ -103,7 +103,6 @@ #include #include #include -#include #include #include @@ -533,16 +532,6 @@ wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, caddr_t data, int flag, return (error != -1 ? error : ENOTTY); } -int -wsmousepoll(dev_t dev, int events, struct proc *p) -{ - struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)]; - - if (sc->sc_base.me_evp == NULL) - return (POLLERR); - return (wsevent_poll(sc->sc_base.me_evp, events, p)); -} - int wsmousekqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index db5b9f0ad2f..a8a4f45e218 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmux.c,v 1.55 2021/09/22 15:44:12 anton Exp $ */ +/* $OpenBSD: wsmux.c,v 1.56 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */ /* @@ -55,7 +55,6 @@ #include #include #include -#include #include #include @@ -561,24 +560,6 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag, return (error); } -/* - * poll() of the pseudo device from device table. - */ -int -wsmuxpoll(dev_t dev, int events, struct proc *p) -{ - struct wsmux_softc *sc = wsmuxdevs[minor(dev)]; - - if (sc->sc_base.me_evp == NULL) { -#ifdef DIAGNOSTIC - printf("wsmuxpoll: not open\n"); -#endif - return (POLLERR); - } - - return (wsevent_poll(sc->sc_base.me_evp, events, p)); -} - int wsmuxkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 3cfe96edb5d..930322555bb 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.74 2021/03/18 08:43:38 mvs Exp $ */ +/* $OpenBSD: subr_log.c,v 1.75 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -299,22 +298,6 @@ logread(dev_t dev, struct uio *uio, int flag) return (error); } -int -logpoll(dev_t dev, int events, struct proc *p) -{ - int revents = 0; - - mtx_enter(&log_mtx); - if (events & (POLLIN | POLLRDNORM)) { - if (msgbufp->msg_bufr != msgbufp->msg_bufx) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &logsoftc.sc_selp); - } - mtx_leave(&log_mtx); - return (revents); -} - int logkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/kern/tty.c b/sys/kern/tty.c index e5e527f9b50..de46bcbb2d1 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.174 2022/02/15 03:53:58 jsg Exp $ */ +/* $OpenBSD: tty.c,v 1.175 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -57,7 +57,6 @@ #include #include #include -#include #include #include @@ -1058,38 +1057,6 @@ ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) return (0); } -int -ttpoll(dev_t device, int events, struct proc *p) -{ - struct tty *tp; - int revents, s; - - tp = (*cdevsw[major(device)].d_tty)(device); - - revents = 0; - s = spltty(); - if (events & (POLLIN | POLLRDNORM)) { - if (ttnread(tp) > 0 || (!ISSET(tp->t_cflag, CLOCAL) && - !ISSET(tp->t_state, TS_CARR_ON))) - revents |= events & (POLLIN | POLLRDNORM); - } - /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */ - if (!ISSET(tp->t_cflag, CLOCAL) && !ISSET(tp->t_state, TS_CARR_ON)) { - revents |= POLLHUP; - } else if (events & (POLLOUT | POLLWRNORM)) { - if (tp->t_outq.c_cc <= tp->t_lowat) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &tp->t_rsel); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &tp->t_wsel); - } - splx(s); - return (revents); -} - const struct filterops ttyread_filtops = { .f_flags = FILTEROP_ISFD, .f_attach = NULL, diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 684b5402a3c..49683f44005 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.112 2021/12/15 15:30:47 visa Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.113 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -55,7 +55,6 @@ #include #include #include -#include #include #include @@ -602,55 +601,6 @@ done: return (error); } -int -ptcpoll(dev_t dev, int events, struct proc *p) -{ - struct pt_softc *pti = pt_softc[minor(dev)]; - struct tty *tp = pti->pt_tty; - int revents = 0, s; - - if (!ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_CARR_ON)) - goto notopen; - - if (events & (POLLIN | POLLRDNORM)) { - /* - * Need to protect access to t_outq - */ - s = spltty(); - if ((tp->t_outq.c_cc && !ISSET(tp->t_state, TS_TTSTOP)) || - ((pti->pt_flags & PF_PKT) && pti->pt_send) || - ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)) - revents |= events & (POLLIN | POLLRDNORM); - splx(s); - } - /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */ - if (!ISSET(tp->t_state, TS_CARR_ON)) { - revents |= POLLHUP; - } else if (events & (POLLOUT | POLLWRNORM)) { - if ((pti->pt_flags & PF_REMOTE) ? - (tp->t_canq.c_cc == 0) : - ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp) - 2) || - (tp->t_canq.c_cc == 0 && ISSET(tp->t_lflag, ICANON)))) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (events & (POLLPRI | POLLRDBAND)) { - /* If in packet or user control mode, check for data. */ - if (((pti->pt_flags & PF_PKT) && pti->pt_send) || - ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)) - revents |= events & (POLLPRI | POLLRDBAND); - } - - if (revents == 0) { -notopen: - if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) - selrecord(p, &pti->pt_selr); - if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &pti->pt_selw); - } - - return (revents); -} - void filt_ptcrdetach(struct knote *kn) { diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 608444e5429..493ebf12bdb 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_tty.c,v 1.30 2022/06/26 05:20:42 visa Exp $ */ +/* $OpenBSD: tty_tty.c,v 1.31 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */ /*- @@ -143,13 +143,6 @@ cttyioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, p)); } -int -cttypoll(dev_t dev, int events, struct proc *p) -{ - panic("not implemented"); - return (0); -} - int cttykqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c index 91ffaca08ca..361b6d2a2ab 100644 --- a/sys/miscfs/fuse/fuse_device.c +++ b/sys/miscfs/fuse/fuse_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_device.c,v 1.36 2021/03/11 13:31:35 jsg Exp $ */ +/* $OpenBSD: fuse_device.c,v 1.37 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -64,7 +63,6 @@ int fuseclose(dev_t, int, int, struct proc *); int fuseioctl(dev_t, u_long, caddr_t, int, struct proc *); int fuseread(dev_t, struct uio *, int); int fusewrite(dev_t, struct uio *, int); -int fusepoll(dev_t, int, struct proc *); int fusekqfilter(dev_t dev, struct knote *kn); int filt_fuse_read(struct knote *, long); void filt_fuse_rdetach(struct knote *); @@ -508,30 +506,6 @@ end: return (error); } -int -fusepoll(dev_t dev, int events, struct proc *p) -{ - struct fuse_d *fd; - int revents = 0; - - fd = fuse_lookup(minor(dev)); - if (fd == NULL) - return (POLLERR); - - if (events & (POLLIN | POLLRDNORM)) - if (!SIMPLEQ_EMPTY(&fd->fd_fbufs_in)) - revents |= events & (POLLIN | POLLRDNORM); - - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &fd->fd_rsel); - - return (revents); -} - int fusekqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/net/bpf.c b/sys/net/bpf.c index f882923b376..5f7479532b4 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.216 2022/03/17 14:22:03 visa Exp $ */ +/* $OpenBSD: bpf.c,v 1.217 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -98,7 +97,6 @@ void bpf_mcopy(const void *, void *, size_t); int bpf_movein(struct uio *, struct bpf_d *, struct mbuf **, struct sockaddr *); int bpf_setif(struct bpf_d *, struct ifreq *); -int bpfpoll(dev_t, int, struct proc *); int bpfkqfilter(dev_t, struct knote *); void bpf_wakeup(struct bpf_d *); void bpf_wakeup_cb(void *); @@ -1143,46 +1141,6 @@ bpf_ifname(struct bpf_if *bif, struct ifreq *ifr) bcopy(bif->bif_name, ifr->ifr_name, sizeof(ifr->ifr_name)); } -/* - * Support for poll() system call - */ -int -bpfpoll(dev_t dev, int events, struct proc *p) -{ - struct bpf_d *d; - int revents; - - KERNEL_ASSERT_LOCKED(); - - /* - * An imitation of the FIONREAD ioctl code. - */ - d = bpfilter_lookup(minor(dev)); - - /* - * XXX The USB stack manages it to trigger some race condition - * which causes bpfilter_lookup to return NULL when a USB device - * gets detached while it is up and has an open bpf handler (e.g. - * dhclient). We still should recheck if we can fix the root - * cause of this issue. - */ - if (d == NULL) - return (POLLERR); - - /* Always ready to write data */ - revents = events & (POLLOUT | POLLWRNORM); - - if (events & (POLLIN | POLLRDNORM)) { - mtx_enter(&d->bd_mtx); - if (d->bd_hlen != 0 || (d->bd_immediate && d->bd_slen != 0)) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &d->bd_sel); - mtx_leave(&d->bd_mtx); - } - return (revents); -} - const struct filterops bpfread_filtops = { .f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE, .f_attach = NULL, diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index b103addd284..c76ee3ed8f6 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.117 2022/06/26 22:51:58 mvs Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.118 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2010 Claudio Jeker @@ -56,7 +56,6 @@ #include #include #include -#include #include #include @@ -447,27 +446,6 @@ pppxioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) return (error); } -int -pppxpoll(dev_t dev, int events, struct proc *p) -{ - struct pppx_dev *pxd = pppx_dev2pxd(dev); - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (!mq_empty(&pxd->pxd_svcq)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &pxd->pxd_rsel); - } - - return (revents); -} - int pppxkqfilter(dev_t dev, struct knote *kn) { @@ -1212,27 +1190,6 @@ pppacioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (error); } -int -pppacpoll(dev_t dev, int events, struct proc *p) -{ - struct pppac_softc *sc = pppac_lookup(dev); - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (!mq_empty(&sc->sc_mq)) - revents |= events & (POLLIN | POLLRDNORM); - } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &sc->sc_rsel); - } - - return (revents); -} - int pppackqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index e1a10a35412..88c91c952b6 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.236 2022/02/26 02:15:45 dlg Exp $ */ +/* $OpenBSD: if_tun.c,v 1.237 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -53,7 +53,6 @@ #include #include #include -#include #include #include @@ -110,7 +109,6 @@ int tun_dev_close(dev_t, struct proc *); int tun_dev_ioctl(dev_t, u_long, void *); int tun_dev_read(dev_t, struct uio *, int); int tun_dev_write(dev_t, struct uio *, int, int); -int tun_dev_poll(dev_t, int, struct proc *); int tun_dev_kqfilter(dev_t, struct knote *); int tun_ioctl(struct ifnet *, u_long, caddr_t); @@ -943,50 +941,6 @@ tun_input(struct ifnet *ifp, struct mbuf *m0) } } -/* - * tunpoll - the poll interface, this is only useful on reads - * really. The write detect always returns true, write never blocks - * anyway, it either accepts the packet or drops it. - */ -int -tunpoll(dev_t dev, int events, struct proc *p) -{ - return (tun_dev_poll(dev, events, p)); -} - -int -tappoll(dev_t dev, int events, struct proc *p) -{ - return (tun_dev_poll(dev, events, p)); -} - -int -tun_dev_poll(dev_t dev, int events, struct proc *p) -{ - struct tun_softc *sc; - struct ifnet *ifp; - int revents; - - sc = tun_get(dev); - if (sc == NULL) - return (POLLERR); - - ifp = &sc->sc_if; - revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - if (!ifq_empty(&ifp->if_snd)) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &sc->sc_rsel); - } - if (events & (POLLOUT | POLLWRNORM)) - revents |= events & (POLLOUT | POLLWRNORM); - - tun_put(sc); - return (revents); -} - int tunkqfilter(dev_t dev, struct knote *kn) { diff --git a/sys/net/pipex.c b/sys/net/pipex.c index 7eef55ff153..be1667f82b2 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.142 2022/06/28 08:01:40 mvs Exp $ */ +/* $OpenBSD: pipex.c,v 1.143 2022/07/02 08:50:42 visa Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c index df425d9d02e..049000ba9af 100644 --- a/sys/scsi/mpath.c +++ b/sys/scsi/mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath.c,v 1.56 2022/04/16 19:19:59 naddy Exp $ */ +/* $OpenBSD: mpath.c,v 1.57 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2009 David Gwynne @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/scsi/mpath_emc.c b/sys/scsi/mpath_emc.c index e6a10b7a720..c9069e3ac3d 100644 --- a/sys/scsi/mpath_emc.c +++ b/sys/scsi/mpath_emc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_emc.c,v 1.24 2021/10/24 16:57:30 mpi Exp $ */ +/* $OpenBSD: mpath_emc.c,v 1.25 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2011 David Gwynne @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/scsi/mpath_hds.c b/sys/scsi/mpath_hds.c index c88693130e3..cb71ae7a50a 100644 --- a/sys/scsi/mpath_hds.c +++ b/sys/scsi/mpath_hds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_hds.c,v 1.25 2021/10/24 16:57:30 mpi Exp $ */ +/* $OpenBSD: mpath_hds.c,v 1.26 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2011 David Gwynne @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/scsi/mpath_rdac.c b/sys/scsi/mpath_rdac.c index 7615bf57eb6..5928aca79e9 100644 --- a/sys/scsi/mpath_rdac.c +++ b/sys/scsi/mpath_rdac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_rdac.c,v 1.26 2021/10/24 16:57:30 mpi Exp $ */ +/* $OpenBSD: mpath_rdac.c,v 1.27 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2010 David Gwynne @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/scsi/mpath_sym.c b/sys/scsi/mpath_sym.c index fbe30a92f5f..9c15b7c7e22 100644 --- a/sys/scsi/mpath_sym.c +++ b/sys/scsi/mpath_sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath_sym.c,v 1.27 2021/10/24 16:57:30 mpi Exp $ */ +/* $OpenBSD: mpath_sym.c,v 1.28 2022/07/02 08:50:42 visa Exp $ */ /* * Copyright (c) 2010 David Gwynne @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include diff --git a/sys/sys/tty.h b/sys/sys/tty.h index b31aeec35d9..0841e6497a2 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.h,v 1.40 2021/12/02 15:13:49 deraadt Exp $ */ +/* $OpenBSD: tty.h,v 1.41 2022/07/02 08:50:42 visa Exp $ */ /* $NetBSD: tty.h,v 1.30.4.1 1996/06/02 09:08:13 mrg Exp $ */ /*- @@ -272,7 +272,6 @@ int ttioctl(struct tty *tp, u_long com, caddr_t data, int flag, struct proc *p); int ttread(struct tty *tp, struct uio *uio, int flag); void ttrstrt(void *tp); -int ttpoll(dev_t device, int events, struct proc *p); int ttkqfilter(dev_t dev, struct knote *kn); void ttsetwater(struct tty *tp); int ttspeedtab(int speed, const struct speedtab *table); @@ -306,7 +305,6 @@ int cttyopen(dev_t, int, int, struct proc *); int cttyread(dev_t, struct uio *, int); int cttywrite(dev_t, struct uio *, int); int cttyioctl(dev_t, u_long, caddr_t, int, struct proc *); -int cttypoll(dev_t, int, struct proc *); void clalloc(struct clist *, int, int); void clfree(struct clist *); -- 2.20.1