Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Don't rely on TS_BUSY to determine wether there ...
details: https://anonhg.NetBSD.org/src/rev/3e13c4c0e5dc
branches: trunk
changeset: 782119:3e13c4c0e5dc
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Wed Oct 17 17:05:15 2012 +0000
description:
Don't rely on TS_BUSY to determine wether there is a buffer
available. Instead handle a possible buffer shortage.
Also aquire lock when modifying t_state.
diffstat:
sys/dev/usb/ucom.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r 2830ec64b257 -r 3e13c4c0e5dc sys/dev/usb/ucom.c
--- a/sys/dev/usb/ucom.c Wed Oct 17 16:16:23 2012 +0000
+++ b/sys/dev/usb/ucom.c Wed Oct 17 17:05:15 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.99 2012/03/06 03:35:29 mrg Exp $ */
+/* $NetBSD: ucom.c,v 1.100 2012/10/17 17:05:15 mlelstv Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.99 2012/03/06 03:35:29 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.100 2012/10/17 17:05:15 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1002,7 +1002,10 @@
goto out;
ub = SIMPLEQ_FIRST(&sc->sc_obuff_free);
- KASSERT(ub != NULL);
+ if (ub == NULL) {
+ SET(tp->t_state, TS_BUSY);
+ goto out;
+ }
SIMPLEQ_REMOVE_HEAD(&sc->sc_obuff_free, ub_link);
if (SIMPLEQ_FIRST(&sc->sc_obuff_free) == NULL)
@@ -1070,11 +1073,13 @@
SIMPLEQ_INSERT_TAIL(&sc->sc_obuff_free, ub, ub_link);
cc -= sc->sc_opkthdrlen;
+ mutex_spin_enter(&tty_lock);
CLR(tp->t_state, TS_BUSY);
if (ISSET(tp->t_state, TS_FLUSH))
CLR(tp->t_state, TS_FLUSH);
else
ndflush(&tp->t_outq, cc);
+ mutex_spin_exit(&tty_lock);
if (err != USBD_CANCELLED && err != USBD_IOERROR &&
!sc->sc_dying) {
Home |
Main Index |
Thread Index |
Old Index