summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-10-15 03:44:56 +0000
committerkan <kan@FreeBSD.org>2004-10-15 03:44:56 +0000
commit00b5d02fd05a3ab00d0b5fcbda7f7ae0eb19e180 (patch)
treedc78e28739b69803e96cd9a4ac679d35c9b8efe4
parent4198799468acb64883b6ff065fcc61200469454a (diff)
downloadFreeBSD-src-00b5d02fd05a3ab00d0b5fcbda7f7ae0eb19e180.zip
FreeBSD-src-00b5d02fd05a3ab00d0b5fcbda7f7ae0eb19e180.tar.gz
Use a taskqueue rather than an swi to handle deferred notifications.
Obtained from: same change for umct(4) driver.
-rw-r--r--sys/dev/usb/ubsa.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c
index 7eaed2d..6fe6dc8 100644
--- a/sys/dev/usb/ubsa.c
+++ b/sys/dev/usb/ubsa.c
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/ioccom.h>
#include <sys/fcntl.h>
-#include <sys/interrupt.h>
+#include <sys/taskqueue.h>
#include <sys/conf.h>
#include <sys/tty.h>
#include <sys/file.h>
@@ -178,13 +178,11 @@ struct ubsa_softc {
u_char sc_lsr; /* Local status register */
u_char sc_msr; /* ubsa status register */
-#if __FreeBSD_version >= 500000
- void *sc_swicookie;
-#endif
+ struct task sc_task;
};
Static void ubsa_intr(usbd_xfer_handle, usbd_private_handle, usbd_status);
-Static void ubsa_notify(void *);
+Static void ubsa_notify(void *, int count);
Static void ubsa_get_status(void *, int, u_char *, u_char *);
Static void ubsa_set(void *, int, int, int);
@@ -252,10 +250,6 @@ MODULE_DEPEND(ubsa, usb, 1, 1, 1);
MODULE_DEPEND(ubsa, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
MODULE_VERSION(ubsa, UBSA_MODVER);
-#if __FreeBSD_version >= 500000
-static struct ithd *ucom_ithd;
-#endif
-
USB_MATCH(ubsa)
{
USB_MATCH_START(ubsa, uaa);
@@ -410,11 +404,7 @@ USB_ATTACH(ubsa)
DPRINTF(("ubsa: in = 0x%x, out = 0x%x, intr = 0x%x\n",
ucom->sc_bulkin_no, ucom->sc_bulkout_no, sc->sc_intr_number));
-#if __FreeBSD_version >= 500000
- swi_add(&ucom_ithd, "ucom", ubsa_notify, sc, SWI_TTY, 0,
- &sc->sc_swicookie);
-#endif
-
+ TASK_INIT(&sc->sc_task, 0, ubsa_notify, sc);
ucom_attach(ucom);
free(devinfo, M_USBDEV);
@@ -441,12 +431,10 @@ USB_DETACH(ubsa)
}
sc->sc_ucom.sc_dying = 1;
-
- rv = ucom_detach(&sc->sc_ucom);
-
-#if __FreeBSD_version >= 500000
- ithread_remove_handler(sc->sc_swicookie);
+#if 0
+ taskqueue_drain(taskqueue_swi_giant);
#endif
+ rv = ucom_detach(&sc->sc_ucom);
return (rv);
}
@@ -739,16 +727,12 @@ ubsa_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
DPRINTF(("%s: ubsa lsr = 0x%02x, msr = 0x%02x\n",
USBDEVNAME(sc->sc_ucom.sc_dev), sc->sc_lsr, sc->sc_msr));
-#if __FreeBSD_version >= 500000
- swi_sched(sc->sc_swicookie, 0);
-#else
- ubsa_notify(sc);
-#endif
+ taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task);
}
/* Handle delayed events. */
Static void
-ubsa_notify(void *arg)
+ubsa_notify(void *arg, int count)
{
struct ubsa_softc *sc;
OpenPOWER on IntegriCloud