Skip to content

Commit 4c2aee0

Browse files
Torsten Schenktiwai
authored andcommitted
ALSA: 6fire: make buffers DMA-able (midi)
Patch makes midi output buffer DMA-able by allocating it separately. Signed-off-by: Torsten Schenk <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5ece263 commit 4c2aee0

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

sound/usb/6fire/midi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include "chip.h"
2020
#include "comm.h"
2121

22+
enum {
23+
MIDI_BUFSIZE = 64
24+
};
25+
2226
static void usb6fire_midi_out_handler(struct urb *urb)
2327
{
2428
struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip)
156160
if (!rt)
157161
return -ENOMEM;
158162

163+
rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL);
164+
if (!rt->out_buffer) {
165+
kfree(rt);
166+
return -ENOMEM;
167+
}
168+
159169
rt->chip = chip;
160170
rt->in_received = usb6fire_midi_in_received;
161171
rt->out_buffer[0] = 0x80; /* 'send midi' command */
@@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip)
169179

170180
ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance);
171181
if (ret < 0) {
182+
kfree(rt->out_buffer);
172183
kfree(rt);
173184
snd_printk(KERN_ERR PREFIX "unable to create midi.\n");
174185
return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip)
197208

198209
void usb6fire_midi_destroy(struct sfire_chip *chip)
199210
{
200-
kfree(chip->midi);
211+
struct midi_runtime *rt = chip->midi;
212+
213+
kfree(rt->out_buffer);
214+
kfree(rt);
201215
chip->midi = NULL;
202216
}

sound/usb/6fire/midi.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
#include "common.h"
1818

19-
enum {
20-
MIDI_BUFSIZE = 64
21-
};
22-
2319
struct midi_runtime {
2420
struct sfire_chip *chip;
2521
struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@ struct midi_runtime {
3228
struct snd_rawmidi_substream *out;
3329
struct urb out_urb;
3430
u8 out_serial; /* serial number of out packet */
35-
u8 out_buffer[MIDI_BUFSIZE];
31+
u8 *out_buffer;
3632
int buffer_offset;
3733

3834
void (*in_received)(struct midi_runtime *rt, u8 *data, int length);

0 commit comments

Comments
 (0)