summaryrefslogtreecommitdiff
path: root/sys/arch/socppc/dev/wdc_mainbus.c
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2011-05-09 22:33:55 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2011-05-09 22:33:55 +0000
commit15cd6a42ff78f176a0db39dfa7401274f1792bfc (patch)
tree69a950d47edcd44df04df75de2fe47d28c886f8c /sys/arch/socppc/dev/wdc_mainbus.c
parenta9b23f00f1cdf8ec5565371412b53af1247703da (diff)
Refactor queue allocation and initialization into a wdc_alloc_queue()
function, and let attachment code calls this rather than malloc(9). This prevents re-initialization of the queue in shared queue chipsets. Also, add wdc_free_queue() as a complementary function. Earlier version (without wdc_free_queue()) tested by sthen@ and Amit Kulkarni on various pciide(4) chips. ok dlg@
Diffstat (limited to 'sys/arch/socppc/dev/wdc_mainbus.c')
-rw-r--r--sys/arch/socppc/dev/wdc_mainbus.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/arch/socppc/dev/wdc_mainbus.c b/sys/arch/socppc/dev/wdc_mainbus.c
index 68d48d28000..dfe3470ed37 100644
--- a/sys/arch/socppc/dev/wdc_mainbus.c
+++ b/sys/arch/socppc/dev/wdc_mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc_mainbus.c,v 1.1 2009/09/06 20:09:34 kettenis Exp $ */
+/* $OpenBSD: wdc_mainbus.c,v 1.2 2011/05/09 22:33:54 matthew Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
@@ -132,10 +132,9 @@ wdc_mainbus_attach(struct device *parent, struct device *self, void *aux)
chp->channel = 0;
chp->wdc = &sc->sc_wdcdev;
- chp->ch_queue = malloc(sizeof(struct channel_queue), M_DEVBUF,
- M_NOWAIT);
+ chp->ch_queue = wdc_alloc_queue();
if (chp->ch_queue == NULL) {
- printf("%s: can't allocate memory for command queue\n",
+ printf("%s: cannot allocate channel queue\n",
self->dv_xname);
/* XXX disestablish interrupt */
return;