Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Use seltrue_filtops rather than rolling our ow...



details:   https://anonhg.NetBSD.org/src/rev/a11629bdbdd0
branches:  trunk
changeset: 987430:a11629bdbdd0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 26 14:56:36 2021 +0000

description:
- Use seltrue_filtops rather than rolling our own with filt_seltrue.
- Remove sc_wsel completely; nothing actually uses it.

diffstat:

 sys/dev/pci/oboe.c |  42 ++++++++----------------------------------
 1 files changed, 8 insertions(+), 34 deletions(-)

diffs (114 lines):

diff -r edc8c4843e39 -r a11629bdbdd0 sys/dev/pci/oboe.c
--- a/sys/dev/pci/oboe.c        Sun Sep 26 14:52:37 2021 +0000
+++ b/sys/dev/pci/oboe.c        Sun Sep 26 14:56:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oboe.c,v 1.50 2021/09/26 01:16:09 thorpej Exp $        */
+/*     $NetBSD: oboe.c,v 1.51 2021/09/26 14:56:36 thorpej Exp $        */
 
 /*     XXXXFVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage  */
 
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.50 2021/09/26 01:16:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.51 2021/09/26 14:56:36 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -96,7 +96,6 @@
        bus_space_handle_t      sc_ioh;
        bus_dma_tag_t           sc_dmatag;
        struct selinfo          sc_rsel;
-       struct selinfo          sc_wsel;
 
        int                     sc_state;
 #define        OBOE_RSLP               0x01    /* waiting for data (read) */
@@ -227,7 +226,6 @@
        aprint_normal_dev(self, "interrupting at %s\n", intrstring);
 
        selinit(&sc->sc_rsel);
-       selinit(&sc->sc_wsel);
 
        sc->sc_txs = 0;
        sc->sc_rxs = 0;
@@ -252,7 +250,6 @@
        DPRINTF(("%s: sc=%p\n", __func__, sc));
 #endif
        seldestroy(&sc->sc_rsel);
-       seldestroy(&sc->sc_wsel);
        return (0);
 }
 
@@ -483,17 +480,6 @@
        return (kn->kn_data > 0);
 }
 
-static void
-filt_oboewdetach(struct knote *kn)
-{
-       struct oboe_softc *sc = kn->kn_hook;
-       int s;
-
-       s = splir();
-       selremove_knote(&sc->sc_wsel, kn);
-       splx(s);
-}
-
 static const struct filterops oboeread_filtops = {
        .f_flags = FILTEROP_ISFD,
        .f_attach = NULL,
@@ -501,39 +487,28 @@
        .f_event = filt_oboeread,
 };
 
-static const struct filterops oboewrite_filtops = {
-       .f_flags = FILTEROP_ISFD,
-       .f_attach = NULL,
-       .f_detach = filt_oboewdetach,
-       .f_event = filt_seltrue,
-};
-
 static int
 oboe_kqfilter(void *h, struct knote *kn)
 {
        struct oboe_softc *sc = h;
-       struct selinfo *sip;
        int s;
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               sip = &sc->sc_rsel;
                kn->kn_fop = &oboeread_filtops;
+               kn->kn_hook = sc;
+               s = splir();
+               selrecord_knote(&sc->sc_rsel, kn);
+               splx(s);
                break;
+
        case EVFILT_WRITE:
-               sip = &sc->sc_wsel;
-               kn->kn_fop = &oboewrite_filtops;
+               kn->kn_fop = &seltrue_filtops;
                break;
        default:
                return (EINVAL);
        }
 
-       kn->kn_hook = sc;
-
-       s = splir();
-       selrecord_knote(sip, kn);
-       splx(s);
-
        return (0);
 }
 
@@ -613,7 +588,6 @@
                        DPRINTF(("oboe_intr: waking up writer\n"));
                        wakeup(&sc->sc_txs);
                }
-               selnotify(&sc->sc_wsel, 0, 0);
        }
        return (1);
 }



Home | Main Index | Thread Index | Old Index