X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fdrivers%2Fopl3%2Fopl3_synth.c;h=a4b3543a7118121585c808296f1a5dcbda3635e8;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=bd39864dbdedcd7cc59c6e839770f7da0f235e67;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index bd39864db..a4b3543a7 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c @@ -58,31 +58,33 @@ char snd_opl3_regmap[MAX_OPL2_VOICES][4] = { 0x12, 0x15, 0x00, 0x00 } /* is selected (only left reg block) */ }; +EXPORT_SYMBOL(snd_opl3_regmap); + /* * prototypes */ -static int snd_opl3_play_note(opl3_t * opl3, snd_dm_fm_note_t * note); -static int snd_opl3_set_voice(opl3_t * opl3, snd_dm_fm_voice_t * voice); -static int snd_opl3_set_params(opl3_t * opl3, snd_dm_fm_params_t * params); -static int snd_opl3_set_mode(opl3_t * opl3, int mode); -static int snd_opl3_set_connection(opl3_t * opl3, int connection); +static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note); +static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice); +static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params); +static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode); +static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection); /* ------------------------------ */ /* * open the device exclusively */ -int snd_opl3_open(snd_hwdep_t * hw, struct file *file) +int snd_opl3_open(struct snd_hwdep * hw, struct file *file) { - opl3_t *opl3 = snd_magic_cast(opl3_t, hw->private_data, return -ENXIO); + struct snd_opl3 *opl3 = hw->private_data; - down(&opl3->access_mutex); + mutex_lock(&opl3->access_mutex); if (opl3->used) { - up(&opl3->access_mutex); + mutex_unlock(&opl3->access_mutex); return -EAGAIN; } opl3->used++; - up(&opl3->access_mutex); + mutex_unlock(&opl3->access_mutex); return 0; } @@ -90,10 +92,11 @@ int snd_opl3_open(snd_hwdep_t * hw, struct file *file) /* * ioctl for hwdep device: */ -int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, +int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg) { - opl3_t *opl3 = snd_magic_cast(opl3_t, hw->private_data, return -ENXIO); + struct snd_opl3 *opl3 = hw->private_data; + void __user *argp = (void __user *)arg; snd_assert(opl3 != NULL, return -EINVAL); @@ -101,11 +104,11 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, /* get information */ case SNDRV_DM_FM_IOCTL_INFO: { - snd_dm_fm_info_t info; + struct snd_dm_fm_info info; info.fm_mode = opl3->fm_mode; info.rhythm = opl3->rhythm; - if (copy_to_user((snd_dm_fm_info_t *) arg, &info, sizeof(snd_dm_fm_info_t))) + if (copy_to_user(argp, &info, sizeof(struct snd_dm_fm_info))) return -EFAULT; return 0; } @@ -122,8 +125,8 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, case SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE: #endif { - snd_dm_fm_note_t note; - if (copy_from_user(¬e, (snd_dm_fm_note_t *) arg, sizeof(snd_dm_fm_note_t))) + struct snd_dm_fm_note note; + if (copy_from_user(¬e, argp, sizeof(struct snd_dm_fm_note))) return -EFAULT; return snd_opl3_play_note(opl3, ¬e); } @@ -133,8 +136,8 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, case SNDRV_DM_FM_OSS_IOCTL_SET_VOICE: #endif { - snd_dm_fm_voice_t voice; - if (copy_from_user(&voice, (snd_dm_fm_voice_t *) arg, sizeof(snd_dm_fm_voice_t))) + struct snd_dm_fm_voice voice; + if (copy_from_user(&voice, argp, sizeof(struct snd_dm_fm_voice))) return -EFAULT; return snd_opl3_set_voice(opl3, &voice); } @@ -144,8 +147,8 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, case SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS: #endif { - snd_dm_fm_params_t params; - if (copy_from_user(¶ms, (snd_dm_fm_params_t *) arg, sizeof(snd_dm_fm_params_t))) + struct snd_dm_fm_params params; + if (copy_from_user(¶ms, argp, sizeof(struct snd_dm_fm_params))) return -EFAULT; return snd_opl3_set_params(opl3, ¶ms); } @@ -173,21 +176,21 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, /* * close the device */ -int snd_opl3_release(snd_hwdep_t * hw, struct file *file) +int snd_opl3_release(struct snd_hwdep * hw, struct file *file) { - opl3_t *opl3 = snd_magic_cast(opl3_t, hw->private_data, return -ENXIO); + struct snd_opl3 *opl3 = hw->private_data; snd_opl3_reset(opl3); - down(&opl3->access_mutex); + mutex_lock(&opl3->access_mutex); opl3->used--; - up(&opl3->access_mutex); + mutex_unlock(&opl3->access_mutex); return 0; } /* ------------------------------ */ -void snd_opl3_reset(opl3_t * opl3) +void snd_opl3_reset(struct snd_opl3 * opl3) { unsigned short opl3_reg; @@ -227,8 +230,9 @@ void snd_opl3_reset(opl3_t * opl3) opl3->rhythm = 0; } +EXPORT_SYMBOL(snd_opl3_reset); -static int snd_opl3_play_note(opl3_t * opl3, snd_dm_fm_note_t * note) +static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note) { unsigned short reg_side; unsigned char voice_offset; @@ -275,7 +279,7 @@ static int snd_opl3_play_note(opl3_t * opl3, snd_dm_fm_note_t * note) } -static int snd_opl3_set_voice(opl3_t * opl3, snd_dm_fm_voice_t * voice) +static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice) { unsigned short reg_side; unsigned char op_offset; @@ -377,7 +381,7 @@ static int snd_opl3_set_voice(opl3_t * opl3, snd_dm_fm_voice_t * voice) return 0; } -static int snd_opl3_set_params(opl3_t * opl3, snd_dm_fm_params_t * params) +static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params) { unsigned char reg_val; @@ -417,7 +421,7 @@ static int snd_opl3_set_params(opl3_t * opl3, snd_dm_fm_params_t * params) return 0; } -static int snd_opl3_set_mode(opl3_t * opl3, int mode) +static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode) { if ((mode == SNDRV_DM_FM_MODE_OPL3) && (opl3->hardware < OPL3_HW_OPL3)) return -EINVAL; @@ -429,7 +433,7 @@ static int snd_opl3_set_mode(opl3_t * opl3, int mode) return 0; } -static int snd_opl3_set_connection(opl3_t * opl3, int connection) +static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection) { unsigned char reg_val; @@ -444,3 +448,4 @@ static int snd_opl3_set_connection(opl3_t * opl3, int connection) return 0; } +