summaryrefslogtreecommitdiffstats
path: root/sound/usb/6fire/midi.c
diff options
context:
space:
mode:
authorTorsten Schenk <torsten.schenk@zoho.com>2013-08-11 11:11:35 +0200
committerTakashi Iwai <tiwai@suse.de>2013-08-12 11:42:28 +0200
commit4c2aee0032b70083dafebd733ed9c774633b2fa3 (patch)
treef0e5533ed368eab0463b0f5123e4938de7c8f95f /sound/usb/6fire/midi.c
parent5ece263f1d93fba8d992e67e3ab8a71acf674db9 (diff)
downloadop-kernel-dev-4c2aee0032b70083dafebd733ed9c774633b2fa3.zip
op-kernel-dev-4c2aee0032b70083dafebd733ed9c774633b2fa3.tar.gz
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/usb/6fire/midi.c')
-rw-r--r--sound/usb/6fire/midi.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
index 2672242..f3dd726 100644
--- a/sound/usb/6fire/midi.c
+++ b/sound/usb/6fire/midi.c
@@ -19,6 +19,10 @@
#include "chip.h"
#include "comm.h"
+enum {
+ MIDI_BUFSIZE = 64
+};
+
static void usb6fire_midi_out_handler(struct urb *urb)
{
struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip)
if (!rt)
return -ENOMEM;
+ rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL);
+ if (!rt->out_buffer) {
+ kfree(rt);
+ return -ENOMEM;
+ }
+
rt->chip = chip;
rt->in_received = usb6fire_midi_in_received;
rt->out_buffer[0] = 0x80; /* 'send midi' command */
@@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip)
ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance);
if (ret < 0) {
+ kfree(rt->out_buffer);
kfree(rt);
snd_printk(KERN_ERR PREFIX "unable to create midi.\n");
return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip)
void usb6fire_midi_destroy(struct sfire_chip *chip)
{
- kfree(chip->midi);
+ struct midi_runtime *rt = chip->midi;
+
+ kfree(rt->out_buffer);
+ kfree(rt);
chip->midi = NULL;
}
OpenPOWER on IntegriCloud