Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wscons Don't abuse config_interrupts()'s first argum...



details:   https://anonhg.NetBSD.org/src/rev/cac4ba7fa115
branches:  trunk
changeset: 446335:cac4ba7fa115
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sat Dec 01 00:28:45 2018 +0000

description:
Don't abuse config_interrupts()'s first argument. Use kthread instead of
config_interrupt(). OK'd by jmcneill and macallan.

diffstat:

 sys/dev/wscons/wsdisplay_vcons.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r ce91018aff0a -r cac4ba7fa115 sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c  Fri Nov 30 23:48:14 2018 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c  Sat Dec 01 00:28:45 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vcons.c,v 1.38 2017/06/02 19:33:51 macallan Exp $ */
+/*     $NetBSD: wsdisplay_vcons.c,v 1.39 2018/12/01 00:28:45 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.38 2017/06/02 19:33:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.39 2018/12/01 00:28:45 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -121,7 +121,7 @@
 #ifdef VCONS_DRAW_INTR
 static void vcons_intr(void *);
 static void vcons_softintr(void *);
-static void vcons_intr_enable(device_t);
+static void vcons_init_thread(void *);
 #endif
 
 int
@@ -180,8 +180,11 @@
        callout_setfunc(&vd->intr, vcons_intr, vd);
        vd->intr_valid = 1;
 
-       /* XXX assume that the 'dev' arg is never dereferenced */
-       config_interrupts((device_t)vd, vcons_intr_enable);
+       if (kthread_create(PRI_NONE, 0, NULL, vcons_init_thread, vd, NULL,
+           "vcons_init") != 0) {
+               printf("%s: unable to create thread.\n", __func__);
+               return -1;
+       }
 #endif
        return 0;
 }
@@ -1456,12 +1459,13 @@
 }
 
 static void
-vcons_intr_enable(device_t dev)
+vcons_init_thread(void *cookie)
 {
-       /* the 'dev' arg we pass to config_interrupts isn't a device_t */
-       struct vcons_data *vd = (struct vcons_data *)dev;
+       struct vcons_data *vd = (struct vcons_data *)cookie;
+
        vd->use_intr = 2;
        callout_schedule(&vd->intr, mstohz(33));
+       kthread_exit(0);
 }
 #endif /* VCONS_DRAW_INTR */
 



Home | Main Index | Thread Index | Old Index