Change the kernel dev_t, representing a pointer to a specinfo structure,
[dragonfly.git] / sys / dev / serial / stl / stallion.c
index 0952a65..1ade64b 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/isa/stallion.c,v 1.39.2.2 2001/08/30 12:29:57 murray Exp $
- * $DragonFly: src/sys/dev/serial/stl/stallion.c,v 1.14 2005/06/16 21:12:42 dillon Exp $
+ * $DragonFly: src/sys/dev/serial/stl/stallion.c,v 1.21 2006/09/10 01:26:37 dillon Exp $
  */
 
 /*****************************************************************************/
@@ -483,7 +483,7 @@ STATIC      d_ioctl_t       stlioctl;
 /*
  *     Internal function prototypes.
  */
-static stlport_t *stl_dev2port(dev_t dev);
+static stlport_t *stl_dev2port(cdev_t dev);
 static int     stl_findfreeunit(void);
 static int     stl_rawopen(stlport_t *portp);
 static int     stl_rawclose(stlport_t *portp);
@@ -506,13 +506,13 @@ static void       stl_echatintr(stlbrd_t *brdp);
 static void    stl_echmcaintr(stlbrd_t *brdp);
 static void    stl_echpciintr(stlbrd_t *brdp);
 static void    stl_echpci64intr(stlbrd_t *brdp);
-static int     stl_memioctl(dev_t dev, unsigned long cmd, caddr_t data,
-                       int flag, struct thread *td);
+static int     stl_memioctl(cdev_t dev, unsigned long cmd, caddr_t data,
+                       int flag);
 static int     stl_getbrdstats(caddr_t data);
 static int     stl_getportstats(stlport_t *portp, caddr_t data);
 static int     stl_clrportstats(stlport_t *portp, caddr_t data);
 static stlport_t *stl_getport(int brdnr, int panelnr, int portnr);
-static ointhand2_t     stlintr;
+static void    stlintr(void *);
 
 #if NPCI > 0
 static const char *stlpciprobe(pcici_t tag, pcidi_t type);
@@ -748,24 +748,15 @@ COMPAT_PCI_DRIVER (stlpci, stlpcidriver);
  */
 
 #define        CDEV_MAJOR      72
-static struct cdevsw stl_cdevsw = {
-       /* name */      "stl",
-       /* maj */       CDEV_MAJOR,
-       /* flags */     D_TTY | D_KQFILTER,
-       /* port */      NULL,
-       /* clone */     NULL,
-
-       /* open */      stlopen,
-       /* close */     stlclose,
-       /* read */      ttyread,
-       /* write */     ttywrite,
-       /* ioctl */     stlioctl,
-       /* poll */      ttypoll,
-       /* mmap */      nommap,
-       /* strategy */  nostrategy,
-       /* dump */      nodump,
-       /* psize */     nopsize,
-       /* kqfilter */  ttykqfilter
+static struct dev_ops stl_ops = {
+       { "stl", CDEV_MAJOR, D_TTY | D_KQFILTER },
+       .d_open =       stlopen,
+       .d_close =      stlclose,
+       .d_read =       ttyread,
+       .d_write =      ttywrite,
+       .d_ioctl =      stlioctl,
+       .d_poll =       ttypoll,
+       .d_kqfilter =   ttykqfilter
 };
 
 static void stl_drvinit(void *unused)
@@ -853,9 +844,9 @@ static int stlattach(struct isa_device *idp)
                idp->id_unit, idp->id_iobase);
 #endif
 
-/*     idp->id_ointr = stlintr; */
+/*     idp->id_intr = (inthand2_t *)stlintr; */
 
