aboutsummaryrefslogtreecommitdiffstats
path: root/sound/synth
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:50:13 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:17:14 +0100
commita57d15158113cb7f10e662e6df07f445c986a12d (patch)
tree14bb731f73657583a364f381a3d58ad211b93cb4 /sound/synth
parentcb432379eff40d5656ca9f24afc435b4df353d13 (diff)
downloadkernel_goldelico_gta04-a57d15158113cb7f10e662e6df07f445c986a12d.zip
kernel_goldelico_gta04-a57d15158113cb7f10e662e6df07f445c986a12d.tar.gz
kernel_goldelico_gta04-a57d15158113cb7f10e662e6df07f445c986a12d.tar.bz2
[ALSA] emux - Avoid cast of function pointers
Modules: Common EMU synth Pass the proper functions instead of cast of function pointers, which can be dangerous with compiler optimizations. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth')
-rw-r--r--sound/synth/emux/emux.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 9e2b4c0..2aacd8a 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -66,6 +66,29 @@ int snd_emux_new(snd_emux_t **remu)
/*
*/
+static int sf_sample_new(void *private_data, snd_sf_sample_t *sp,
+ snd_util_memhdr_t *hdr,
+ const void __user *buf, long count)
+{
+ snd_emux_t *emu = private_data;
+ return emu->ops.sample_new(emu, sp, hdr, buf, count);
+
+}
+
+static int sf_sample_free(void *private_data, snd_sf_sample_t *sp,
+ snd_util_memhdr_t *hdr)
+{
+ snd_emux_t *emu = private_data;
+ return emu->ops.sample_free(emu, sp, hdr);
+
+}
+
+static void sf_sample_reset(void *private_data)
+{
+ snd_emux_t *emu = private_data;
+ emu->ops.sample_reset(emu);
+}
+
int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
{
int err;
@@ -85,9 +108,12 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
/* create soundfont list */
memset(&sf_cb, 0, sizeof(sf_cb));
sf_cb.private_data = emu;
- sf_cb.sample_new = (snd_sf_sample_new_t)emu->ops.sample_new;
- sf_cb.sample_free = (snd_sf_sample_free_t)emu->ops.sample_free;
- sf_cb.sample_reset = (snd_sf_sample_reset_t)emu->ops.sample_reset;
+ if (emu->ops.sample_new)
+ sf_cb.sample_new = sf_sample_new;
+ if (emu->ops.sample_free)
+ sf_cb.sample_free = sf_sample_free;
+ if (emu->ops.sample_reset)
+ sf_cb.sample_reset = sf_sample_reset;
emu->sflist = snd_sf_new(&sf_cb, emu->memhdr);
if (emu->sflist == NULL)
return -ENOMEM;