6fire: make buffers DMA-able (midi)
PATCH 2/2 6fire: make buffers DMA-able (midi)
Patch makes midi output buffer DMA-able by allocating it separately.
Signed-off-by Torsten Schenk <[email protected]>
---
sound/6fire/midi.c +15 -1
@@ -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 @@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 @@ 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_destroy (struct sfire_chip *chip) { -kfree (chip->midi); +struct midi_runtime *rt = chip->midi; + +kfree (rt->out_buffer); +kfree (rt); chip->midi =NULL ; }
sound/6fire/midi.h +1 -5
@@ -16,10 +16,6 @@#include "common.h" -enum { -MIDI_BUFSIZE =64 -}; -struct midi_runtime {struct sfire_chip *chip;struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@struct snd_rawmidi_substream *out;struct urb out_urb;u8 out_serial;/* serial number of out packet */ -u8 out_buffer[MIDI_BUFSIZE ]; +u8 *out_buffer;int buffer_offset;void (*in_received)(struct midi_runtime *rt,u8 *data,int length);
At Sun, 11 Aug 2013 11:11:35 +0200,
Quoted 4 lines · Torsten Schenk
Patch makes midi output buffer DMA-able by allocating it separately.
Signed-off-by Torsten Schenk <[email protected]>
This wasn't applicable because the paths in the patch are wrong. I applied it by manually fixing them, so no need for resending.
thanks,
Takashi
Quoted 71 lines
---
diff -Nura/sound/6fire/midi.cb/sound/6fire/midi.csound/6fire/midi.c +15
-1@@ -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 @@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 @@ 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_destroy (struct sfire_chip *chip) { -kfree (chip->midi); +struct midi_runtime *rt = chip->midi; + +kfree (rt->out_buffer); +kfree (rt); chip->midi =NULL ; }diff -Nur
a/sound/6fire/midi.hb/sound/6fire/midi.hsound/6fire/midi.h +1
-5@@ -16,10 +16,6 @@#include "common.h" -enum { -MIDI_BUFSIZE =64 -}; -struct midi_runtime {struct sfire_chip *chip;struct snd_rawmidi *instance;@@ -32,7 +28,7 @@struct snd_rawmidi_substream *out;struct urb out_urb;u8 out_serial;/* serial number of out packet */ -u8 out_buffer[MIDI_BUFSIZE ]; +u8 *out_buffer;int buffer_offset;void (*in_received)(struct midi_runtime *rt,u8 *data,int length);