Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Tweak locking rule. Fix broken unlocked rmw.
details: https://anonhg.NetBSD.org/src/rev/f8a93a139304
branches: trunk
changeset: 353013:f8a93a139304
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Apr 17 09:16:13 2017 +0000
description:
Tweak locking rule. Fix broken unlocked rmw.
diffstat:
sys/dev/usb/ualea.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diffs (39 lines):
diff -r 3b92fdf56b40 -r f8a93a139304 sys/dev/usb/ualea.c
--- a/sys/dev/usb/ualea.c Mon Apr 17 09:06:55 2017 +0000
+++ b/sys/dev/usb/ualea.c Mon Apr 17 09:16:13 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ualea.c,v 1.1 2017/04/17 08:59:37 riastradh Exp $ */
+/* $NetBSD: ualea.c,v 1.2 2017/04/17 09:16:13 riastradh Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.1 2017/04/17 08:59:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.2 2017/04/17 09:16:13 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -55,11 +55,7 @@
struct usbd_xfer *sc_xfer;
bool sc_attached:1;
bool sc_inflight:1;
- /*
- * attached true->false only under lock
- * inflight false->true only under lock
- * issue xfer only under lock, if attached=true and inflight=false
- */
+ /* lock covers sc_attached, sc_inflight, and usbd_transfer(sc_xfer) */
};
static int ualea_match(device_t, cfdata_t, void *);
@@ -228,5 +224,7 @@
out:
/* Allow subsequent transfers. */
+ mutex_enter(&sc->sc_lock);
sc->sc_inflight = false;
+ mutex_exit(&sc->sc_lock);
}
Home |
Main Index |
Thread Index |
Old Index