summaryrefslogtreecommitdiffstats
path: root/sound/firewire/iso-resources.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-03-15 07:55:50 +0100
committerTakashi Iwai <tiwai@suse.de>2011-03-15 08:42:28 +0100
commit5b2599a07eaee53d713fb68f5343eba88fa249c0 (patch)
tree43cd8d7bebd8b1d9f86ca8f2db69d985da82e94f /sound/firewire/iso-resources.c
parentbe454366324b31922a2460c63c65d5e3cebe9641 (diff)
downloadlinux-5b2599a07eaee53d713fb68f5343eba88fa249c0.tar.bz2
ALSA: firewire-lib: allocate DMA buffer separately
For correct cache coherency on some architectures, DMA buffers must be allocated in a different cache line than data that is concurrently used by the CPU. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/iso-resources.c')
-rw-r--r--sound/firewire/iso-resources.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/firewire/iso-resources.c b/sound/firewire/iso-resources.c
index 6f2b5f8651fd..775dbd5f3445 100644
--- a/sound/firewire/iso-resources.c
+++ b/sound/firewire/iso-resources.c
@@ -11,6 +11,7 @@
#include <linux/jiffies.h>
#include <linux/mutex.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <linux/spinlock.h>
#include "iso-resources.h"
@@ -22,12 +23,18 @@
* If the device does not support all channel numbers, change @r->channels_mask
* after calling this function.
*/
-void fw_iso_resources_init(struct fw_iso_resources *r, struct fw_unit *unit)
+int fw_iso_resources_init(struct fw_iso_resources *r, struct fw_unit *unit)
{
+ r->buffer = kmalloc(2 * 4, GFP_KERNEL);
+ if (!r->buffer)
+ return -ENOMEM;
+
r->channels_mask = ~0uLL;
r->unit = fw_unit_get(unit);
mutex_init(&r->mutex);
r->allocated = false;
+
+ return 0;
}
/**
@@ -37,6 +44,7 @@ void fw_iso_resources_init(struct fw_iso_resources *r, struct fw_unit *unit)
void fw_iso_resources_destroy(struct fw_iso_resources *r)
{
WARN_ON(r->allocated);
+ kfree(r->buffer);
mutex_destroy(&r->mutex);
fw_unit_put(r->unit);
}