kernel - Remove D_KQFILTER flag
[dragonfly.git] / sys / net / i4b / driver / i4b_rbch.c
index 651eb5b..c4ec9cf 100644 (file)
@@ -60,7 +60,6 @@
 #include "../include/i4b_l3l4.h"
 #include "../layer4/i4b_l4.h"
 
-#include <sys/poll.h>
 #include <sys/event.h>
 #include <sys/filio.h>
 
@@ -91,7 +90,7 @@ static struct rbch_softc {
        struct ifqueue sc_hdlcq;        /* hdlc read queue      */
 #define I4BRBCHMAXQLEN 10
 
-       struct selinfo selp;            /* select / poll        */
+       struct kqinfo kqp;              /* select / poll / kevent */
 
 #if I4BRBCHACCT
        struct callout  sc_timeout;
@@ -125,19 +124,15 @@ PDEVSTATIC void i4brbchkfilt_detach(struct knote *);
 PDEVSTATIC int i4brbchkfilt_read(struct knote *, long);
 PDEVSTATIC int i4brbchkfilt_write(struct knote *, long);
 
-PDEVSTATIC d_poll_t i4brbchpoll;
-#define POLLFIELD      i4brbchpoll
-
 #define CDEV_MAJOR 57
 
 static struct dev_ops i4brbch_ops = {
-       { "i4brbch", CDEV_MAJOR, D_KQFILTER },
+       { "i4brbch", CDEV_MAJOR, 0 },
        .d_open =       i4brbchopen,
        .d_close =      i4brbchclose,
        .d_read =       i4brbchread,
        .d_write =      i4brbchwrite,
        .d_ioctl =      i4brbchioctl,
-       .d_poll =       POLLFIELD,
        .d_kqfilter =   i4brbchkqfilter
 };
 
@@ -536,63 +531,10 @@ i4brbchioctl(struct dev_ioctl_args *ap)
 /*---------------------------------------------------------------------------*
  *     device driver poll
  *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4brbchpoll(struct dev_poll_args *ap)
-{
-       cdev_t dev = ap->a_head.a_dev;
-       int revents = 0;        /* Events we found */
-       int unit = minor(dev);
-       struct rbch_softc *sc = &rbch_softc[unit];
-       
-       /* We can't check for anything but IN or OUT */
-       crit_enter();
-
-       if(!(sc->sc_devstate & ST_ISOPEN))
-       {
-               crit_exit();
-               return(POLLNVAL);
-       }
-
-       /*
-        * Writes are OK if we are connected and the
-         * transmit queue can take them
-        */
-        
-       if((ap->a_events & (POLLOUT|POLLWRNORM)) &&
-          (sc->sc_devstate & ST_CONNECTED) &&
-          !IF_QFULL(isdn_linktab[unit]->tx_queue))
-       {
-               revents |= (ap->a_events & (POLLOUT|POLLWRNORM));
-       }
-       
-       /* ... while reads are OK if we have any data */
-
-       if((ap->a_events & (POLLIN|POLLRDNORM)) &&
-          (sc->sc_devstate & ST_CONNECTED))
-       {
-               struct ifqueue *iqp;
-
-               if(sc->sc_bprot == BPROT_RHDLC)
-                       iqp = &sc->sc_hdlcq;
-               else
-                       iqp = isdn_linktab[unit]->rx_queue;     
-
-               if(!IF_QEMPTY(iqp))
-                       revents |= (ap->a_events & (POLLIN|POLLRDNORM));
-       }
-               
-       if(revents == 0)
-               selrecord(curthread, &sc->selp);
-
-       crit_exit();
-       ap->a_events = revents;
-       return (0);
-}
-
 static struct filterops i4brbchkfiltops_read =
-       { 1, NULL, i4brbchkfilt_detach, i4brbchkfilt_read };
+       { FILTEROP_ISFD, NULL, i4brbchkfilt_detach, i4brbchkfilt_read };
 static struct filterops i4brbchkfiltops_write =
-       { 1, NULL, i4brbchkfilt_detach, i4brbchkfilt_write };
+       { FILTEROP_ISFD, NULL, i4brbchkfilt_detach, i4brbchkfilt_write };
 
 PDEVSTATIC int
 i4brbchkqfilter(struct dev_kqfilter_args *ap)
@@ -619,10 +561,8 @@ i4brbchkqfilter(struct dev_kqfilter_args *ap)
                return (0);
        }
 
-       crit_enter();
-       klist = &sc->selp.si_note;
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
-       crit_exit();
+       klist = &sc->kqp.ki_note;
+       knote_insert(klist, kn);
 
        return (0);
 }
@@ -635,10 +575,8 @@ i4brbchkfilt_detach(struct knote *kn)
        struct rbch_softc *sc = &rbch_softc[unit];
        struct klist *klist;
 
-       crit_enter();
-       klist = &sc->selp.si_note;
-       SLIST_REMOVE(klist, kn, knote, kn_selnext);
-       crit_exit();
+       klist = &sc->kqp.ki_note;
+       knote_remove(klist, kn);
 }
 
 PDEVSTATIC int
@@ -870,7 +808,7 @@ rbch_rx_data_rdy(int unit)
        {
                NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
        }
-       selwakeup(&rbch_softc[unit].selp);
+       KNOTE(&rbch_softc[unit].kqp.ki_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
@@ -891,7 +829,7 @@ rbch_tx_queue_empty(int unit)
        {
                NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
        }
-       selwakeup(&rbch_softc[unit].selp);
+       KNOTE(&rbch_softc[unit].kqp.ki_note, 0);
 }
 
 /*---------------------------------------------------------------------------*
@@ -903,7 +841,7 @@ rbch_activity(int unit, int rxtx)
 {
        if (rbch_softc[unit].sc_cd)
                rbch_softc[unit].sc_cd->last_active_time = SECOND;
-       selwakeup(&rbch_softc[unit].selp);
+       KNOTE(&rbch_softc[unit].kqp.ki_note, 0);
 }
 
 /*---------------------------------------------------------------------------*