Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nick-nhusb]: src/sys/dev/usb Allow sleeping in usb_block_allocmem - we'r...
details: https://anonhg.NetBSD.org/src/rev/cf547b6436d8
branches: nick-nhusb
changeset: 334313:cf547b6436d8
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Nov 10 13:41:49 2015 +0000
description:
Allow sleeping in usb_block_allocmem - we're nearly there in the HCDs
diffstat:
sys/dev/usb/usb_mem.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (62 lines):
diff -r 7a60e3172af8 -r cf547b6436d8 sys/dev/usb/usb_mem.c
--- a/sys/dev/usb/usb_mem.c Tue Nov 10 08:44:09 2015 +0000
+++ b/sys/dev/usb/usb_mem.c Tue Nov 10 13:41:49 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_mem.c,v 1.65.2.10 2015/09/29 11:38:29 skrll Exp $ */
+/* $NetBSD: usb_mem.c,v 1.65.2.11 2015/11/10 13:41:49 skrll Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.65.2.10 2015/09/29 11:38:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.65.2.11 2015/11/10 13:41:49 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -137,6 +137,8 @@
}
DPRINTFN(6, "no free", 0, 0, 0, 0);
+ mutex_exit(&usb_blk_lock);
+
b = kmem_zalloc(sizeof(*b), KM_SLEEP);
if (b == NULL)
return USBD_NOMEM;
@@ -160,22 +162,22 @@
error = bus_dmamem_alloc(tag, b->size, align, 0,
b->segs, b->nsegs,
- &b->nsegs, BUS_DMA_NOWAIT);
+ &b->nsegs, BUS_DMA_WAITOK);
if (error)
goto free0;
error = bus_dmamem_map(tag, b->segs, b->nsegs, b->size,
- &b->kaddr, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
+ &b->kaddr, BUS_DMA_WAITOK|BUS_DMA_COHERENT);
if (error)
goto free1;
error = bus_dmamap_create(tag, b->size, b->nsegs, b->size,
- 0, BUS_DMA_NOWAIT, &b->map);
+ 0, BUS_DMA_WAITOK, &b->map);
if (error)
goto unmap;
error = bus_dmamap_load(tag, b->map, b->kaddr, b->size, NULL,
- BUS_DMA_NOWAIT);
+ BUS_DMA_WAITOK);
if (error)
goto destroy;
@@ -183,6 +185,7 @@
#ifdef USB_FRAG_DMA_WORKAROUND
memset(b->kaddr, 0, b->size);
#endif
+ mutex_enter(&usb_blk_lock);
return USBD_NORMAL_COMPLETION;
Home |
Main Index |
Thread Index |
Old Index