-       brdp = malloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO);
+       brdp = kmalloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO);
 
        if ((brdp->brdnr = stl_findfreeunit()) < 0) {
                printf("STALLION: too many boards found, max=%d\n",
@@ -875,95 +866,95 @@ static int stlattach(struct isa_device *idp)
 
        /* register devices for DEVFS */
        boardnr = brdp->brdnr;
-       cdevsw_add(&stl_cdevsw, 31, boardnr);
-       make_dev(&stl_cdevsw, boardnr + 0x1000000, UID_ROOT, GID_WHEEL,
+       dev_ops_add(&stl_ops, 31, boardnr);
+       make_dev(&stl_ops, boardnr + 0x1000000, UID_ROOT, GID_WHEEL,
                 0600, "staliomem%d", boardnr);
 
        for (portnr = 0, minor_dev = boardnr * 0x100000;
              portnr < 32; portnr++, minor_dev++) {
                /* hw ports */
-               make_dev(&stl_cdevsw, minor_dev,
+               make_dev(&stl_ops, minor_dev,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 32,
+               make_dev(&stl_ops, minor_dev + 32,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyiE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 64,
+               make_dev(&stl_ops, minor_dev + 64,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttylE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 128,
+               make_dev(&stl_ops, minor_dev + 128,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cue%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 160,
+               make_dev(&stl_ops, minor_dev + 160,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cuie%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 192,
+               make_dev(&stl_ops, minor_dev + 192,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cule%d", portnr + (boardnr * 64));
 
                /* sw ports */
-               make_dev(&stl_cdevsw, minor_dev + 0x10000,
+               make_dev(&stl_ops, minor_dev + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 32 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 32 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyiE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 64 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 64 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttylE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 128 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 128 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cue%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 160 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 160 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cuie%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 192 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 192 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cule%d", portnr + (boardnr * 64) + 32);
        }
        boardnr = brdp->brdnr;
-       make_dev(&stl_cdevsw, boardnr + 0x1000000, UID_ROOT, GID_WHEEL,
+       make_dev(&stl_ops, boardnr + 0x1000000, UID_ROOT, GID_WHEEL,
                 0600, "staliomem%d", boardnr);
 
        for (portnr = 0, minor_dev = boardnr * 0x100000;
              portnr < 32; portnr++, minor_dev++) {
                /* hw ports */
-               make_dev(&stl_cdevsw, minor_dev,
+               make_dev(&stl_ops, minor_dev,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 32,
+               make_dev(&stl_ops, minor_dev + 32,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyiE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 64,
+               make_dev(&stl_ops, minor_dev + 64,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttylE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 128,
+               make_dev(&stl_ops, minor_dev + 128,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cue%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 160,
+               make_dev(&stl_ops, minor_dev + 160,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cuie%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 192,
+               make_dev(&stl_ops, minor_dev + 192,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cule%d", portnr + (boardnr * 64));
 
                /* sw ports */
-               make_dev(&stl_cdevsw, minor_dev + 0x10000,
+               make_dev(&stl_ops, minor_dev + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 32 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 32 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyiE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 64 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 64 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttylE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 128 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 128 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cue%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 160 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 160 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cuie%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 192 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 192 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cule%d", portnr + (boardnr * 64) + 32);
        }
@@ -1026,7 +1017,7 @@ void stlpciattach(pcici_t tag, int unit)
        printf("stlpciattach(tag=%x,unit=%x)\n", (int) &tag, unit);
 #endif
 
-       brdp = malloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO);
+       brdp = kmalloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO);
 
        if ((unit < 0) || (unit > STL_MAXBRDS)) {
                printf("STALLION: bad PCI board unit number=%d\n", unit);
@@ -1097,48 +1088,48 @@ void stlpciattach(pcici_t tag, int unit)
 
        /* register devices for DEVFS */
        boardnr = brdp->brdnr;
-       make_dev(&stl_cdevsw, boardnr + 0x1000000, UID_ROOT, GID_WHEEL,
+       make_dev(&stl_ops, boardnr + 0x1000000, UID_ROOT, GID_WHEEL,
                 0600, "staliomem%d", boardnr);
 
        for (portnr = 0, minor_dev = boardnr * 0x100000;
              portnr < 32; portnr++, minor_dev++) {
                /* hw ports */
-               make_dev(&stl_cdevsw, minor_dev,
+               make_dev(&stl_ops, minor_dev,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 32,
+               make_dev(&stl_ops, minor_dev + 32,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyiE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 64,
+               make_dev(&stl_ops, minor_dev + 64,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttylE%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 128,
+               make_dev(&stl_ops, minor_dev + 128,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cue%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 160,
+               make_dev(&stl_ops, minor_dev + 160,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cuie%d", portnr + (boardnr * 64));
-               make_dev(&stl_cdevsw, minor_dev + 192,
+               make_dev(&stl_ops, minor_dev + 192,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cule%d", portnr + (boardnr * 64));
 
                /* sw ports */
-               make_dev(&stl_cdevsw, minor_dev + 0x10000,
+               make_dev(&stl_ops, minor_dev + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 32 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 32 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttyiE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 64 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 64 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "ttylE%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 128 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 128 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cue%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 160 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 160 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cuie%d", portnr + (boardnr * 64) + 32);
-               make_dev(&stl_cdevsw, minor_dev + 192 + 0x10000,
+               make_dev(&stl_ops, minor_dev + 192 + 0x10000,
                         UID_ROOT, GID_WHEEL, 0600,
                         "cule%d", portnr + (boardnr * 64) + 32);
        }
@@ -1148,8 +1139,9 @@ void stlpciattach(pcici_t tag, int unit)
 
 /*****************************************************************************/
 
-STATIC int stlopen(dev_t dev, int flag, int mode, struct thread *td)
+STATIC int stlopen(struct dev_open_args *ap)
 {
+       cdev_t dev = ap->a_head.a_dev;
        struct tty      *tp;
        stlport_t       *portp;
        int             error, callout;
@@ -1211,7 +1203,7 @@ stlopen_restart:
                        }
                } else {
                        if (portp->callout != 0) {
-                               if (flag & O_NONBLOCK) {
+                               if (ap->a_oflags & O_NONBLOCK) {
                                        error = EBUSY;
                                        goto stlopen_end;
                                }
@@ -1222,7 +1214,7 @@ stlopen_restart:
                                goto stlopen_restart;
                        }
                }
-               if ((tp->t_state & TS_XCLUDE) && suser(td)) {
+               if ((tp->t_state & TS_XCLUDE) && suser_cred(ap->a_cred, 0)) {
                        error = EBUSY;
                        goto stlopen_end;
                }
@@ -1234,7 +1226,7 @@ stlopen_restart:
  */
        if (((tp->t_state & TS_CARR_ON) == 0) && !callout &&
                        ((tp->t_cflag & CLOCAL) == 0) &&
-                       ((flag & O_NONBLOCK) == 0)) {
+                       ((ap->a_oflags & O_NONBLOCK) == 0)) {
                portp->waitopens++;
                error = tsleep(TSA_CARR_ON(tp), PCATCH, "stldcd", 0);
                portp->waitopens--;
@@ -1266,8 +1258,9 @@ stlopen_end:
 
 /*****************************************************************************/
 
-STATIC int stlclose(dev_t dev, int flag, int mode, struct thread *td)
+STATIC int stlclose(struct dev_close_args *ap)
 {
+       cdev_t dev = ap->a_head.a_dev;
        struct tty      *tp;
        stlport_t       *portp;
 
@@ -1287,7 +1280,7 @@ STATIC int stlclose(dev_t dev, int flag, int mode, struct thread *td)
        tp = &portp->tty;
 
        crit_enter();
-       (*linesw[tp->t_line].l_close)(tp, flag);
+       (*linesw[tp->t_line].l_close)(tp, ap->a_fflag);
        stl_ttyoptim(portp, &tp->t_termios);
        stl_rawclose(portp);
        ttyclose(tp);
@@ -1324,21 +1317,23 @@ STATIC int stlstop(struct tty *tp, int rw)
 
 /*****************************************************************************/
 
-STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
-                   struct thread *td)
+STATIC int stlioctl(struct dev_ioctl_args *ap)
 {
+       cdev_t dev = ap->a_head.a_dev;
+       u_long cmd = ap->a_cmd;
+       caddr_t data = ap->a_data;
        struct termios  *newtios, *localtios;
        struct tty      *tp;
        stlport_t       *portp;
        int             error, i;
 
 #if STLDEBUG
-       printf("stlioctl(dev=%s,cmd=%lx,data=%p,flag=%x,p=%p)\n",
-               devtoname(dev), cmd, (void *) data, flag, (void *) p);
+       printf("stlioctl(dev=%s,cmd=%lx,data=%p,flag=%x)\n",
+               devtoname(dev), cmd, (void *) data, ap->a_fflag);
 #endif
 
        if (minor(dev) & STL_MEMDEV)
-               return(stl_memioctl(dev, cmd, data, flag, td));
+               return(stl_memioctl(dev, cmd, data, ap->a_fflag));
 
        portp = stl_dev2port(dev);
        if (portp == (stlport_t *) NULL)
@@ -1361,7 +1356,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
 
                switch (cmd) {
                case TIOCSETA:
-                       if ((error = suser(td)) == 0)
+                       if ((error = suser_cred(ap->a_cred, 0)) == 0)
                                *localtios = *((struct termios *) data);
                        break;
                case TIOCGETA:
@@ -1428,12 +1423,13 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
  *     Call the line discipline and the common command processing to
  *     process this command (if they can).
  */
-       error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
+       error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data,
+                                             ap->a_fflag, ap->a_cred);
        if (error != ENOIOCTL)
                return(error);
 
        crit_enter();
-       error = ttioctl(tp, cmd, data, flag);
+       error = ttioctl(tp, cmd, data, ap->a_fflag);
        stl_ttyoptim(portp, &tp->t_termios);
        if (error != ENOIOCTL) {
                crit_exit();
@@ -1479,7 +1475,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
                *((int *) data) = (stl_getsignals(portp) | TIOCM_LE);
                break;
        case TIOCMSDTRWAIT:
-               if ((error = suser(td)) == 0)
+               if ((error = suser_cred(ap->a_cred, 0)) == 0)
                        portp->dtrwait = *((int *) data) * hz / 100;
                break;
        case TIOCMGDTRWAIT:
@@ -1504,7 +1500,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
  *     pointer. Return NULL if the device number is not a valid port.
  */
 
-STATIC stlport_t *stl_dev2port(dev_t dev)
+STATIC stlport_t *stl_dev2port(cdev_t dev)
 {
        stlbrd_t        *brdp;
 
@@ -1760,13 +1756,13 @@ static void stl_flush(stlport_t *portp, int flag)
  *      are vectored through here.
  */
 
-void stlintr(int unit)
+void stlintr(void *arg)
 {
         stlbrd_t        *brdp;
         int             i;
 
 #if STLDEBUG
-        printf("stlintr(unit=%d)\n", unit);
+       printf("stlintr(unit=%d)\n", (int)arg);
 #endif
 
         for (i = 0; (i < stl_nrbrds); i++) {
@@ -1784,7 +1780,7 @@ void stlintr(int unit)
 
 static void stlpciintr(void *arg)
 {
-       stlintr(0);
+       stlintr((void *)0);
 }
 
 #endif
@@ -2206,7 +2202,7 @@ static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp)
  *      UART port.
  */
         for (i = 0; (i < panelp->nrports); i++) {
-                portp = malloc(sizeof(stlport_t), M_TTYS, M_WAITOK | M_ZERO);
+                portp = kmalloc(sizeof(stlport_t), M_TTYS, M_WAITOK | M_ZERO);
 
                 portp->portnr = i;
                 portp->brdnr = panelp->brdnr;
@@ -2216,7 +2212,7 @@ static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp)
                 panelp->ports[i] = portp;
 
                 j = STL_TXBUFSIZE + (2 * STL_RXBUFSIZE);
-                portp->tx.buf = malloc(j, M_TTYS, M_WAITOK);
+                portp->tx.buf = kmalloc(j, M_TTYS, M_WAITOK);
                 portp->tx.endbuf = portp->tx.buf + STL_TXBUFSIZE;
                 portp->tx.head = portp->tx.buf;
                 portp->tx.tail = portp->tx.buf;
@@ -2318,7 +2314,7 @@ static int stl_initeio(stlbrd_t *brdp)
                        ((brdp->irqtype) ? EIO_INTLEVEL : EIO_INTEDGE)));
        }
 
-       panelp = malloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO);
+       panelp = kmalloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO);
        panelp->brdnr = brdp->brdnr;
        panelp->panelnr = 0;
        panelp->nrports = brdp->nrports;
@@ -2440,7 +2436,7 @@ static int stl_initech(stlbrd_t *brdp)
                status = inb(ioaddr + ECH_PNLSTATUS);
                if ((status & ECH_PNLIDMASK) != nxtid)
                        break;
-               panelp = malloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO);
+               panelp = kmalloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO);
                panelp->brdnr = brdp->brdnr;
                panelp->panelnr = panelnr;
                panelp->iobase = ioaddr;
@@ -2600,7 +2596,7 @@ static int stl_getbrdstats(caddr_t data)
                stl_brdstats.panels[i].nrports = panelp->nrports;
        }
 
-       *((combrd_t *) data) = stl_brdstats;;
+       *((combrd_t *) data) = stl_brdstats;
        return(0);
 }
 
@@ -2705,8 +2701,7 @@ static int stl_clrportstats(stlport_t *portp, caddr_t data)
  *     The "staliomem" device is used for stats collection in this driver.
  */
 
-static int stl_memioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
-                       struct thread *td)
+static int stl_memioctl(cdev_t dev, unsigned long cmd, caddr_t data, int flag)
 {
        int             rc;