aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTorsten Schenk <torsten.schenk@zoho.com>2013-08-11 05:11:35 -0400
committerTakashi Iwai <tiwai@suse.de>2013-08-12 05:42:28 -0400
commit4c2aee0032b70083dafebd733ed9c774633b2fa3 (patch)
treef0e5533ed368eab0463b0f5123e4938de7c8f95f /sound
parent5ece263f1d93fba8d992e67e3ab8a71acf674db9 (diff)
ALSA: 6fire: make buffers DMA-able (midi)
Patch makes midi output buffer DMA-able by allocating it separately. Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/6fire/midi.c16
-rw-r--r--sound/usb/6fire/midi.h6
2 files changed, 16 insertions, 6 deletions
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
index 26722423330d..f3dd7266c391 100644
--- a/sound/usb/6fire/midi.c
+++ b/sound/usb/6fire/midi.c
@@ -19,6 +19,10 @@
19#include "chip.h" 19#include "chip.h"
20#include "comm.h" 20#include "comm.h"
21 21
22enum {
23 MIDI_BUFSIZE = 64
24};
25
22static void usb6fire_midi_out_handler(struct urb *urb) 26static void usb6fire_midi_out_handler(struct urb *urb)
23{ 27{
24 struct midi_runtime *rt = urb->context; 28 struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip)
156 if (!rt) 160 if (!rt)
157 return -ENOMEM; 161 return -ENOMEM;
158 162
163 rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL);
164 if (!rt->out_buffer) {
165 kfree(rt);
166 return -ENOMEM;
167 }
168
159 rt->chip = chip; 169 rt->chip = chip;
160 rt->in_received = usb6fire_midi_in_received; 170 rt->in_received = usb6fire_midi_in_received;
161 rt->out_buffer[0] = 0x80; /* 'send midi' command */ 171 rt->out_buffer[0] = 0x80; /* 'send midi' command */
@@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip)
169 179
170 ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance); 180 ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance);
171 if (ret < 0) { 181 if (ret < 0) {
182 kfree(rt->out_buffer);
172 kfree(rt); 183 kfree(rt);
173 snd_printk(KERN_ERR PREFIX "unable to create midi.\n"); 184 snd_printk(KERN_ERR PREFIX "unable to create midi.\n");
174 return ret; 185 return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip)
197 208
198void usb6fire_midi_destroy(struct sfire_chip *chip) 209void usb6fire_midi_destroy(struct sfire_chip *chip)
199{ 210{
200 kfree(chip->midi); 211 struct midi_runtime *rt = chip->midi;
212
213 kfree(rt->out_buffer);
214 kfree(rt);
201 chip->midi = NULL; 215 chip->midi = NULL;
202} 216}
diff --git a/sound/usb/6fire/midi.h b/sound/usb/6fire/midi.h
index c321006e5430..84851b9f5559 100644
--- a/sound/usb/6fire/midi.h
+++ b/sound/usb/6fire/midi.h
@@ -16,10 +16,6 @@
16 16
17#include "common.h" 17#include "common.h"
18 18
19enum {
20 MIDI_BUFSIZE = 64
21};
22
23struct midi_runtime { 19struct midi_runtime {
24 struct sfire_chip *chip; 20 struct sfire_chip *chip;
25 struct snd_rawmidi *instance; 21 struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@ struct midi_runtime {
32 struct snd_rawmidi_substream *out; 28 struct snd_rawmidi_substream *out;
33 struct urb out_urb; 29 struct urb out_urb;
34 u8 out_serial; /* serial number of out packet */ 30 u8 out_serial; /* serial number of out packet */
35 u8 out_buffer[MIDI_BUFSIZE]; 31 u8 *out_buffer;
36 int buffer_offset; 32 int buffer_offset;
37 33
38 void (*in_received)(struct midi_runtime *rt, u8 *data, int length); 34 void (*in_received)(struct midi_runtime *rt, u8 *data, int length);