Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: dev/pci/pciide.c

Issue 4521049: Refactor channel_queue allocation and initialization
Patch Set: Add analogous wdc_free_queue() function Created 13 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dev/isa/wdc_isapnp.c ('k') | dev/pcmcia/wdc_pcmcia.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dev/pci/pciide.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/pci/pciide.c,v
retrieving revision 1.328
diff -u -r1.328 pciide.c
--- dev/pci/pciide.c 27 Apr 2011 07:55:05 -0000 1.328
+++ dev/pci/pciide.c 9 May 2011 17:24:50 -0000
@@ -2155,11 +2155,10 @@
cp->name = PCIIDE_CHANNEL_NAME(channel);
cp->wdc_channel.channel = channel;
cp->wdc_channel.wdc = &sc->sc_wdcdev;
- cp->wdc_channel.ch_queue =
- malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
+ cp->wdc_channel.ch_queue = wdc_alloc_queue();
if (cp->wdc_channel.ch_queue == NULL) {
printf("%s: %s "
- "cannot allocate memory for command queue",
+ "cannot allocate channel queue",
sc->sc_wdcdev.sc_dev.dv_xname, cp->name);
return (0);
}
@@ -2173,7 +2172,7 @@
{
struct pciide_channel *cp = &sc->pciide_channels[channel];
if (cp->wdc_channel.ch_queue)
- free(cp->wdc_channel.ch_queue, M_DEVBUF);
+ wdc_free_queue(cp->wdc_channel.ch_queue);
}
/* some common code used by several chip channel_map */
@@ -3636,12 +3635,11 @@
cp->wdc_channel.ch_queue =
sc->pciide_channels[0].wdc_channel.ch_queue;
} else {
- cp->wdc_channel.ch_queue =
- malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
+ cp->wdc_channel.ch_queue = wdc_alloc_queue();
}
if (cp->wdc_channel.ch_queue == NULL) {
printf(
- "%s: %s cannot allocate memory for command queue",
+ "%s: %s cannot allocate channel queue",
sc->sc_wdcdev.sc_dev.dv_xname, cp->name);
return;
}
@@ -4001,11 +3999,10 @@
cp->wdc_channel.channel = channel;
cp->wdc_channel.wdc = &sc->sc_wdcdev;
- cp->wdc_channel.ch_queue =
- malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
+ cp->wdc_channel.ch_queue = wdc_alloc_queue();
if (cp->wdc_channel.ch_queue == NULL) {
printf("%s %s: "
- "can't allocate memory for command queue",
+ "cannot allocate channel queue",
sc->sc_wdcdev.sc_dev.dv_xname, cp->name);
return;
}
@@ -4610,11 +4607,10 @@
cp->name = channel_names[channel];
cp->wdc_channel.channel = channel;
cp->wdc_channel.wdc = &sc->sc_wdcdev;
- cp->wdc_channel.ch_queue =
- malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
+ cp->wdc_channel.ch_queue = wdc_alloc_queue();
if (cp->wdc_channel.ch_queue == NULL) {
printf("%s %s channel: "
- "can't allocate memory for command queue",
+ "cannot allocate channel queue",
sc->sc_wdcdev.sc_dev.dv_xname, cp->name);
return (0);
}
@@ -4810,10 +4806,9 @@
cp->name = PCIIDE_CHANNEL_NAME(0);
cp->wdc_channel.channel = 0;
cp->wdc_channel.wdc = &sc->sc_wdcdev;
- cp->wdc_channel.ch_queue =
- malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
+ cp->wdc_channel.ch_queue = wdc_alloc_queue();
if (cp->wdc_channel.ch_queue == NULL) {
- printf(": cannot allocate memory for command queue\n");
+ printf(": cannot allocate channel queue\n");
return;
}
printf(", %s %s to ", PCIIDE_CHANNEL_NAME(0),
@@ -6810,11 +6805,10 @@
cp->name = NULL;
cp->wdc_channel.channel = channel;
cp->wdc_channel.wdc = &sc->sc_wdcdev;
- cp->wdc_channel.ch_queue =
- malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
+ cp->wdc_channel.ch_queue = wdc_alloc_queue();
if (cp->wdc_channel.ch_queue == NULL) {
printf("%s: channel %d: "
- "can't allocate memory for command queue\n",
+ "cannot allocate channel queue\n",
sc->sc_wdcdev.sc_dev.dv_xname, channel);
continue;
}
« no previous file with comments | « dev/isa/wdc_isapnp.c ('k') | dev/pcmcia/wdc_pcmcia.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b