Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Don't dig into the guts of selinfo.



details:   https://anonhg.NetBSD.org/src/rev/7af9de4c64e7
branches:  trunk
changeset: 361154:7af9de4c64e7
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Feb 12 16:21:27 2022 +0000

description:
Don't dig into the guts of selinfo.

diffstat:

 sys/dev/pci/xmm7360.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (88 lines):

diff -r 335fc75521bc -r 7af9de4c64e7 sys/dev/pci/xmm7360.c
--- a/sys/dev/pci/xmm7360.c     Sat Feb 12 15:55:04 2022 +0000
+++ b/sys/dev/pci/xmm7360.c     Sat Feb 12 16:21:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xmm7360.c,v 1.15 2022/02/12 15:51:29 thorpej Exp $     */
+/*     $NetBSD: xmm7360.c,v 1.16 2022/02/12 16:21:27 thorpej Exp $     */
 
 /*
  * Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL.
@@ -75,7 +75,7 @@
 #include "opt_gateway.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.15 2022/02/12 15:51:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.16 2022/02/12 16:21:27 thorpej Exp $");
 #endif
 
 #include <sys/param.h>
@@ -203,6 +203,11 @@
 #define XMM_KQ_ISFD_INITIALIZER                .f_flags = FILTEROP_ISFD
 #endif /* OpenBSD <= 201911 */
 
+#define        selrecord_knote(si, kn)                                         \
+       klist_insert(&(si)->si_note, (kn))
+#define        selremove_knote(si, kn)                                         \
+       klist_remove(&(si)->si_note, (kn))
+
 #endif
 
 #ifdef __NetBSD__
@@ -257,7 +262,6 @@
 #define if_ih_remove(ifp, func, arg)   /* nothing to do */
 #define if_hardmtu                     if_mtu
 #define IF_OUTPUT_CONST                        const
-#define si_note                                sel_klist
 #define XMM_KQ_ISFD_INITIALIZER                .f_flags = FILTEROP_ISFD
 #define tty_lock()                     mutex_spin_enter(&tty_lock)
 #define tty_unlock()                   mutex_spin_exit(&tty_lock)
@@ -2750,7 +2754,7 @@
        struct queue_pair *qp = (struct queue_pair *)kn->kn_hook;
 
        tty_lock();
-       klist_remove(&qp->selr.si_note, kn);
+       selremove_knote(&qp->selr, kn);
        tty_unlock();
 }
 
@@ -2777,7 +2781,7 @@
        struct queue_pair *qp = (struct queue_pair *)kn->kn_hook;
 
        tty_lock();
-       klist_remove(&qp->selw.si_note, kn);
+       selremove_knote(&qp->selw, kn);
        tty_unlock();
 }
 
@@ -2816,7 +2820,7 @@
        struct wwanc_softc *sc = device_lookup_private(&wwanc_cd, DEVUNIT(dev));
        int func = DEVFUNC(dev);
        struct queue_pair *qp = &sc->sc_xmm.qp[func];
-       struct klist *klist;
+       struct selinfo *si;
 
        if (DEV_IS_TTY(func))
                return ttkqfilter(dev, kn);
@@ -2825,11 +2829,11 @@
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &qp->selr.si_note;
+               si = &qp->selr;
                kn->kn_fop = &wwancread_filtops;
                break;
        case EVFILT_WRITE:
-               klist = &qp->selw.si_note;
+               si = &qp->selw;
                kn->kn_fop = &wwancwrite_filtops;
                break;
        default:
@@ -2839,7 +2843,7 @@
        kn->kn_hook = (void *)qp;
 
        tty_lock();
-       klist_insert(klist, kn);
+       selrecord_knote(si, kn);
        tty_unlock();
 
        return (0);



Home | Main Index | Thread Index | Old Index