diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-05-13 08:13:43 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-05-13 08:13:43 +0000 |
commit | 40560969993f8c1bacef7a251fa11666eaa88e20 (patch) | |
tree | dda1870cd76e6feab3aaf5e40df9d58b298b4f07 /sys/dev/usb | |
parent | 7003704898fbda4c266de4228251653b6d83125a (diff) |
Use seltrue_kqfilter() instead of hand-rolling it in multiple drivers.
ok visa@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/ugen.c | 19 | ||||
-rw-r--r-- | sys/dev/usb/uhid.c | 13 |
2 files changed, 6 insertions, 26 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index a4c92398238..9128ffd1d46 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.105 2020/04/07 13:27:51 visa Exp $ */ +/* $OpenBSD: ugen.c,v 1.106 2020/05/13 08:13:42 mpi 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 $ */ @@ -1342,13 +1342,6 @@ const struct filterops ugenread_isoc_filtops = { .f_event = filt_ugenread_isoc, }; -const struct filterops ugen_seltrue_filtops = { - .f_flags = FILTEROP_ISFD, - .f_attach = NULL, - .f_detach = filt_ugenrdetach, - .f_event = filt_seltrue, -}; - int ugenkqfilter(dev_t dev, struct knote *kn) { @@ -1378,13 +1371,11 @@ ugenkqfilter(dev_t dev, struct knote *kn) kn->kn_fop = &ugenread_isoc_filtops; break; case UE_BULK: - /* + /* * We have no easy way of determining if a read will * yield any data or a write will happen. - * So, emulate "seltrue". */ - kn->kn_fop = &ugen_seltrue_filtops; - break; + return (seltrue_kqfilter(dev, kn)); default: return (EINVAL); } @@ -1402,10 +1393,8 @@ ugenkqfilter(dev_t dev, struct knote *kn) /* * We have no easy way of determining if a read will * yield any data or a write will happen. - * So, emulate "seltrue". */ - kn->kn_fop = &ugen_seltrue_filtops; - break; + return (seltrue_kqfilter(dev, kn)); default: return (EINVAL); } diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index d72d5e150b9..d8e5f8f7ddc 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.79 2020/04/07 13:27:51 visa Exp $ */ +/* $OpenBSD: uhid.c,v 1.80 2020/05/13 08:13:42 mpi Exp $ */ /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -467,13 +467,6 @@ const struct filterops uhidread_filtops = { .f_event = filt_uhidread, }; -const struct filterops uhid_seltrue_filtops = { - .f_flags = FILTEROP_ISFD, - .f_attach = NULL, - .f_detach = filt_uhidrdetach, - .f_event = filt_seltrue, -}; - int uhidkqfilter(dev_t dev, struct knote *kn) { @@ -494,9 +487,7 @@ uhidkqfilter(dev_t dev, struct knote *kn) break; case EVFILT_WRITE: - klist = &sc->sc_rsel.si_note; - kn->kn_fop = &uhid_seltrue_filtops; - break; + return (seltrue_kqfilter(dev, kn)); default: return (EINVAL); |