aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/emux_synth.h105
-rw-r--r--include/sound/sfnt_info.h36
-rw-r--r--include/sound/soundfont.h75
-rw-r--r--include/sound/util_mem.h32
-rw-r--r--sound/synth/emux/emux.c29
-rw-r--r--sound/synth/emux/emux_effect.c44
-rw-r--r--sound/synth/emux/emux_hwdep.c23
-rw-r--r--sound/synth/emux/emux_nrpn.c30
-rw-r--r--sound/synth/emux/emux_oss.c90
-rw-r--r--sound/synth/emux/emux_proc.c14
-rw-r--r--sound/synth/emux/emux_seq.c74
-rw-r--r--sound/synth/emux/emux_synth.c139
-rw-r--r--sound/synth/emux/emux_voice.h67
-rw-r--r--sound/synth/emux/soundfont.c248
-rw-r--r--sound/synth/util_mem.c39
15 files changed, 550 insertions, 495 deletions
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index c6970aac9bdc..b2d6b2acc7c7 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -36,39 +36,40 @@
36 */ 36 */
37#define SNDRV_EMUX_USE_RAW_EFFECT 37#define SNDRV_EMUX_USE_RAW_EFFECT
38 38
39 39struct snd_emux;
40/* 40struct snd_emux_port;
41 * typedefs 41struct snd_emux_voice;
42 */ 42struct snd_emux_effect_table;
43typedef struct snd_emux_effect_table snd_emux_effect_table_t;
44typedef struct snd_emux_port snd_emux_port_t;
45typedef struct snd_emux_voice snd_emux_voice_t;
46typedef struct snd_emux snd_emux_t;
47
48 43
49/* 44/*
50 * operators 45 * operators
51 */ 46 */
52typedef struct snd_emux_operators { 47struct snd_emux_operators {
53 struct module *owner; 48 struct module *owner;
54 snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); 49 struct snd_emux_voice *(*get_voice)(struct snd_emux *emu,
55 int (*prepare)(snd_emux_voice_t *vp); 50 struct snd_emux_port *port);
56 void (*trigger)(snd_emux_voice_t *vp); 51 int (*prepare)(struct snd_emux_voice *vp);
57 void (*release)(snd_emux_voice_t *vp); 52 void (*trigger)(struct snd_emux_voice *vp);
58 void (*update)(snd_emux_voice_t *vp, int update); 53 void (*release)(struct snd_emux_voice *vp);
59 void (*terminate)(snd_emux_voice_t *vp); 54 void (*update)(struct snd_emux_voice *vp, int update);
60 void (*free_voice)(snd_emux_voice_t *vp); 55 void (*terminate)(struct snd_emux_voice *vp);
61 void (*reset)(snd_emux_t *emu, int ch); 56 void (*free_voice)(struct snd_emux_voice *vp);
62 /* the first parameters are snd_emux_t */ 57 void (*reset)(struct snd_emux *emu, int ch);
63 int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); 58 /* the first parameters are struct snd_emux */
64 int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); 59 int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp,
65 void (*sample_reset)(snd_emux_t *emu); 60 struct snd_util_memhdr *hdr,
66 int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); 61 const void __user *data, long count);
67 void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 62 int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp,
63 struct snd_util_memhdr *hdr);
64 void (*sample_reset)(struct snd_emux *emu);
65 int (*load_fx)(struct snd_emux *emu, int type, int arg,
66 const void __user *data, long count);
67 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
68 struct snd_midi_channel_set *chset);
68#ifdef CONFIG_SND_SEQUENCER_OSS 69#ifdef CONFIG_SND_SEQUENCER_OSS
69 int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); 70 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
70#endif 71#endif
71} snd_emux_operators_t; 72};
72 73
73 74
74/* 75/*
@@ -90,46 +91,46 @@ typedef struct snd_emux_operators {
90 */ 91 */
91struct snd_emux { 92struct snd_emux {
92 93
93 snd_card_t *card; /* assigned card */ 94 struct snd_card *card; /* assigned card */
94 95
95 /* following should be initialized before registration */ 96 /* following should be initialized before registration */
96 int max_voices; /* Number of voices */ 97 int max_voices; /* Number of voices */
97 int mem_size; /* memory size (in byte) */ 98 int mem_size; /* memory size (in byte) */
98 int num_ports; /* number of ports to be created */ 99 int num_ports; /* number of ports to be created */
99 int pitch_shift; /* pitch shift value (for Emu10k1) */ 100 int pitch_shift; /* pitch shift value (for Emu10k1) */
100 snd_emux_operators_t ops; /* operators */ 101 struct snd_emux_operators ops; /* operators */
101 void *hw; /* hardware */ 102 void *hw; /* hardware */
102 unsigned long flags; /* other conditions */ 103 unsigned long flags; /* other conditions */
103 int midi_ports; /* number of virtual midi devices */ 104 int midi_ports; /* number of virtual midi devices */
104 int midi_devidx; /* device offset of virtual midi */ 105 int midi_devidx; /* device offset of virtual midi */
105 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ 106 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
106 int hwdep_idx; /* hwdep device index */ 107 int hwdep_idx; /* hwdep device index */
107 snd_hwdep_t *hwdep; /* hwdep device */ 108 struct snd_hwdep *hwdep; /* hwdep device */
108 109
109 /* private */ 110 /* private */
110 int num_voices; /* current number of voices */ 111 int num_voices; /* current number of voices */
111 snd_sf_list_t *sflist; /* root of SoundFont list */ 112 struct snd_sf_list *sflist; /* root of SoundFont list */
112 snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
113 int use_time; /* allocation counter */ 114 int use_time; /* allocation counter */
114 spinlock_t voice_lock; /* Lock for voice access */ 115 spinlock_t voice_lock; /* Lock for voice access */
115 struct semaphore register_mutex; 116 struct semaphore register_mutex;
116 int client; /* For the sequencer client */ 117 int client; /* For the sequencer client */
117 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
118 snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
119 int used; /* use counter */ 120 int used; /* use counter */
120 char *name; /* name of the device (internal) */ 121 char *name; /* name of the device (internal) */
121 snd_rawmidi_t **vmidi; 122 struct snd_rawmidi **vmidi;
122 struct timer_list tlist; /* for pending note-offs */ 123 struct timer_list tlist; /* for pending note-offs */
123 int timer_active; 124 int timer_active;
124 125
125 snd_util_memhdr_t *memhdr; /* memory chunk information */ 126 struct snd_util_memhdr *memhdr; /* memory chunk information */
126 127
127#ifdef CONFIG_PROC_FS 128#ifdef CONFIG_PROC_FS
128 snd_info_entry_t *proc; 129 struct snd_info_entry *proc;
129#endif 130#endif
130 131
131#ifdef CONFIG_SND_SEQUENCER_OSS 132#ifdef CONFIG_SND_SEQUENCER_OSS
132 snd_seq_device_t *oss_synth; 133 struct snd_seq_device *oss_synth;
133#endif 134#endif
134}; 135};
135 136
@@ -139,18 +140,18 @@ struct snd_emux {
139 */ 140 */
140struct snd_emux_port { 141struct snd_emux_port {
141 142
142 snd_midi_channel_set_t chset; 143 struct snd_midi_channel_set chset;
143 snd_emux_t *emu; 144 struct snd_emux *emu;
144 145
145 char port_mode; /* operation mode */ 146 char port_mode; /* operation mode */
146 int volume_atten; /* emuX raw attenuation */ 147 int volume_atten; /* emuX raw attenuation */
147 unsigned long drum_flags; /* drum bitmaps */ 148 unsigned long drum_flags; /* drum bitmaps */
148 int ctrls[EMUX_MD_END]; /* control parameters */ 149 int ctrls[EMUX_MD_END]; /* control parameters */
149#ifdef SNDRV_EMUX_USE_RAW_EFFECT 150#ifdef SNDRV_EMUX_USE_RAW_EFFECT
150 snd_emux_effect_table_t *effect; 151 struct snd_emux_effect_table *effect;
151#endif 152#endif
152#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
153 snd_seq_oss_arg_t *oss_arg; 154 struct snd_seq_oss_arg *oss_arg;
154#endif 155#endif
155}; 156};
156 157
@@ -179,16 +180,16 @@ struct snd_emux_voice {
179 unsigned char key; 180 unsigned char key;
180 unsigned char velocity; /* Velocity of current note */ 181 unsigned char velocity; /* Velocity of current note */
181 182
182 snd_sf_zone_t *zone; /* Zone assigned to this note */ 183 struct snd_sf_zone *zone; /* Zone assigned to this note */
183 void *block; /* sample block pointer (optional) */ 184 void *block; /* sample block pointer (optional) */
184 snd_midi_channel_t *chan; /* Midi channel for this note */ 185 struct snd_midi_channel *chan; /* Midi channel for this note */
185 snd_emux_port_t *port; /* associated port */ 186 struct snd_emux_port *port; /* associated port */
186 snd_emux_t *emu; /* assigned root info */ 187 struct snd_emux *emu; /* assigned root info */
187 void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ 188 void *hw; /* hardware pointer (emu8000 or emu10k1) */
188 unsigned long ontime; /* jiffies at note triggered */ 189 unsigned long ontime; /* jiffies at note triggered */
189 190
190 /* Emu8k/Emu10k1 registers */ 191 /* Emu8k/Emu10k1 registers */
191 soundfont_voice_info_t reg; 192 struct soundfont_voice_info reg;
192 193
193 /* additional registers */ 194 /* additional registers */
194 int avol; /* volume attenuation */ 195 int avol; /* volume attenuation */
@@ -229,15 +230,15 @@ struct snd_emux_effect_table {
229/* 230/*
230 * prototypes - interface to Emu10k1 and Emu8k routines 231 * prototypes - interface to Emu10k1 and Emu8k routines
231 */ 232 */
232int snd_emux_new(snd_emux_t **remu); 233int snd_emux_new(struct snd_emux **remu);
233int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); 234int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name);
234int snd_emux_free(snd_emux_t *emu); 235int snd_emux_free(struct snd_emux *emu);
235 236
236/* 237/*
237 * exported functions 238 * exported functions
238 */ 239 */
239void snd_emux_terminate_all(snd_emux_t *emu); 240void snd_emux_terminate_all(struct snd_emux *emu);
240void snd_emux_lock_voice(snd_emux_t *emu, int voice); 241void snd_emux_lock_voice(struct snd_emux *emu, int voice);
241void snd_emux_unlock_voice(snd_emux_t *emu, int voice); 242void snd_emux_unlock_voice(struct snd_emux *emu, int voice);
242 243
243#endif /* __SOUND_EMUX_SYNTH_H */ 244#endif /* __SOUND_EMUX_SYNTH_H */
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 674585f88a31..5d1ab9c4950f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -35,7 +35,7 @@
35#endif 35#endif
36 36
37/* patch interface header: 16 bytes */ 37/* patch interface header: 16 bytes */
38typedef struct soundfont_patch_info_t { 38struct soundfont_patch_info {
39 unsigned short key; /* use the key below */ 39 unsigned short key; /* use the key below */
40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07)
41 41
@@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t {
59 short reserved; /* word alignment data */ 59 short reserved; /* word alignment data */
60 60
61 /* the actual patch data begins after this */ 61 /* the actual patch data begins after this */
62} soundfont_patch_info_t; 62};
63 63
64 64
65/* 65/*
@@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t {
68 68
69#define SNDRV_SFNT_PATCH_NAME_LEN 32 69#define SNDRV_SFNT_PATCH_NAME_LEN 32
70 70
71typedef struct soundfont_open_parm_t { 71struct soundfont_open_parm {
72 unsigned short type; /* sample type */ 72 unsigned short type; /* sample type */
73#define SNDRV_SFNT_PAT_TYPE_MISC 0 73#define SNDRV_SFNT_PAT_TYPE_MISC 0
74#define SNDRV_SFNT_PAT_TYPE_GUS 6 74#define SNDRV_SFNT_PAT_TYPE_GUS 6
@@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t {
78 78
79 short reserved; 79 short reserved;
80 char name[SNDRV_SFNT_PATCH_NAME_LEN]; 80 char name[SNDRV_SFNT_PATCH_NAME_LEN];
81} soundfont_open_parm_t; 81};
82 82
83 83
84/* 84/*
@@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t {
86 */ 86 */
87 87
88/* wave table envelope & effect parameters to control EMU8000 */ 88/* wave table envelope & effect parameters to control EMU8000 */
89typedef struct soundfont_voice_parm_t { 89struct soundfont_voice_parm {
90 unsigned short moddelay; /* modulation delay (0x8000) */ 90 unsigned short moddelay; /* modulation delay (0x8000) */
91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
@@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t {
108 unsigned char chorus; /* chorus send (0x00) */ 108 unsigned char chorus; /* chorus send (0x00) */
109 unsigned char reverb; /* reverb send (0x00) */ 109 unsigned char reverb; /* reverb send (0x00) */
110 unsigned short reserved[4]; /* not used */ 110 unsigned short reserved[4]; /* not used */
111} soundfont_voice_parm_t; 111};
112 112
113 113
114/* wave table parameters: 92 bytes */ 114/* wave table parameters: 92 bytes */
115typedef struct soundfont_voice_info_t { 115struct soundfont_voice_info {
116 unsigned short sf_id; /* file id (should be zero) */ 116 unsigned short sf_id; /* file id (should be zero) */
117 unsigned short sample; /* sample id */ 117 unsigned short sample; /* sample id */
118 int start, end; /* sample offset correction */ 118 int start, end; /* sample offset correction */
@@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t {
135 unsigned char amplitude; /* sample volume (127 max) */ 135 unsigned char amplitude; /* sample volume (127 max) */
136 unsigned char attenuation; /* attenuation (0.375dB) */ 136 unsigned char attenuation; /* attenuation (0.375dB) */
137 short scaleTuning; /* pitch scale tuning(%), normally 100 */ 137 short scaleTuning; /* pitch scale tuning(%), normally 100 */
138 soundfont_voice_parm_t parm; /* voice envelope parameters */ 138 struct soundfont_voice_parm parm; /* voice envelope parameters */
139 unsigned short sample_mode; /* sample mode_flag (set by driver) */ 139 unsigned short sample_mode; /* sample mode_flag (set by driver) */
140} soundfont_voice_info_t; 140};
141 141
142 142
143/* instrument info header: 4 bytes */ 143/* instrument info header: 4 bytes */
144typedef struct soundfont_voice_rec_hdr_t { 144struct soundfont_voice_rec_hdr {
145 unsigned char bank; /* midi bank number */ 145 unsigned char bank; /* midi bank number */
146 unsigned char instr; /* midi preset number */ 146 unsigned char instr; /* midi preset number */
147 char nvoices; /* number of voices */ 147 char nvoices; /* number of voices */
@@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t {
149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */
150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */
151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */
152} soundfont_voice_rec_hdr_t; 152};
153 153
154 154
155/* 155/*
@@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t {
157 */ 157 */
158 158
159/* wave table sample header: 32 bytes */ 159/* wave table sample header: 32 bytes */
160typedef struct soundfont_sample_info_t { 160struct soundfont_sample_info {
161 unsigned short sf_id; /* file id (should be zero) */ 161 unsigned short sf_id; /* file id (should be zero) */
162 unsigned short sample; /* sample id */ 162 unsigned short sample; /* sample id */
163 int start, end; /* start & end offset */ 163 int start, end; /* start & end offset */
@@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t {
174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
176 unsigned int truesize; /* used memory size (set by driver) */ 176 unsigned int truesize; /* used memory size (set by driver) */
177} soundfont_sample_info_t; 177};
178 178
179 179
180/* 180/*
181 * voice preset mapping (aliasing) 181 * voice preset mapping (aliasing)
182 */ 182 */
183 183
184typedef struct soundfont_voice_map_t { 184struct soundfont_voice_map {
185 int map_bank, map_instr, map_key; /* key = -1 means all keys */ 185 int map_bank, map_instr, map_key; /* key = -1 means all keys */
186 int src_bank, src_instr, src_key; 186 int src_bank, src_instr, src_key;
187} soundfont_voice_map_t; 187};
188 188
189 189
190/* 190/*
@@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t {
195 195
196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */
197 197
198struct sndrv_emux_misc_mode { 198struct snd_emux_misc_mode {
199 int port; /* -1 = all */ 199 int port; /* -1 = all */
200 int mode; 200 int mode;
201 int value; 201 int value;
@@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode {
204 204
205enum { 205enum {
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), 207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), 211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212}; 212};
213 213
214#endif /* __SOUND_SFNT_INFO_H */ 214#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index c992958f5e3c..61a010c65d02 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -29,94 +29,93 @@
29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ 29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */
30#define SF_IS_DRUM_BANK(z) ((z) == 128) 30#define SF_IS_DRUM_BANK(z) ((z) == 128)
31 31
32typedef struct snd_sf_zone { 32struct snd_sf_zone {
33 struct snd_sf_zone *next; /* Link to next */ 33 struct snd_sf_zone *next; /* Link to next */
34 unsigned char bank; /* Midi bank for this zone */ 34 unsigned char bank; /* Midi bank for this zone */
35 unsigned char instr; /* Midi program for this zone */ 35 unsigned char instr; /* Midi program for this zone */
36 unsigned char mapped; /* True if mapped to something else */ 36 unsigned char mapped; /* True if mapped to something else */
37 37
38 soundfont_voice_info_t v; /* All the soundfont parameters */ 38 struct soundfont_voice_info v; /* All the soundfont parameters */
39 int counter; 39 int counter;
40 struct snd_sf_sample *sample; /* Link to sample */ 40 struct snd_sf_sample *sample; /* Link to sample */
41 41
42 /* The following deals with preset numbers (programs) */ 42 /* The following deals with preset numbers (programs) */
43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */ 43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */
44 struct snd_sf_zone *next_zone; /* Next zone in play list */ 44 struct snd_sf_zone *next_zone; /* Next zone in play list */
45} snd_sf_zone_t; 45};
46 46
47typedef struct snd_sf_sample { 47struct snd_sf_sample {
48 soundfont_sample_info_t v; 48 struct soundfont_sample_info v;
49 int counter; 49 int counter;
50 snd_util_memblk_t *block; /* allocated data block */ 50 struct snd_util_memblk *block; /* allocated data block */
51 struct snd_sf_sample *next; 51 struct snd_sf_sample *next;
52} snd_sf_sample_t; 52};
53 53
54/* 54/*
55 * This represents all the information relating to a soundfont. 55 * This represents all the information relating to a soundfont.
56 */ 56 */
57typedef struct snd_soundfont { 57struct snd_soundfont {
58 struct snd_soundfont *next; /* Link to next */ 58 struct snd_soundfont *next; /* Link to next */
59 /*struct snd_soundfont *prev;*/ /* Link to previous */ 59 /*struct snd_soundfont *prev;*/ /* Link to previous */
60 short id; /* file id */ 60 short id; /* file id */
61 short type; /* font type */ 61 short type; /* font type */
62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ 62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */
63 snd_sf_zone_t *zones; /* Font information */ 63 struct snd_sf_zone *zones; /* Font information */
64 snd_sf_sample_t *samples; /* The sample headers */ 64 struct snd_sf_sample *samples; /* The sample headers */
65} snd_soundfont_t; 65};
66 66
67/* 67/*
68 * Type of the sample access callback 68 * Type of the sample access callback
69 */ 69 */
70typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, 70struct snd_sf_callback {
71 snd_util_memhdr_t *hdr, const void __user *buf, long count);
72typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp,
73 snd_util_memhdr_t *hdr);
74typedef void (*snd_sf_sample_reset_t)(void *private);
75
76typedef struct snd_sf_callback {
77 void *private_data; 71 void *private_data;
78 snd_sf_sample_new_t sample_new; 72 int (*sample_new)(void *private_data, struct snd_sf_sample *sp,
79 snd_sf_sample_free_t sample_free; 73 struct snd_util_memhdr *hdr,
80 snd_sf_sample_reset_t sample_reset; 74 const void __user *buf, long count);
81} snd_sf_callback_t; 75 int (*sample_free)(void *private_data, struct snd_sf_sample *sp,
76 struct snd_util_memhdr *hdr);
77 void (*sample_reset)(void *private);
78};
82 79
83/* 80/*
84 * List of soundfonts. 81 * List of soundfonts.
85 */ 82 */
86typedef struct snd_sf_list { 83struct snd_sf_list {
87 snd_soundfont_t *currsf; /* The currently open soundfont */ 84 struct snd_soundfont *currsf; /* The currently open soundfont */
88 int open_client; /* client pointer for lock */ 85 int open_client; /* client pointer for lock */
89 int mem_used; /* used memory size */ 86 int mem_used; /* used memory size */
90 snd_sf_zone_t *presets[SF_MAX_PRESETS]; 87 struct snd_sf_zone *presets[SF_MAX_PRESETS];
91 snd_soundfont_t *fonts; /* The list of soundfonts */ 88 struct snd_soundfont *fonts; /* The list of soundfonts */
92 int fonts_size; /* number of fonts allocated */ 89 int fonts_size; /* number of fonts allocated */
93 int zone_counter; /* last allocated time for zone */ 90 int zone_counter; /* last allocated time for zone */
94 int sample_counter; /* last allocated time for sample */ 91 int sample_counter; /* last allocated time for sample */
95 int zone_locked; /* locked time for zone */ 92 int zone_locked; /* locked time for zone */
96 int sample_locked; /* locked time for sample */ 93 int sample_locked; /* locked time for sample */
97 snd_sf_callback_t callback; /* callback functions */ 94 struct snd_sf_callback callback; /* callback functions */
98 int presets_locked; 95 int presets_locked;
99 struct semaphore presets_mutex; 96 struct semaphore presets_mutex;
100 spinlock_t lock; 97 spinlock_t lock;
101 snd_util_memhdr_t *memhdr; 98 struct snd_util_memhdr *memhdr;
102} snd_sf_list_t; 99};
103 100
104/* Prototypes for soundfont.c */ 101/* Prototypes for soundfont.c */
105int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); 102int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
106int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 103 long count, int client);
104int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
107 long count, int client); 105 long count, int client);
108int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); 106int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);
109 107
110snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); 108struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback,
111void snd_sf_free(snd_sf_list_t *sflist); 109 struct snd_util_memhdr *hdr);
110void snd_sf_free(struct snd_sf_list *sflist);
112 111
113int snd_soundfont_remove_samples(snd_sf_list_t *sflist); 112int snd_soundfont_remove_samples(struct snd_sf_list *sflist);
114int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); 113int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist);
115 114
116int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 115int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
117 int preset, int bank, 116 int preset, int bank,
118 int def_preset, int def_bank, 117 int def_preset, int def_bank,
119 snd_sf_zone_t **table, int max_layers); 118 struct snd_sf_zone **table, int max_layers);
120 119
121/* Parameter conversions */ 120/* Parameter conversions */
122int snd_sf_calc_parm_hold(int msec); 121int snd_sf_calc_parm_hold(int msec);
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 9d2cdfa0c42a..69944bbb5445 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -20,29 +20,25 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23typedef struct snd_util_memblk snd_util_memblk_t;
24typedef struct snd_util_memhdr snd_util_memhdr_t;
25typedef unsigned int snd_util_unit_t;
26
27/* 23/*
28 * memory block 24 * memory block
29 */ 25 */
30struct snd_util_memblk { 26struct snd_util_memblk {
31 snd_util_unit_t size; /* size of this block */ 27 unsigned int size; /* size of this block */
32 snd_util_unit_t offset; /* zero-offset of this block */ 28 unsigned int offset; /* zero-offset of this block */
33 struct list_head list; /* link */ 29 struct list_head list; /* link */
34}; 30};
35 31
36#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) 32#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk))
37 33
38/* 34/*
39 * memory management information 35 * memory management information
40 */ 36 */
41struct snd_util_memhdr { 37struct snd_util_memhdr {
42 snd_util_unit_t size; /* size of whole data */ 38 unsigned int size; /* size of whole data */
43 struct list_head block; /* block linked-list header */ 39 struct list_head block; /* block linked-list header */
44 int nblocks; /* # of allocated blocks */ 40 int nblocks; /* # of allocated blocks */
45 snd_util_unit_t used; /* used memory size */ 41 unsigned int used; /* used memory size */
46 int block_extra_size; /* extra data size of chunk */ 42 int block_extra_size; /* extra data size of chunk */
47 struct semaphore block_mutex; /* lock */ 43 struct semaphore block_mutex; /* lock */
48}; 44};
@@ -50,15 +46,17 @@ struct snd_util_memhdr {
50/* 46/*
51 * prototypes 47 * prototypes
52 */ 48 */
53snd_util_memhdr_t *snd_util_memhdr_new(int memsize); 49struct snd_util_memhdr *snd_util_memhdr_new(int memsize);
54void snd_util_memhdr_free(snd_util_memhdr_t *hdr); 50void snd_util_memhdr_free(struct snd_util_memhdr *hdr);
55snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 51struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
56int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 52int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
57int snd_util_mem_avail(snd_util_memhdr_t *hdr); 53int snd_util_mem_avail(struct snd_util_memhdr *hdr);
58 54
59/* functions without mutex */ 55/* functions without mutex */
60snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 56struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
61void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 57void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
62snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); 58struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr,
59 unsigned int units,
60 struct list_head *prev);
63 61
64#endif /* __SOUND_UTIL_MEM_H */ 62#endif /* __SOUND_UTIL_MEM_H */
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 2aacd8a884e5..7c8e328fae62 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -35,9 +35,9 @@ MODULE_LICENSE("GPL");
35/* 35/*
36 * create a new hardware dependent device for Emu8000/Emu10k1 36 * create a new hardware dependent device for Emu8000/Emu10k1
37 */ 37 */
38int snd_emux_new(snd_emux_t **remu) 38int snd_emux_new(struct snd_emux **remu)
39{ 39{
40 snd_emux_t *emu; 40 struct snd_emux *emu;
41 41
42 *remu = NULL; 42 *remu = NULL;
43 emu = kzalloc(sizeof(*emu), GFP_KERNEL); 43 emu = kzalloc(sizeof(*emu), GFP_KERNEL);
@@ -66,33 +66,33 @@ int snd_emux_new(snd_emux_t **remu)
66 66
67/* 67/*
68 */ 68 */
69static int sf_sample_new(void *private_data, snd_sf_sample_t *sp, 69static int sf_sample_new(void *private_data, struct snd_sf_sample *sp,
70 snd_util_memhdr_t *hdr, 70 struct snd_util_memhdr *hdr,
71 const void __user *buf, long count) 71 const void __user *buf, long count)
72{ 72{
73 snd_emux_t *emu = private_data; 73 struct snd_emux *emu = private_data;
74 return emu->ops.sample_new(emu, sp, hdr, buf, count); 74 return emu->ops.sample_new(emu, sp, hdr, buf, count);
75 75
76} 76}
77 77
78static int sf_sample_free(void *private_data, snd_sf_sample_t *sp, 78static int sf_sample_free(void *private_data, struct snd_sf_sample *sp,
79 snd_util_memhdr_t *hdr) 79 struct snd_util_memhdr *hdr)
80{ 80{
81 snd_emux_t *emu = private_data; 81 struct snd_emux *emu = private_data;
82 return emu->ops.sample_free(emu, sp, hdr); 82 return emu->ops.sample_free(emu, sp, hdr);
83 83
84} 84}
85 85
86static void sf_sample_reset(void *private_data) 86static void sf_sample_reset(void *private_data)
87{ 87{
88 snd_emux_t *emu = private_data; 88 struct snd_emux *emu = private_data;
89 emu->ops.sample_reset(emu); 89 emu->ops.sample_reset(emu);
90} 90}
91 91
92int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) 92int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name)
93{ 93{
94 int err; 94 int err;
95 snd_sf_callback_t sf_cb; 95 struct snd_sf_callback sf_cb;
96 96
97 snd_assert(emu->hw != NULL, return -EINVAL); 97 snd_assert(emu->hw != NULL, return -EINVAL);
98 snd_assert(emu->max_voices > 0, return -EINVAL); 98 snd_assert(emu->max_voices > 0, return -EINVAL);
@@ -101,7 +101,8 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
101 101
102 emu->card = card; 102 emu->card = card;
103 emu->name = kstrdup(name, GFP_KERNEL); 103 emu->name = kstrdup(name, GFP_KERNEL);
104 emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); 104 emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
105 GFP_KERNEL);
105 if (emu->voices == NULL) 106 if (emu->voices == NULL)
106 return -ENOMEM; 107 return -ENOMEM;
107 108
@@ -138,7 +139,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
138 139
139/* 140/*
140 */ 141 */
141int snd_emux_free(snd_emux_t *emu) 142int snd_emux_free(struct snd_emux *emu)
142{ 143{
143 unsigned long flags; 144 unsigned long flags;
144 145
diff --git a/sound/synth/emux/emux_effect.c b/sound/synth/emux/emux_effect.c
index 4764940f11a0..a447218b6160 100644
--- a/sound/synth/emux/emux_effect.c
+++ b/sound/synth/emux/emux_effect.c
@@ -32,7 +32,7 @@
32 32
33#define xoffsetof(type,tag) ((long)(&((type)NULL)->tag) - (long)(NULL)) 33#define xoffsetof(type,tag) ((long)(&((type)NULL)->tag) - (long)(NULL))
34 34
35#define parm_offset(tag) xoffsetof(soundfont_voice_parm_t*, tag) 35#define parm_offset(tag) xoffsetof(struct soundfont_voice_parm *, tag)
36 36
37#define PARM_IS_BYTE (1 << 0) 37#define PARM_IS_BYTE (1 << 0)
38#define PARM_IS_WORD (1 << 1) 38#define PARM_IS_WORD (1 << 1)
@@ -97,10 +97,10 @@ static struct emux_parm_defs {
97 97
98/* set byte effect value */ 98/* set byte effect value */
99static void 99static void
100effect_set_byte(unsigned char *valp, snd_midi_channel_t *chan, int type) 100effect_set_byte(unsigned char *valp, struct snd_midi_channel *chan, int type)
101{ 101{
102 short effect; 102 short effect;
103 snd_emux_effect_table_t *fx = chan->private; 103 struct snd_emux_effect_table *fx = chan->private;
104 104
105 effect = fx->val[type]; 105 effect = fx->val[type];
106 if (fx->flag[type] == EMUX_FX_FLAG_ADD) { 106 if (fx->flag[type] == EMUX_FX_FLAG_ADD) {
@@ -118,10 +118,10 @@ effect_set_byte(unsigned char *valp, snd_midi_channel_t *chan, int type)
118 118
119/* set word effect value */ 119/* set word effect value */
120static void 120static void
121effect_set_word(unsigned short *valp, snd_midi_channel_t *chan, int type) 121effect_set_word(unsigned short *valp, struct snd_midi_channel *chan, int type)
122{ 122{
123 int effect; 123 int effect;
124 snd_emux_effect_table_t *fx = chan->private; 124 struct snd_emux_effect_table *fx = chan->private;
125 125
126 effect = *(unsigned short*)&fx->val[type]; 126 effect = *(unsigned short*)&fx->val[type];
127 if (fx->flag[type] == EMUX_FX_FLAG_ADD) 127 if (fx->flag[type] == EMUX_FX_FLAG_ADD)
@@ -135,10 +135,10 @@ effect_set_word(unsigned short *valp, snd_midi_channel_t *chan, int type)
135 135
136/* address offset */ 136/* address offset */
137static int 137static int
138effect_get_offset(snd_midi_channel_t *chan, int lo, int hi, int mode) 138effect_get_offset(struct snd_midi_channel *chan, int lo, int hi, int mode)
139{ 139{
140 int addr = 0; 140 int addr = 0;
141 snd_emux_effect_table_t *fx = chan->private; 141 struct snd_emux_effect_table *fx = chan->private;
142 142
143 if (fx->flag[hi]) 143 if (fx->flag[hi])
144 addr = (short)fx->val[hi]; 144 addr = (short)fx->val[hi];
@@ -153,7 +153,8 @@ effect_get_offset(snd_midi_channel_t *chan, int lo, int hi, int mode)
153#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
154/* change effects - for OSS sequencer compatibility */ 154/* change effects - for OSS sequencer compatibility */
155void 155void
156snd_emux_send_effect_oss(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val) 156snd_emux_send_effect_oss(struct snd_emux_port *port,
157 struct snd_midi_channel *chan, int type, int val)
157{ 158{
158 int mode; 159 int mode;
159 160
@@ -173,13 +174,14 @@ snd_emux_send_effect_oss(snd_emux_port_t *port, snd_midi_channel_t *chan, int ty
173 * if update is necessary, call emu8000_control 174 * if update is necessary, call emu8000_control
174 */ 175 */
175void 176void
176snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val, int mode) 177snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan,
178 int type, int val, int mode)
177{ 179{
178 int i; 180 int i;
179 int offset; 181 int offset;
180 unsigned char *srcp, *origp; 182 unsigned char *srcp, *origp;
181 snd_emux_t *emu; 183 struct snd_emux *emu;
182 snd_emux_effect_table_t *fx; 184 struct snd_emux_effect_table *fx;
183 unsigned long flags; 185 unsigned long flags;
184 186
185 emu = port->emu; 187 emu = port->emu;
@@ -206,7 +208,7 @@ snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type,
206 /* modify the register values */ 208 /* modify the register values */
207 spin_lock_irqsave(&emu->voice_lock, flags); 209 spin_lock_irqsave(&emu->voice_lock, flags);
208 for (i = 0; i < emu->max_voices; i++) { 210 for (i = 0; i < emu->max_voices; i++) {
209 snd_emux_voice_t *vp = &emu->voices[i]; 211 struct snd_emux_voice *vp = &emu->voices[i];
210 if (!STATE_IS_PLAYING(vp->state) || vp->chan != chan) 212 if (!STATE_IS_PLAYING(vp->state) || vp->chan != chan)
211 continue; 213 continue;
212 srcp = (unsigned char*)&vp->reg.parm + offset; 214 srcp = (unsigned char*)&vp->reg.parm + offset;
@@ -228,10 +230,10 @@ snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type,
228 230
229/* copy wavetable registers to voice table */ 231/* copy wavetable registers to voice table */
230void 232void
231snd_emux_setup_effect(snd_emux_voice_t *vp) 233snd_emux_setup_effect(struct snd_emux_voice *vp)
232{ 234{
233 snd_midi_channel_t *chan = vp->chan; 235 struct snd_midi_channel *chan = vp->chan;
234 snd_emux_effect_table_t *fx; 236 struct snd_emux_effect_table *fx;
235 unsigned char *srcp; 237 unsigned char *srcp;
236 int i; 238 int i;
237 239
@@ -275,10 +277,11 @@ snd_emux_setup_effect(snd_emux_voice_t *vp)
275 * effect table 277 * effect table
276 */ 278 */
277void 279void
278snd_emux_create_effect(snd_emux_port_t *p) 280snd_emux_create_effect(struct snd_emux_port *p)
279{ 281{
280 int i; 282 int i;
281 p->effect = kcalloc(p->chset.max_channels, sizeof(snd_emux_effect_table_t), GFP_KERNEL); 283 p->effect = kcalloc(p->chset.max_channels,
284 sizeof(struct snd_emux_effect_table), GFP_KERNEL);
282 if (p->effect) { 285 if (p->effect) {
283 for (i = 0; i < p->chset.max_channels; i++) 286 for (i = 0; i < p->chset.max_channels; i++)
284 p->chset.channels[i].private = p->effect + i; 287 p->chset.channels[i].private = p->effect + i;
@@ -289,17 +292,18 @@ snd_emux_create_effect(snd_emux_port_t *p)
289} 292}
290 293
291void 294void
292snd_emux_delete_effect(snd_emux_port_t *p) 295snd_emux_delete_effect(struct snd_emux_port *p)
293{ 296{
294 kfree(p->effect); 297 kfree(p->effect);
295 p->effect = NULL; 298 p->effect = NULL;
296} 299}
297 300
298void 301void
299snd_emux_clear_effect(snd_emux_port_t *p) 302snd_emux_clear_effect(struct snd_emux_port *p)
300{ 303{
301 if (p->effect) { 304 if (p->effect) {
302 memset(p->effect, 0, sizeof(snd_emux_effect_table_t) * p->chset.max_channels); 305 memset(p->effect, 0, sizeof(struct snd_emux_effect_table) *
306 p->chset.max_channels);
303 } 307 }
304} 308}
305 309
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
index 4182b44eb47e..9b63814c3f64 100644
--- a/sound/synth/emux/emux_hwdep.c
+++ b/sound/synth/emux/emux_hwdep.c
@@ -29,7 +29,7 @@
29 * open the hwdep device 29 * open the hwdep device
30 */ 30 */
31static int 31static int
32snd_emux_hwdep_open(snd_hwdep_t *hw, struct file *file) 32snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file)
33{ 33{
34 return 0; 34 return 0;
35} 35}
@@ -39,7 +39,7 @@ snd_emux_hwdep_open(snd_hwdep_t *hw, struct file *file)
39 * close the device 39 * close the device
40 */ 40 */
41static int 41static int
42snd_emux_hwdep_release(snd_hwdep_t *hw, struct file *file) 42snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file)
43{ 43{
44 return 0; 44 return 0;
45} 45}
@@ -51,10 +51,10 @@ snd_emux_hwdep_release(snd_hwdep_t *hw, struct file *file)
51 * load patch 51 * load patch
52 */ 52 */
53static int 53static int
54snd_emux_hwdep_load_patch(snd_emux_t *emu, void __user *arg) 54snd_emux_hwdep_load_patch(struct snd_emux *emu, void __user *arg)
55{ 55{
56 int err; 56 int err;
57 soundfont_patch_info_t patch; 57 struct soundfont_patch_info patch;
58 58
59 if (copy_from_user(&patch, arg, sizeof(patch))) 59 if (copy_from_user(&patch, arg, sizeof(patch)))
60 return -EFAULT; 60 return -EFAULT;
@@ -77,9 +77,9 @@ snd_emux_hwdep_load_patch(snd_emux_t *emu, void __user *arg)
77 * set misc mode 77 * set misc mode
78 */ 78 */
79static int 79static int
80snd_emux_hwdep_misc_mode(snd_emux_t *emu, void __user *arg) 80snd_emux_hwdep_misc_mode(struct snd_emux *emu, void __user *arg)
81{ 81{
82 struct sndrv_emux_misc_mode info; 82 struct snd_emux_misc_mode info;
83 int i; 83 int i;
84 84
85 if (copy_from_user(&info, arg, sizeof(info))) 85 if (copy_from_user(&info, arg, sizeof(info)))
@@ -102,9 +102,10 @@ snd_emux_hwdep_misc_mode(snd_emux_t *emu, void __user *arg)
102 * ioctl 102 * ioctl
103 */ 103 */
104static int 104static int
105snd_emux_hwdep_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cmd, unsigned long arg) 105snd_emux_hwdep_ioctl(struct snd_hwdep * hw, struct file *file,
106 unsigned int cmd, unsigned long arg)
106{ 107{
107 snd_emux_t *emu = hw->private_data; 108 struct snd_emux *emu = hw->private_data;
108 109
109 switch (cmd) { 110 switch (cmd) {
110 case SNDRV_EMUX_IOCTL_VERSION: 111 case SNDRV_EMUX_IOCTL_VERSION:
@@ -136,9 +137,9 @@ snd_emux_hwdep_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cmd, unsi
136 */ 137 */
137 138
138int 139int
139snd_emux_init_hwdep(snd_emux_t *emu) 140snd_emux_init_hwdep(struct snd_emux *emu)
140{ 141{
141 snd_hwdep_t *hw; 142 struct snd_hwdep *hw;
142 int err; 143 int err;
143 144
144 if ((err = snd_hwdep_new(emu->card, SNDRV_EMUX_HWDEP_NAME, emu->hwdep_idx, &hw)) < 0) 145 if ((err = snd_hwdep_new(emu->card, SNDRV_EMUX_HWDEP_NAME, emu->hwdep_idx, &hw)) < 0)
@@ -162,7 +163,7 @@ snd_emux_init_hwdep(snd_emux_t *emu)
162 * unregister 163 * unregister
163 */ 164 */
164void 165void
165snd_emux_delete_hwdep(snd_emux_t *emu) 166snd_emux_delete_hwdep(struct snd_emux *emu)
166{ 167{
167 if (emu->hwdep) { 168 if (emu->hwdep) {
168 snd_device_free(emu->card, emu->hwdep); 169 snd_device_free(emu->card, emu->hwdep);
diff --git a/sound/synth/emux/emux_nrpn.c b/sound/synth/emux/emux_nrpn.c
index 25edff9e1fc2..c6917ba2c934 100644
--- a/sound/synth/emux/emux_nrpn.c
+++ b/sound/synth/emux/emux_nrpn.c
@@ -27,11 +27,11 @@
27 */ 27 */
28 28
29/* NRPN / CC -> Emu8000 parameter converter */ 29/* NRPN / CC -> Emu8000 parameter converter */
30typedef struct { 30struct nrpn_conv_table {
31 int control; 31 int control;
32 int effect; 32 int effect;
33 int (*convert)(int val); 33 int (*convert)(int val);
34} nrpn_conv_table; 34};
35 35
36/* effect sensitivity */ 36/* effect sensitivity */
37 37
@@ -48,8 +48,9 @@ typedef struct {
48 * convert NRPN/control values 48 * convert NRPN/control values
49 */ 49 */
50 50
51static int send_converted_effect(nrpn_conv_table *table, int num_tables, 51static int send_converted_effect(struct nrpn_conv_table *table, int num_tables,
52 snd_emux_port_t *port, snd_midi_channel_t *chan, 52 struct snd_emux_port *port,
53 struct snd_midi_channel *chan,
53 int type, int val, int mode) 54 int type, int val, int mode)
54{ 55{
55 int i, cval; 56 int i, cval;
@@ -178,7 +179,7 @@ static int fx_conv_Q(int val)
178} 179}
179 180
180 181
181static nrpn_conv_table awe_effects[] = 182static struct nrpn_conv_table awe_effects[] =
182{ 183{
183 { 0, EMUX_FX_LFO1_DELAY, fx_lfo1_delay}, 184 { 0, EMUX_FX_LFO1_DELAY, fx_lfo1_delay},
184 { 1, EMUX_FX_LFO1_FREQ, fx_lfo1_freq}, 185 { 1, EMUX_FX_LFO1_FREQ, fx_lfo1_freq},
@@ -265,7 +266,7 @@ static int gs_vib_delay(int val)
265 return -(val - 64) * gs_sense[FX_VIBDELAY] / 50; 266 return -(val - 64) * gs_sense[FX_VIBDELAY] / 50;
266} 267}
267 268
268static nrpn_conv_table gs_effects[] = 269static struct nrpn_conv_table gs_effects[] =
269{ 270{
270 {32, EMUX_FX_CUTOFF, gs_cutoff}, 271 {32, EMUX_FX_CUTOFF, gs_cutoff},
271 {33, EMUX_FX_FILTERQ, gs_filterQ}, 272 {33, EMUX_FX_FILTERQ, gs_filterQ},
@@ -282,9 +283,10 @@ static nrpn_conv_table gs_effects[] =
282 * NRPN events 283 * NRPN events
283 */ 284 */
284void 285void
285snd_emux_nrpn(void *p, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset) 286snd_emux_nrpn(void *p, struct snd_midi_channel *chan,
287 struct snd_midi_channel_set *chset)
286{ 288{
287 snd_emux_port_t *port; 289 struct snd_emux_port *port;
288 290
289 port = p; 291 port = p;
290 snd_assert(port != NULL, return); 292 snd_assert(port != NULL, return);
@@ -348,7 +350,7 @@ static int xg_release(int val)
348 return -(val - 64) * xg_sense[FX_RELEASE] / 64; 350 return -(val - 64) * xg_sense[FX_RELEASE] / 64;
349} 351}
350 352
351static nrpn_conv_table xg_effects[] = 353static struct nrpn_conv_table xg_effects[] =
352{ 354{
353 {71, EMUX_FX_CUTOFF, xg_cutoff}, 355 {71, EMUX_FX_CUTOFF, xg_cutoff},
354 {74, EMUX_FX_FILTERQ, xg_filterQ}, 356 {74, EMUX_FX_FILTERQ, xg_filterQ},
@@ -357,7 +359,8 @@ static nrpn_conv_table xg_effects[] =
357}; 359};
358 360
359int 361int
360snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param) 362snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
363 int param)
361{ 364{
362 return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects), 365 return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
363 port, chan, param, 366 port, chan, param,
@@ -369,10 +372,11 @@ snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param)
369 * receive sysex 372 * receive sysex
370 */ 373 */
371void 374void
372snd_emux_sysex(void *p, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset) 375snd_emux_sysex(void *p, unsigned char *buf, int len, int parsed,
376 struct snd_midi_channel_set *chset)
373{ 377{
374 snd_emux_port_t *port; 378 struct snd_emux_port *port;
375 snd_emux_t *emu; 379 struct snd_emux *emu;
376 380
377 port = p; 381 port = p;
378 snd_assert(port != NULL, return); 382 snd_assert(port != NULL, return);
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
index 5272f4ac8afd..dfbfcfbe5dd2 100644
--- a/sound/synth/emux/emux_oss.c
+++ b/sound/synth/emux/emux_oss.c
@@ -31,19 +31,25 @@
31#include "emux_voice.h" 31#include "emux_voice.h"
32#include <sound/asoundef.h> 32#include <sound/asoundef.h>
33 33
34static int snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure); 34static int snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure);
35static int snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg); 35static int snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg);
36static int snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg); 36static int snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd,
37static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count); 37 unsigned long ioarg);
38static int snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg); 38static int snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
39static int snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop); 39 const char __user *buf, int offs, int count);
40static void reset_port_mode(snd_emux_port_t *port, int midi_mode); 40static int snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg);
41static void emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, unsigned char *event, int atomic, int hop); 41static int snd_emux_event_oss_input(struct snd_seq_event *ev, int direct,
42static void gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, unsigned char *event, int atomic, int hop); 42 void *private, int atomic, int hop);
43static void fake_event(snd_emux_t *emu, snd_emux_port_t *port, int ch, int param, int val, int atomic, int hop); 43static void reset_port_mode(struct snd_emux_port *port, int midi_mode);
44static void emuspec_control(struct snd_emux *emu, struct snd_emux_port *port,
45 int cmd, unsigned char *event, int atomic, int hop);
46static void gusspec_control(struct snd_emux *emu, struct snd_emux_port *port,
47 int cmd, unsigned char *event, int atomic, int hop);
48static void fake_event(struct snd_emux *emu, struct snd_emux_port *port,
49 int ch, int param, int val, int atomic, int hop);
44 50
45/* operators */ 51/* operators */
46static snd_seq_oss_callback_t oss_callback = { 52static struct snd_seq_oss_callback oss_callback = {
47 .owner = THIS_MODULE, 53 .owner = THIS_MODULE,
48 .open = snd_emux_open_seq_oss, 54 .open = snd_emux_open_seq_oss,
49 .close = snd_emux_close_seq_oss, 55 .close = snd_emux_close_seq_oss,
@@ -58,13 +64,13 @@ static snd_seq_oss_callback_t oss_callback = {
58 */ 64 */
59 65
60void 66void
61snd_emux_init_seq_oss(snd_emux_t *emu) 67snd_emux_init_seq_oss(struct snd_emux *emu)
62{ 68{
63 snd_seq_oss_reg_t *arg; 69 struct snd_seq_oss_reg *arg;
64 snd_seq_device_t *dev; 70 struct snd_seq_device *dev;
65 71
66 if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS, 72 if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS,
67 sizeof(snd_seq_oss_reg_t), &dev) < 0) 73 sizeof(struct snd_seq_oss_reg), &dev) < 0)
68 return; 74 return;
69 75
70 emu->oss_synth = dev; 76 emu->oss_synth = dev;
@@ -85,7 +91,7 @@ snd_emux_init_seq_oss(snd_emux_t *emu)
85 * unregister 91 * unregister
86 */ 92 */
87void 93void
88snd_emux_detach_seq_oss(snd_emux_t *emu) 94snd_emux_detach_seq_oss(struct snd_emux *emu)
89{ 95{
90 if (emu->oss_synth) { 96 if (emu->oss_synth) {
91 snd_device_free(emu->card, emu->oss_synth); 97 snd_device_free(emu->card, emu->oss_synth);
@@ -101,11 +107,11 @@ snd_emux_detach_seq_oss(snd_emux_t *emu)
101 * open port for OSS sequencer 107 * open port for OSS sequencer
102 */ 108 */
103static int 109static int
104snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure) 110snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
105{ 111{
106 snd_emux_t *emu; 112 struct snd_emux *emu;
107 snd_emux_port_t *p; 113 struct snd_emux_port *p;
108 snd_seq_port_callback_t callback; 114 struct snd_seq_port_callback callback;
109 char tmpname[64]; 115 char tmpname[64];
110 116
111 emu = closure; 117 emu = closure;
@@ -153,7 +159,7 @@ snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure)
153 * reset port mode 159 * reset port mode
154 */ 160 */
155static void 161static void
156reset_port_mode(snd_emux_port_t *port, int midi_mode) 162reset_port_mode(struct snd_emux_port *port, int midi_mode)
157{ 163{
158 if (midi_mode) { 164 if (midi_mode) {
159 port->port_mode = SNDRV_EMUX_PORT_MODE_OSS_MIDI; 165 port->port_mode = SNDRV_EMUX_PORT_MODE_OSS_MIDI;
@@ -173,10 +179,10 @@ reset_port_mode(snd_emux_port_t *port, int midi_mode)
173 * close port 179 * close port
174 */ 180 */
175static int 181static int
176snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg) 182snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg)
177{ 183{
178 snd_emux_t *emu; 184 struct snd_emux *emu;
179 snd_emux_port_t *p; 185 struct snd_emux_port *p;
180 186
181 snd_assert(arg != NULL, return -ENXIO); 187 snd_assert(arg != NULL, return -ENXIO);
182 p = arg->private_data; 188 p = arg->private_data;
@@ -200,11 +206,11 @@ snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg)
200 * load patch 206 * load patch
201 */ 207 */
202static int 208static int
203snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, 209snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
204 const char __user *buf, int offs, int count) 210 const char __user *buf, int offs, int count)
205{ 211{
206 snd_emux_t *emu; 212 struct snd_emux *emu;
207 snd_emux_port_t *p; 213 struct snd_emux_port *p;
208 int rc; 214 int rc;
209 215
210 snd_assert(arg != NULL, return -ENXIO); 216 snd_assert(arg != NULL, return -ENXIO);
@@ -218,7 +224,7 @@ snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
218 rc = snd_soundfont_load_guspatch(emu->sflist, buf, count, 224 rc = snd_soundfont_load_guspatch(emu->sflist, buf, count,
219 SF_CLIENT_NO(p->chset.port)); 225 SF_CLIENT_NO(p->chset.port));
220 else if (format == SNDRV_OSS_SOUNDFONT_PATCH) { 226 else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
221 soundfont_patch_info_t patch; 227 struct soundfont_patch_info patch;
222 if (count < (int)sizeof(patch)) 228 if (count < (int)sizeof(patch))
223 rc = -EINVAL; 229 rc = -EINVAL;
224 if (copy_from_user(&patch, buf, sizeof(patch))) 230 if (copy_from_user(&patch, buf, sizeof(patch)))
@@ -242,10 +248,10 @@ snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
242 * ioctl 248 * ioctl
243 */ 249 */
244static int 250static int
245snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg) 251snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg)
246{ 252{
247 snd_emux_port_t *p; 253 struct snd_emux_port *p;
248 snd_emux_t *emu; 254 struct snd_emux *emu;
249 255
250 snd_assert(arg != NULL, return -ENXIO); 256 snd_assert(arg != NULL, return -ENXIO);
251 p = arg->private_data; 257 p = arg->private_data;
@@ -273,9 +279,9 @@ snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long i
273 * reset device 279 * reset device
274 */ 280 */
275static int 281static int
276snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg) 282snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg)
277{ 283{
278 snd_emux_port_t *p; 284 struct snd_emux_port *p;
279 285
280 snd_assert(arg != NULL, return -ENXIO); 286 snd_assert(arg != NULL, return -ENXIO);
281 p = arg->private_data; 287 p = arg->private_data;
@@ -289,11 +295,11 @@ snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg)
289 * receive raw events: only SEQ_PRIVATE is accepted. 295 * receive raw events: only SEQ_PRIVATE is accepted.
290 */ 296 */
291static int 297static int
292snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private_data, 298snd_emux_event_oss_input(struct snd_seq_event *ev, int direct, void *private_data,
293 int atomic, int hop) 299 int atomic, int hop)
294{ 300{
295 snd_emux_t *emu; 301 struct snd_emux *emu;
296 snd_emux_port_t *p; 302 struct snd_emux_port *p;
297 unsigned char cmd, *data; 303 unsigned char cmd, *data;
298 304
299 p = private_data; 305 p = private_data;
@@ -320,14 +326,14 @@ snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private_data,
320 * OSS/AWE driver specific h/w controls 326 * OSS/AWE driver specific h/w controls
321 */ 327 */
322static void 328static void
323emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, 329emuspec_control(struct snd_emux *emu, struct snd_emux_port *port, int cmd,
324 unsigned char *event, int atomic, int hop) 330 unsigned char *event, int atomic, int hop)
325{ 331{
326 int voice; 332 int voice;
327 unsigned short p1; 333 unsigned short p1;
328 short p2; 334 short p2;
329 int i; 335 int i;
330 snd_midi_channel_t *chan; 336 struct snd_midi_channel *chan;
331 337
332 voice = event[3]; 338 voice = event[3];
333 if (voice < 0 || voice >= port->chset.max_channels) 339 if (voice < 0 || voice >= port->chset.max_channels)
@@ -415,14 +421,14 @@ emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
415#include <linux/ultrasound.h> 421#include <linux/ultrasound.h>
416 422
417static void 423static void
418gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, 424gusspec_control(struct snd_emux *emu, struct snd_emux_port *port, int cmd,
419 unsigned char *event, int atomic, int hop) 425 unsigned char *event, int atomic, int hop)
420{ 426{
421 int voice; 427 int voice;
422 unsigned short p1; 428 unsigned short p1;
423 short p2; 429 short p2;
424 int plong; 430 int plong;
425 snd_midi_channel_t *chan; 431 struct snd_midi_channel *chan;
426 432
427 if (port->port_mode != SNDRV_EMUX_PORT_MODE_OSS_SYNTH) 433 if (port->port_mode != SNDRV_EMUX_PORT_MODE_OSS_SYNTH)
428 return; 434 return;
@@ -483,9 +489,9 @@ gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
483 * send an event to midi emulation 489 * send an event to midi emulation
484 */ 490 */
485static void 491static void
486fake_event(snd_emux_t *emu, snd_emux_port_t *port, int ch, int param, int val, int atomic, int hop) 492fake_event(struct snd_emux *emu, struct snd_emux_port *port, int ch, int param, int val, int atomic, int hop)
487{ 493{
488 snd_seq_event_t ev; 494 struct snd_seq_event ev;
489 memset(&ev, 0, sizeof(ev)); 495 memset(&ev, 0, sizeof(ev));
490 ev.type = SNDRV_SEQ_EVENT_CONTROLLER; 496 ev.type = SNDRV_SEQ_EVENT_CONTROLLER;
491 ev.data.control.channel = ch; 497 ev.data.control.channel = ch;
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c
index 0f155d68de0d..a70a179f6947 100644
--- a/sound/synth/emux/emux_proc.c
+++ b/sound/synth/emux/emux_proc.c
@@ -30,10 +30,10 @@
30#ifdef CONFIG_PROC_FS 30#ifdef CONFIG_PROC_FS
31 31
32static void 32static void
33snd_emux_proc_info_read(snd_info_entry_t *entry, 33snd_emux_proc_info_read(struct snd_info_entry *entry,
34 snd_info_buffer_t *buf) 34 struct snd_info_buffer *buf)
35{ 35{
36 snd_emux_t *emu; 36 struct snd_emux *emu;
37 int i; 37 int i;
38 38
39 emu = entry->private_data; 39 emu = entry->private_data;
@@ -66,7 +66,7 @@ snd_emux_proc_info_read(snd_info_entry_t *entry,
66 } 66 }
67#if 0 /* debug */ 67#if 0 /* debug */
68 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) { 68 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
69 snd_emux_voice_t *vp = &emu->voices[0]; 69 struct snd_emux_voice *vp = &emu->voices[0];
70 snd_iprintf(buf, "voice 0: on\n"); 70 snd_iprintf(buf, "voice 0: on\n");
71 snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n", 71 snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
72 vp->reg.parm.moddelay, 72 vp->reg.parm.moddelay,
@@ -107,9 +107,9 @@ snd_emux_proc_info_read(snd_info_entry_t *entry,
107} 107}
108 108
109 109
110void snd_emux_proc_init(snd_emux_t *emu, snd_card_t *card, int device) 110void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
111{ 111{
112 snd_info_entry_t *entry; 112 struct snd_info_entry *entry;
113 char name[64]; 113 char name[64];
114 114
115 sprintf(name, "wavetableD%d", device); 115 sprintf(name, "wavetableD%d", device);
@@ -127,7 +127,7 @@ void snd_emux_proc_init(snd_emux_t *emu, snd_card_t *card, int device)
127 emu->proc = entry; 127 emu->proc = entry;
128} 128}
129 129
130void snd_emux_proc_free(snd_emux_t *emu) 130void snd_emux_proc_free(struct snd_emux *emu)
131{ 131{
132 if (emu->proc) { 132 if (emu->proc) {
133 snd_info_unregister(emu->proc); 133 snd_info_unregister(emu->proc);
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 8ccd33f4aa57..f5a832ff362c 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -25,15 +25,15 @@
25 25
26/* Prototypes for static functions */ 26/* Prototypes for static functions */
27static void free_port(void *private); 27static void free_port(void *private);
28static void snd_emux_init_port(snd_emux_port_t *p); 28static void snd_emux_init_port(struct snd_emux_port *p);
29static int snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info); 29static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info);
30static int snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info); 30static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info);
31static int get_client(snd_card_t *card, int index, char *name); 31static int get_client(struct snd_card *card, int index, char *name);
32 32
33/* 33/*
34 * MIDI emulation operators 34 * MIDI emulation operators
35 */ 35 */
36static snd_midi_op_t emux_ops = { 36static struct snd_midi_op emux_ops = {
37 snd_emux_note_on, 37 snd_emux_note_on,
38 snd_emux_note_off, 38 snd_emux_note_off,
39 snd_emux_key_press, 39 snd_emux_key_press,
@@ -65,10 +65,10 @@ static snd_midi_op_t emux_ops = {
65 * can connect to these ports to play midi data. 65 * can connect to these ports to play midi data.
66 */ 66 */
67int 67int
68snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index) 68snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
69{ 69{
70 int i; 70 int i;
71 snd_seq_port_callback_t pinfo; 71 struct snd_seq_port_callback pinfo;
72 char tmpname[64]; 72 char tmpname[64];
73 73
74 sprintf(tmpname, "%s WaveTable", emu->name); 74 sprintf(tmpname, "%s WaveTable", emu->name);
@@ -94,7 +94,7 @@ snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
94 pinfo.event_input = snd_emux_event_input; 94 pinfo.event_input = snd_emux_event_input;
95 95
96 for (i = 0; i < emu->num_ports; i++) { 96 for (i = 0; i < emu->num_ports; i++) {
97 snd_emux_port_t *p; 97 struct snd_emux_port *p;
98 98
99 sprintf(tmpname, "%s Port %d", emu->name, i); 99 sprintf(tmpname, "%s Port %d", emu->name, i);
100 p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS, 100 p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS,
@@ -119,7 +119,7 @@ snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
119 * destroy the kernel client. 119 * destroy the kernel client.
120 */ 120 */
121void 121void
122snd_emux_detach_seq(snd_emux_t *emu) 122snd_emux_detach_seq(struct snd_emux *emu)
123{ 123{
124 if (emu->voices) 124 if (emu->voices)
125 snd_emux_terminate_all(emu); 125 snd_emux_terminate_all(emu);
@@ -137,12 +137,12 @@ snd_emux_detach_seq(snd_emux_t *emu)
137 * create a sequencer port and channel_set 137 * create a sequencer port and channel_set
138 */ 138 */
139 139
140snd_emux_port_t * 140struct snd_emux_port *
141snd_emux_create_port(snd_emux_t *emu, char *name, 141snd_emux_create_port(struct snd_emux *emu, char *name,
142 int max_channels, int oss_port, 142 int max_channels, int oss_port,
143 snd_seq_port_callback_t *callback) 143 struct snd_seq_port_callback *callback)
144{ 144{
145 snd_emux_port_t *p; 145 struct snd_emux_port *p;
146 int i, type, cap; 146 int i, type, cap;
147 147
148 /* Allocate structures for this channel */ 148 /* Allocate structures for this channel */
@@ -150,7 +150,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
150 snd_printk("no memory\n"); 150 snd_printk("no memory\n");
151 return NULL; 151 return NULL;
152 } 152 }
153 p->chset.channels = kcalloc(max_channels, sizeof(snd_midi_channel_t), GFP_KERNEL); 153 p->chset.channels = kcalloc(max_channels, sizeof(struct snd_midi_channel), GFP_KERNEL);
154 if (p->chset.channels == NULL) { 154 if (p->chset.channels == NULL) {
155 snd_printk("no memory\n"); 155 snd_printk("no memory\n");
156 kfree(p); 156 kfree(p);
@@ -190,7 +190,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
190static void 190static void
191free_port(void *private_data) 191free_port(void *private_data)
192{ 192{
193 snd_emux_port_t *p; 193 struct snd_emux_port *p;
194 194
195 p = private_data; 195 p = private_data;
196 if (p) { 196 if (p) {
@@ -209,7 +209,7 @@ free_port(void *private_data)
209 * initialize the port specific parameters 209 * initialize the port specific parameters
210 */ 210 */
211static void 211static void
212snd_emux_init_port(snd_emux_port_t *p) 212snd_emux_init_port(struct snd_emux_port *p)
213{ 213{
214 p->drum_flags = DEFAULT_DRUM_FLAGS; 214 p->drum_flags = DEFAULT_DRUM_FLAGS;
215 p->volume_atten = 0; 215 p->volume_atten = 0;
@@ -222,7 +222,7 @@ snd_emux_init_port(snd_emux_port_t *p)
222 * reset port 222 * reset port
223 */ 223 */
224void 224void
225snd_emux_reset_port(snd_emux_port_t *port) 225snd_emux_reset_port(struct snd_emux_port *port)
226{ 226{
227 int i; 227 int i;
228 228
@@ -241,7 +241,7 @@ snd_emux_reset_port(snd_emux_port_t *port)
241 port->ctrls[EMUX_MD_REALTIME_PAN] = 1; 241 port->ctrls[EMUX_MD_REALTIME_PAN] = 1;
242 242
243 for (i = 0; i < port->chset.max_channels; i++) { 243 for (i = 0; i < port->chset.max_channels; i++) {
244 snd_midi_channel_t *chan = port->chset.channels + i; 244 struct snd_midi_channel *chan = port->chset.channels + i;
245 chan->drum_channel = ((port->drum_flags >> i) & 1) ? 1 : 0; 245 chan->drum_channel = ((port->drum_flags >> i) & 1) ? 1 : 0;
246 } 246 }
247} 247}
@@ -251,10 +251,10 @@ snd_emux_reset_port(snd_emux_port_t *port)
251 * input sequencer event 251 * input sequencer event
252 */ 252 */
253int 253int
254snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private_data, 254snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data,
255 int atomic, int hop) 255 int atomic, int hop)
256{ 256{
257 snd_emux_port_t *port; 257 struct snd_emux_port *port;
258 258
259 port = private_data; 259 port = private_data;
260 snd_assert(port != NULL && ev != NULL, return -EINVAL); 260 snd_assert(port != NULL && ev != NULL, return -EINVAL);
@@ -269,7 +269,7 @@ snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private_data,
269 * increment usage count 269 * increment usage count
270 */ 270 */
271int 271int
272snd_emux_inc_count(snd_emux_t *emu) 272snd_emux_inc_count(struct snd_emux *emu)
273{ 273{
274 emu->used++; 274 emu->used++;
275 if (!try_module_get(emu->ops.owner)) 275 if (!try_module_get(emu->ops.owner))
@@ -288,7 +288,7 @@ snd_emux_inc_count(snd_emux_t *emu)
288 * decrease usage count 288 * decrease usage count
289 */ 289 */
290void 290void
291snd_emux_dec_count(snd_emux_t *emu) 291snd_emux_dec_count(struct snd_emux *emu)
292{ 292{
293 module_put(emu->card->module); 293 module_put(emu->card->module);
294 emu->used--; 294 emu->used--;
@@ -302,10 +302,10 @@ snd_emux_dec_count(snd_emux_t *emu)
302 * Routine that is called upon a first use of a particular port 302 * Routine that is called upon a first use of a particular port
303 */ 303 */
304static int 304static int
305snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info) 305snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
306{ 306{
307 snd_emux_port_t *p; 307 struct snd_emux_port *p;
308 snd_emux_t *emu; 308 struct snd_emux *emu;
309 309
310 p = private_data; 310 p = private_data;
311 snd_assert(p != NULL, return -EINVAL); 311 snd_assert(p != NULL, return -EINVAL);
@@ -323,10 +323,10 @@ snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info)
323 * Routine that is called upon the last unuse() of a particular port. 323 * Routine that is called upon the last unuse() of a particular port.
324 */ 324 */
325static int 325static int
326snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info) 326snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
327{ 327{
328 snd_emux_port_t *p; 328 struct snd_emux_port *p;
329 snd_emux_t *emu; 329 struct snd_emux *emu;
330 330
331 p = private_data; 331 p = private_data;
332 snd_assert(p != NULL, return -EINVAL); 332 snd_assert(p != NULL, return -EINVAL);
@@ -345,10 +345,10 @@ snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info)
345 * Create a sequencer client 345 * Create a sequencer client
346 */ 346 */
347static int 347static int
348get_client(snd_card_t *card, int index, char *name) 348get_client(struct snd_card *card, int index, char *name)
349{ 349{
350 snd_seq_client_callback_t callbacks; 350 struct snd_seq_client_callback callbacks;
351 snd_seq_client_info_t cinfo; 351 struct snd_seq_client_info cinfo;
352 int client; 352 int client;
353 353
354 memset(&callbacks, 0, sizeof(callbacks)); 354 memset(&callbacks, 0, sizeof(callbacks));
@@ -374,7 +374,7 @@ get_client(snd_card_t *card, int index, char *name)
374/* 374/*
375 * attach virtual rawmidi devices 375 * attach virtual rawmidi devices
376 */ 376 */
377int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card) 377int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
378{ 378{
379 int i; 379 int i;
380 380
@@ -382,13 +382,13 @@ int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card)
382 if (emu->midi_ports <= 0) 382 if (emu->midi_ports <= 0)
383 return 0; 383 return 0;
384 384
385 emu->vmidi = kcalloc(emu->midi_ports, sizeof(snd_rawmidi_t*), GFP_KERNEL); 385 emu->vmidi = kcalloc(emu->midi_ports, sizeof(struct snd_rawmidi *), GFP_KERNEL);
386 if (emu->vmidi == NULL) 386 if (emu->vmidi == NULL)
387 return -ENOMEM; 387 return -ENOMEM;
388 388
389 for (i = 0; i < emu->midi_ports; i++) { 389 for (i = 0; i < emu->midi_ports; i++) {
390 snd_rawmidi_t *rmidi; 390 struct snd_rawmidi *rmidi;
391 snd_virmidi_dev_t *rdev; 391 struct snd_virmidi_dev *rdev;
392 if (snd_virmidi_new(card, emu->midi_devidx + i, &rmidi) < 0) 392 if (snd_virmidi_new(card, emu->midi_devidx + i, &rmidi) < 0)
393 goto __error; 393 goto __error;
394 rdev = rmidi->private_data; 394 rdev = rmidi->private_data;
@@ -411,7 +411,7 @@ __error:
411 return -ENOMEM; 411 return -ENOMEM;
412} 412}
413 413
414int snd_emux_delete_virmidi(snd_emux_t *emu) 414int snd_emux_delete_virmidi(struct snd_emux *emu)
415{ 415{
416 int i; 416 int i;
417 417
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index bd71b73be657..c387a83a655e 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -36,30 +36,34 @@
36#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0) 36#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0)
37#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0) 37#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0)
38 38
39static int get_zone(snd_emux_t *emu, snd_emux_port_t *port, int *notep, int vel, snd_midi_channel_t *chan, snd_sf_zone_t **table); 39static int get_zone(struct snd_emux *emu, struct snd_emux_port *port,
40static int get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan); 40 int *notep, int vel, struct snd_midi_channel *chan,
41static void terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free); 41 struct snd_sf_zone **table);
42static void exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass); 42static int get_bank(struct snd_emux_port *port, struct snd_midi_channel *chan);
43static void terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free); 43static void terminate_note1(struct snd_emux *emu, int note,
44static void update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update); 44 struct snd_midi_channel *chan, int free);
45static void setup_voice(snd_emux_voice_t *vp); 45static void exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port,
46static int calc_pan(snd_emux_voice_t *vp); 46 int exclass);
47static int calc_volume(snd_emux_voice_t *vp); 47static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
48static int calc_pitch(snd_emux_voice_t *vp); 48static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
49static void setup_voice(struct snd_emux_voice *vp);
50static int calc_pan(struct snd_emux_voice *vp);
51static int calc_volume(struct snd_emux_voice *vp);
52static int calc_pitch(struct snd_emux_voice *vp);
49 53
50 54
51/* 55/*
52 * Start a note. 56 * Start a note.
53 */ 57 */
54void 58void
55snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) 59snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
56{ 60{
57 snd_emux_t *emu; 61 struct snd_emux *emu;
58 int i, key, nvoices; 62 int i, key, nvoices;
59 snd_emux_voice_t *vp; 63 struct snd_emux_voice *vp;
60 snd_sf_zone_t *table[SNDRV_EMUX_MAX_MULTI_VOICES]; 64 struct snd_sf_zone *table[SNDRV_EMUX_MAX_MULTI_VOICES];
61 unsigned long flags; 65 unsigned long flags;
62 snd_emux_port_t *port; 66 struct snd_emux_port *port;
63 67
64 port = p; 68 port = p;
65 snd_assert(port != NULL && chan != NULL, return); 69 snd_assert(port != NULL && chan != NULL, return);
@@ -76,7 +80,7 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
76 80
77 /* exclusive note off */ 81 /* exclusive note off */
78 for (i = 0; i < nvoices; i++) { 82 for (i = 0; i < nvoices; i++) {
79 snd_sf_zone_t *zp = table[i]; 83 struct snd_sf_zone *zp = table[i];
80 if (zp && zp->v.exclusiveClass) 84 if (zp && zp->v.exclusiveClass)
81 exclusive_note_off(emu, port, zp->v.exclusiveClass); 85 exclusive_note_off(emu, port, zp->v.exclusiveClass);
82 } 86 }
@@ -138,7 +142,7 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
138#ifdef SNDRV_EMUX_USE_RAW_EFFECT 142#ifdef SNDRV_EMUX_USE_RAW_EFFECT
139 if (port->port_mode == SNDRV_EMUX_PORT_MODE_OSS_SYNTH) { 143 if (port->port_mode == SNDRV_EMUX_PORT_MODE_OSS_SYNTH) {
140 /* clear voice position for the next note on this channel */ 144 /* clear voice position for the next note on this channel */
141 snd_emux_effect_table_t *fx = chan->private; 145 struct snd_emux_effect_table *fx = chan->private;
142 if (fx) { 146 if (fx) {
143 fx->flag[EMUX_FX_SAMPLE_START] = 0; 147 fx->flag[EMUX_FX_SAMPLE_START] = 0;
144 fx->flag[EMUX_FX_COARSE_SAMPLE_START] = 0; 148 fx->flag[EMUX_FX_COARSE_SAMPLE_START] = 0;
@@ -151,13 +155,13 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
151 * Release a note in response to a midi note off. 155 * Release a note in response to a midi note off.
152 */ 156 */
153void 157void
154snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan) 158snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan)
155{ 159{
156 int ch; 160 int ch;
157 snd_emux_t *emu; 161 struct snd_emux *emu;
158 snd_emux_voice_t *vp; 162 struct snd_emux_voice *vp;
159 unsigned long flags; 163 unsigned long flags;
160 snd_emux_port_t *port; 164 struct snd_emux_port *port;
161 165
162 port = p; 166 port = p;
163 snd_assert(port != NULL && chan != NULL, return); 167 snd_assert(port != NULL && chan != NULL, return);
@@ -199,8 +203,8 @@ snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan)
199 */ 203 */
200void snd_emux_timer_callback(unsigned long data) 204void snd_emux_timer_callback(unsigned long data)
201{ 205{
202 snd_emux_t *emu = (snd_emux_t*) data; 206 struct snd_emux *emu = (struct snd_emux *) data;
203 snd_emux_voice_t *vp; 207 struct snd_emux_voice *vp;
204 int ch, do_again = 0; 208 int ch, do_again = 0;
205 209
206 spin_lock(&emu->voice_lock); 210 spin_lock(&emu->voice_lock);
@@ -228,13 +232,13 @@ void snd_emux_timer_callback(unsigned long data)
228 * key pressure change 232 * key pressure change
229 */ 233 */
230void 234void
231snd_emux_key_press(void *p, int note, int vel, snd_midi_channel_t *chan) 235snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan)
232{ 236{
233 int ch; 237 int ch;
234 snd_emux_t *emu; 238 struct snd_emux *emu;
235 snd_emux_voice_t *vp; 239 struct snd_emux_voice *vp;
236 unsigned long flags; 240 unsigned long flags;
237 snd_emux_port_t *port; 241 struct snd_emux_port *port;
238 242
239 port = p; 243 port = p;
240 snd_assert(port != NULL && chan != NULL, return); 244 snd_assert(port != NULL && chan != NULL, return);
@@ -260,10 +264,10 @@ snd_emux_key_press(void *p, int note, int vel, snd_midi_channel_t *chan)
260 * Modulate the voices which belong to the channel 264 * Modulate the voices which belong to the channel
261 */ 265 */
262void 266void
263snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int update) 267snd_emux_update_channel(struct snd_emux_port *port, struct snd_midi_channel *chan, int update)
264{ 268{
265 snd_emux_t *emu; 269 struct snd_emux *emu;
266 snd_emux_voice_t *vp; 270 struct snd_emux_voice *vp;
267 int i; 271 int i;
268 unsigned long flags; 272 unsigned long flags;
269 273
@@ -287,10 +291,10 @@ snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int upd
287 * Modulate all the voices which belong to the port. 291 * Modulate all the voices which belong to the port.
288 */ 292 */
289void 293void
290snd_emux_update_port(snd_emux_port_t *port, int update) 294snd_emux_update_port(struct snd_emux_port *port, int update)
291{ 295{
292 snd_emux_t *emu; 296 struct snd_emux *emu;
293 snd_emux_voice_t *vp; 297 struct snd_emux_voice *vp;
294 int i; 298 int i;
295 unsigned long flags; 299 unsigned long flags;
296 300
@@ -316,9 +320,9 @@ snd_emux_update_port(snd_emux_port_t *port, int update)
316 * control events, not just the midi controllers 320 * control events, not just the midi controllers
317 */ 321 */
318void 322void
319snd_emux_control(void *p, int type, snd_midi_channel_t *chan) 323snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
320{ 324{
321 snd_emux_port_t *port; 325 struct snd_emux_port *port;
322 326
323 port = p; 327 port = p;
324 snd_assert(port != NULL && chan != NULL, return); 328 snd_assert(port != NULL && chan != NULL, return);
@@ -364,10 +368,10 @@ snd_emux_control(void *p, int type, snd_midi_channel_t *chan)
364 * terminate note - if free flag is true, free the terminated voice 368 * terminate note - if free flag is true, free the terminated voice
365 */ 369 */
366static void 370static void
367terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free) 371terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free)
368{ 372{
369 int i; 373 int i;
370 snd_emux_voice_t *vp; 374 struct snd_emux_voice *vp;
371 unsigned long flags; 375 unsigned long flags;
372 376
373 spin_lock_irqsave(&emu->voice_lock, flags); 377 spin_lock_irqsave(&emu->voice_lock, flags);
@@ -385,10 +389,10 @@ terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free)
385 * terminate note - exported for midi emulation 389 * terminate note - exported for midi emulation
386 */ 390 */
387void 391void
388snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan) 392snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan)
389{ 393{
390 snd_emux_t *emu; 394 struct snd_emux *emu;
391 snd_emux_port_t *port; 395 struct snd_emux_port *port;
392 396
393 port = p; 397 port = p;
394 snd_assert(port != NULL && chan != NULL, return); 398 snd_assert(port != NULL && chan != NULL, return);
@@ -405,10 +409,10 @@ snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan)
405 * Terminate all the notes 409 * Terminate all the notes
406 */ 410 */
407void 411void
408snd_emux_terminate_all(snd_emux_t *emu) 412snd_emux_terminate_all(struct snd_emux *emu)
409{ 413{
410 int i; 414 int i;
411 snd_emux_voice_t *vp; 415 struct snd_emux_voice *vp;
412 unsigned long flags; 416 unsigned long flags;
413 417
414 spin_lock_irqsave(&emu->voice_lock, flags); 418 spin_lock_irqsave(&emu->voice_lock, flags);
@@ -434,11 +438,11 @@ snd_emux_terminate_all(snd_emux_t *emu)
434 * Terminate all voices associated with the given port 438 * Terminate all voices associated with the given port
435 */ 439 */
436void 440void
437snd_emux_sounds_off_all(snd_emux_port_t *port) 441snd_emux_sounds_off_all(struct snd_emux_port *port)
438{ 442{
439 int i; 443 int i;
440 snd_emux_t *emu; 444 struct snd_emux *emu;
441 snd_emux_voice_t *vp; 445 struct snd_emux_voice *vp;
442 unsigned long flags; 446 unsigned long flags;
443 447
444 snd_assert(port != NULL, return); 448 snd_assert(port != NULL, return);
@@ -468,9 +472,9 @@ snd_emux_sounds_off_all(snd_emux_port_t *port)
468 * is mainly for drums. 472 * is mainly for drums.
469 */ 473 */
470static void 474static void
471exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass) 475exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port, int exclass)
472{ 476{
473 snd_emux_voice_t *vp; 477 struct snd_emux_voice *vp;
474 int i; 478 int i;
475 unsigned long flags; 479 unsigned long flags;
476 480
@@ -490,7 +494,7 @@ exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass)
490 * if free flag is true, call free_voice after termination 494 * if free flag is true, call free_voice after termination
491 */ 495 */
492static void 496static void
493terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free) 497terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free)
494{ 498{
495 emu->ops.terminate(vp); 499 emu->ops.terminate(vp);
496 vp->time = emu->use_time++; 500 vp->time = emu->use_time++;
@@ -508,7 +512,7 @@ terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free)
508 * Modulate the voice 512 * Modulate the voice
509 */ 513 */
510static void 514static void
511update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update) 515update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update)
512{ 516{
513 if (!STATE_IS_PLAYING(vp->state)) 517 if (!STATE_IS_PLAYING(vp->state))
514 return; 518 return;
@@ -543,9 +547,9 @@ static unsigned short voltarget[16] = {
543 * will be needed later. 547 * will be needed later.
544 */ 548 */
545static void 549static void
546setup_voice(snd_emux_voice_t *vp) 550setup_voice(struct snd_emux_voice *vp)
547{ 551{
548 soundfont_voice_parm_t *parm; 552 struct soundfont_voice_parm *parm;
549 int pitch; 553 int pitch;
550 554
551 /* copy the original register values */ 555 /* copy the original register values */
@@ -636,9 +640,9 @@ static unsigned char pan_volumes[256] = {
636}; 640};
637 641
638static int 642static int
639calc_pan(snd_emux_voice_t *vp) 643calc_pan(struct snd_emux_voice *vp)
640{ 644{
641 snd_midi_channel_t *chan = vp->chan; 645 struct snd_midi_channel *chan = vp->chan;
642 int pan; 646 int pan;
643 647
644 /* pan & loop start (pan 8bit, MSB, 0:right, 0xff:left) */ 648 /* pan & loop start (pan 8bit, MSB, 0:right, 0xff:left) */
@@ -737,12 +741,12 @@ static unsigned char expressiontab[128] = {
737 * voice and channels parameters. 741 * voice and channels parameters.
738 */ 742 */
739static int 743static int
740calc_volume(snd_emux_voice_t *vp) 744calc_volume(struct snd_emux_voice *vp)
741{ 745{
742 int vol; 746 int vol;
743 int main_vol, expression_vol, master_vol; 747 int main_vol, expression_vol, master_vol;
744 snd_midi_channel_t *chan = vp->chan; 748 struct snd_midi_channel *chan = vp->chan;
745 snd_emux_port_t *port = vp->port; 749 struct snd_emux_port *port = vp->port;
746 750
747 expression_vol = chan->control[MIDI_CTL_MSB_EXPRESSION]; 751 expression_vol = chan->control[MIDI_CTL_MSB_EXPRESSION];
748 LIMITMAX(vp->velocity, 127); 752 LIMITMAX(vp->velocity, 127);
@@ -775,7 +779,7 @@ calc_volume(snd_emux_voice_t *vp)
775 779
776#ifdef SNDRV_EMUX_USE_RAW_EFFECT 780#ifdef SNDRV_EMUX_USE_RAW_EFFECT
777 if (chan->private) { 781 if (chan->private) {
778 snd_emux_effect_table_t *fx = chan->private; 782 struct snd_emux_effect_table *fx = chan->private;
779 vol += fx->val[EMUX_FX_ATTEN]; 783 vol += fx->val[EMUX_FX_ATTEN];
780 } 784 }
781#endif 785#endif
@@ -808,9 +812,9 @@ calc_volume(snd_emux_voice_t *vp)
808 */ 812 */
809 813
810static int 814static int
811calc_pitch(snd_emux_voice_t *vp) 815calc_pitch(struct snd_emux_voice *vp)
812{ 816{
813 snd_midi_channel_t *chan = vp->chan; 817 struct snd_midi_channel *chan = vp->chan;
814 int offset; 818 int offset;
815 819
816 /* calculate offset */ 820 /* calculate offset */
@@ -837,7 +841,7 @@ calc_pitch(snd_emux_voice_t *vp)
837#ifdef SNDRV_EMUX_USE_RAW_EFFECT 841#ifdef SNDRV_EMUX_USE_RAW_EFFECT
838 /* add initial pitch correction */ 842 /* add initial pitch correction */
839 if (chan->private) { 843 if (chan->private) {
840 snd_emux_effect_table_t *fx = chan->private; 844 struct snd_emux_effect_table *fx = chan->private;
841 if (fx->flag[EMUX_FX_INIT_PITCH]) 845 if (fx->flag[EMUX_FX_INIT_PITCH])
842 offset += fx->val[EMUX_FX_INIT_PITCH]; 846 offset += fx->val[EMUX_FX_INIT_PITCH];
843 } 847 }
@@ -857,7 +861,7 @@ calc_pitch(snd_emux_voice_t *vp)
857 * Get the bank number assigned to the channel 861 * Get the bank number assigned to the channel
858 */ 862 */
859static int 863static int
860get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan) 864get_bank(struct snd_emux_port *port, struct snd_midi_channel *chan)
861{ 865{
862 int val; 866 int val;
863 867
@@ -886,8 +890,9 @@ get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan)
886 * The resultant zones are stored on table. 890 * The resultant zones are stored on table.
887 */ 891 */
888static int 892static int
889get_zone(snd_emux_t *emu, snd_emux_port_t *port, 893get_zone(struct snd_emux *emu, struct snd_emux_port *port,
890 int *notep, int vel, snd_midi_channel_t *chan, snd_sf_zone_t **table) 894 int *notep, int vel, struct snd_midi_channel *chan,
895 struct snd_sf_zone **table)
891{ 896{
892 int preset, bank, def_preset, def_bank; 897 int preset, bank, def_preset, def_bank;
893 898
@@ -910,9 +915,9 @@ get_zone(snd_emux_t *emu, snd_emux_port_t *port,
910/* 915/*
911 */ 916 */
912void 917void
913snd_emux_init_voices(snd_emux_t *emu) 918snd_emux_init_voices(struct snd_emux *emu)
914{ 919{
915 snd_emux_voice_t *vp; 920 struct snd_emux_voice *vp;
916 int i; 921 int i;
917 unsigned long flags; 922 unsigned long flags;
918 923
@@ -932,7 +937,7 @@ snd_emux_init_voices(snd_emux_t *emu)
932 937
933/* 938/*
934 */ 939 */
935void snd_emux_lock_voice(snd_emux_t *emu, int voice) 940void snd_emux_lock_voice(struct snd_emux *emu, int voice)
936{ 941{
937 unsigned long flags; 942 unsigned long flags;
938 943
@@ -947,7 +952,7 @@ void snd_emux_lock_voice(snd_emux_t *emu, int voice)
947 952
948/* 953/*
949 */ 954 */
950void snd_emux_unlock_voice(snd_emux_t *emu, int voice) 955void snd_emux_unlock_voice(struct snd_emux *emu, int voice)
951{ 956{
952 unsigned long flags; 957 unsigned long flags;
953 958
diff --git a/sound/synth/emux/emux_voice.h b/sound/synth/emux/emux_voice.h
index 67eb55348cdf..0a56ca18b165 100644
--- a/sound/synth/emux/emux_voice.h
+++ b/sound/synth/emux/emux_voice.h
@@ -29,60 +29,69 @@
29#include <sound/emux_synth.h> 29#include <sound/emux_synth.h>
30 30
31/* Prototypes for emux_seq.c */ 31/* Prototypes for emux_seq.c */
32int snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index); 32int snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index);
33void snd_emux_detach_seq(snd_emux_t *emu); 33void snd_emux_detach_seq(struct snd_emux *emu);
34snd_emux_port_t *snd_emux_create_port(snd_emux_t *emu, char *name, int max_channels, int type, snd_seq_port_callback_t *callback); 34struct snd_emux_port *snd_emux_create_port(struct snd_emux *emu, char *name,
35void snd_emux_reset_port(snd_emux_port_t *port); 35 int max_channels, int type,
36int snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop); 36 struct snd_seq_port_callback *callback);
37int snd_emux_inc_count(snd_emux_t *emu); 37void snd_emux_reset_port(struct snd_emux_port *port);
38void snd_emux_dec_count(snd_emux_t *emu); 38int snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private,
39int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card); 39 int atomic, int hop);
40int snd_emux_delete_virmidi(snd_emux_t *emu); 40int snd_emux_inc_count(struct snd_emux *emu);
41void snd_emux_dec_count(struct snd_emux *emu);
42int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card);
43int snd_emux_delete_virmidi(struct snd_emux *emu);
41 44
42/* Prototypes for emux_synth.c */ 45/* Prototypes for emux_synth.c */
43void snd_emux_init_voices(snd_emux_t *emu); 46void snd_emux_init_voices(struct snd_emux *emu);
44 47
45void snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan); 48void snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan);
46void snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan); 49void snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan);
47void snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan); 50void snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan);
48void snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan); 51void snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan);
49void snd_emux_control(void *p, int type, struct snd_midi_channel *chan); 52void snd_emux_control(void *p, int type, struct snd_midi_channel *chan);
50 53
51void snd_emux_sounds_off_all(snd_emux_port_t *port); 54void snd_emux_sounds_off_all(struct snd_emux_port *port);
52void snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int update); 55void snd_emux_update_channel(struct snd_emux_port *port,
53void snd_emux_update_port(snd_emux_port_t *port, int update); 56 struct snd_midi_channel *chan, int update);
57void snd_emux_update_port(struct snd_emux_port *port, int update);
54 58
55void snd_emux_timer_callback(unsigned long data); 59void snd_emux_timer_callback(unsigned long data);
56 60
57/* emux_effect.c */ 61/* emux_effect.c */
58#ifdef SNDRV_EMUX_USE_RAW_EFFECT 62#ifdef SNDRV_EMUX_USE_RAW_EFFECT
59void snd_emux_create_effect(snd_emux_port_t *p); 63void snd_emux_create_effect(struct snd_emux_port *p);
60void snd_emux_delete_effect(snd_emux_port_t *p); 64void snd_emux_delete_effect(struct snd_emux_port *p);
61void snd_emux_clear_effect(snd_emux_port_t *p); 65void snd_emux_clear_effect(struct snd_emux_port *p);
62void snd_emux_setup_effect(snd_emux_voice_t *vp); 66void snd_emux_setup_effect(struct snd_emux_voice *vp);
63void snd_emux_send_effect_oss(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val); 67void snd_emux_send_effect_oss(struct snd_emux_port *port,
64void snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val, int mode); 68 struct snd_midi_channel *chan, int type, int val);
69void snd_emux_send_effect(struct snd_emux_port *port,
70 struct snd_midi_channel *chan, int type, int val, int mode);
65#endif 71#endif
66 72
67/* emux_nrpn.c */ 73/* emux_nrpn.c */
68void snd_emux_sysex(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 74void snd_emux_sysex(void *private_data, unsigned char *buf, int len,
69int snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param); 75 int parsed, struct snd_midi_channel_set *chset);
70void snd_emux_nrpn(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 76int snd_emux_xg_control(struct snd_emux_port *port,
77 struct snd_midi_channel *chan, int param);
78void snd_emux_nrpn(void *private_data, struct snd_midi_channel *chan,
79 struct snd_midi_channel_set *chset);
71 80
72/* emux_oss.c */ 81/* emux_oss.c */
73void snd_emux_init_seq_oss(snd_emux_t *emu); 82void snd_emux_init_seq_oss(struct snd_emux *emu);
74void snd_emux_detach_seq_oss(snd_emux_t *emu); 83void snd_emux_detach_seq_oss(struct snd_emux *emu);
75 84
76/* emux_proc.c */ 85/* emux_proc.c */
77#ifdef CONFIG_PROC_FS 86#ifdef CONFIG_PROC_FS
78void snd_emux_proc_init(snd_emux_t *emu, snd_card_t *card, int device); 87void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device);
79void snd_emux_proc_free(snd_emux_t *emu); 88void snd_emux_proc_free(struct snd_emux *emu);
80#endif 89#endif
81 90
82#define STATE_IS_PLAYING(s) ((s) & SNDRV_EMUX_ST_ON) 91#define STATE_IS_PLAYING(s) ((s) & SNDRV_EMUX_ST_ON)
83 92
84/* emux_hwdep.c */ 93/* emux_hwdep.c */
85int snd_emux_init_hwdep(snd_emux_t *emu); 94int snd_emux_init_hwdep(struct snd_emux *emu);
86void snd_emux_delete_hwdep(snd_emux_t *emu); 95void snd_emux_delete_hwdep(struct snd_emux *emu);
87 96
88#endif 97#endif
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
index d0925ea50838..4c5754d4a2e8 100644
--- a/sound/synth/emux/soundfont.c
+++ b/sound/synth/emux/soundfont.c
@@ -34,38 +34,49 @@
34 34
35/* Prototypes for static functions */ 35/* Prototypes for static functions */
36 36
37static int open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client); 37static int open_patch(struct snd_sf_list *sflist, const char __user *data,
38static snd_soundfont_t *newsf(snd_sf_list_t *sflist, int type, char *name); 38 int count, int client);
39static int is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name); 39static struct snd_soundfont *newsf(struct snd_sf_list *sflist, int type, char *name);
40static int close_patch(snd_sf_list_t *sflist); 40static int is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name);
41static int probe_data(snd_sf_list_t *sflist, int sample_id); 41static int close_patch(struct snd_sf_list *sflist);
42static void set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp); 42static int probe_data(struct snd_sf_list *sflist, int sample_id);
43static snd_sf_zone_t *sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf); 43static void set_zone_counter(struct snd_sf_list *sflist,
44static void set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp); 44 struct snd_soundfont *sf, struct snd_sf_zone *zp);
45static snd_sf_sample_t *sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf); 45static struct snd_sf_zone *sf_zone_new(struct snd_sf_list *sflist,
46static void sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp); 46 struct snd_soundfont *sf);
47static int load_map(snd_sf_list_t *sflist, const void __user *data, int count); 47static void set_sample_counter(struct snd_sf_list *sflist,
48static int load_info(snd_sf_list_t *sflist, const void __user *data, long count); 48 struct snd_soundfont *sf, struct snd_sf_sample *sp);
49static int remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr); 49static struct snd_sf_sample *sf_sample_new(struct snd_sf_list *sflist,
50static void init_voice_info(soundfont_voice_info_t *avp); 50 struct snd_soundfont *sf);
51static void init_voice_parm(soundfont_voice_parm_t *pp); 51static void sf_sample_delete(struct snd_sf_list *sflist,
52static snd_sf_sample_t *set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp); 52 struct snd_soundfont *sf, struct snd_sf_sample *sp);
53static snd_sf_sample_t *find_sample(snd_soundfont_t *sf, int sample_id); 53static int load_map(struct snd_sf_list *sflist, const void __user *data, int count);
54static int load_data(snd_sf_list_t *sflist, const void __user *data, long count); 54static int load_info(struct snd_sf_list *sflist, const void __user *data, long count);
55static void rebuild_presets(snd_sf_list_t *sflist); 55static int remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
56static void add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur); 56 int bank, int instr);
57static void delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp); 57static void init_voice_info(struct soundfont_voice_info *avp);
58static snd_sf_zone_t *search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key); 58static void init_voice_parm(struct soundfont_voice_parm *pp);
59static int search_zones(snd_sf_list_t *sflist, int *notep, int vel, int preset, int bank, snd_sf_zone_t **table, int max_layers, int level); 59static struct snd_sf_sample *set_sample(struct snd_soundfont *sf,
60 struct soundfont_voice_info *avp);
61static struct snd_sf_sample *find_sample(struct snd_soundfont *sf, int sample_id);
62static int load_data(struct snd_sf_list *sflist, const void __user *data, long count);
63static void rebuild_presets(struct snd_sf_list *sflist);
64static void add_preset(struct snd_sf_list *sflist, struct snd_sf_zone *cur);
65static void delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp);
66static struct snd_sf_zone *search_first_zone(struct snd_sf_list *sflist,
67 int bank, int preset, int key);
68static int search_zones(struct snd_sf_list *sflist, int *notep, int vel,
69 int preset, int bank, struct snd_sf_zone **table,
70 int max_layers, int level);
60static int get_index(int bank, int instr, int key); 71static int get_index(int bank, int instr, int key);
61static void snd_sf_init(snd_sf_list_t *sflist); 72static void snd_sf_init(struct snd_sf_list *sflist);
62static void snd_sf_clear(snd_sf_list_t *sflist); 73static void snd_sf_clear(struct snd_sf_list *sflist);
63 74
64/* 75/*
65 * lock access to sflist 76 * lock access to sflist
66 */ 77 */
67static void 78static void
68lock_preset(snd_sf_list_t *sflist) 79lock_preset(struct snd_sf_list *sflist)
69{ 80{
70 unsigned long flags; 81 unsigned long flags;
71 down(&sflist->presets_mutex); 82 down(&sflist->presets_mutex);
@@ -79,7 +90,7 @@ lock_preset(snd_sf_list_t *sflist)
79 * remove lock 90 * remove lock
80 */ 91 */
81static void 92static void
82unlock_preset(snd_sf_list_t *sflist) 93unlock_preset(struct snd_sf_list *sflist)
83{ 94{
84 unsigned long flags; 95 unsigned long flags;
85 spin_lock_irqsave(&sflist->lock, flags); 96 spin_lock_irqsave(&sflist->lock, flags);
@@ -93,7 +104,7 @@ unlock_preset(snd_sf_list_t *sflist)
93 * close the patch if the patch was opened by this client. 104 * close the patch if the patch was opened by this client.
94 */ 105 */
95int 106int
96snd_soundfont_close_check(snd_sf_list_t *sflist, int client) 107snd_soundfont_close_check(struct snd_sf_list *sflist, int client)
97{ 108{
98 unsigned long flags; 109 unsigned long flags;
99 spin_lock_irqsave(&sflist->lock, flags); 110 spin_lock_irqsave(&sflist->lock, flags);
@@ -115,9 +126,10 @@ snd_soundfont_close_check(snd_sf_list_t *sflist, int client)
115 * it wants to do with it. 126 * it wants to do with it.
116 */ 127 */
117int 128int
118snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client) 129snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
130 long count, int client)
119{ 131{
120 soundfont_patch_info_t patch; 132 struct soundfont_patch_info patch;
121 unsigned long flags; 133 unsigned long flags;
122 int rc; 134 int rc;
123 135
@@ -215,10 +227,11 @@ is_special_type(int type)
215 227
216/* open patch; create sf list */ 228/* open patch; create sf list */
217static int 229static int
218open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client) 230open_patch(struct snd_sf_list *sflist, const char __user *data,
231 int count, int client)
219{ 232{
220 soundfont_open_parm_t parm; 233 struct soundfont_open_parm parm;
221 snd_soundfont_t *sf; 234 struct snd_soundfont *sf;
222 unsigned long flags; 235 unsigned long flags;
223 236
224 spin_lock_irqsave(&sflist->lock, flags); 237 spin_lock_irqsave(&sflist->lock, flags);
@@ -251,10 +264,10 @@ open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client
251/* 264/*
252 * Allocate a new soundfont structure. 265 * Allocate a new soundfont structure.
253 */ 266 */
254static snd_soundfont_t * 267static struct snd_soundfont *
255newsf(snd_sf_list_t *sflist, int type, char *name) 268newsf(struct snd_sf_list *sflist, int type, char *name)
256{ 269{
257 snd_soundfont_t *sf; 270 struct snd_soundfont *sf;
258 271
259 /* check the shared fonts */ 272 /* check the shared fonts */
260 if (type & SNDRV_SFNT_PAT_SHARED) { 273 if (type & SNDRV_SFNT_PAT_SHARED) {
@@ -287,7 +300,7 @@ newsf(snd_sf_list_t *sflist, int type, char *name)
287 300
288/* check if the given name matches to the existing list */ 301/* check if the given name matches to the existing list */
289static int 302static int
290is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name) 303is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name)
291{ 304{
292 return ((sf->type & SNDRV_SFNT_PAT_SHARED) && 305 return ((sf->type & SNDRV_SFNT_PAT_SHARED) &&
293 (sf->type & 0x0f) == (type & 0x0f) && 306 (sf->type & 0x0f) == (type & 0x0f) &&
@@ -299,7 +312,7 @@ is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name)
299 * Close the current patch. 312 * Close the current patch.
300 */ 313 */
301static int 314static int
302close_patch(snd_sf_list_t *sflist) 315close_patch(struct snd_sf_list *sflist)
303{ 316{
304 unsigned long flags; 317 unsigned long flags;
305 318
@@ -316,7 +329,7 @@ close_patch(snd_sf_list_t *sflist)
316 329
317/* probe sample in the current list -- nothing to be loaded */ 330/* probe sample in the current list -- nothing to be loaded */
318static int 331static int
319probe_data(snd_sf_list_t *sflist, int sample_id) 332probe_data(struct snd_sf_list *sflist, int sample_id)
320{ 333{
321 /* patch must be opened */ 334 /* patch must be opened */
322 if (sflist->currsf) { 335 if (sflist->currsf) {
@@ -331,7 +344,8 @@ probe_data(snd_sf_list_t *sflist, int sample_id)
331 * increment zone counter 344 * increment zone counter
332 */ 345 */
333static void 346static void
334set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp) 347set_zone_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
348 struct snd_sf_zone *zp)
335{ 349{
336 zp->counter = sflist->zone_counter++; 350 zp->counter = sflist->zone_counter++;
337 if (sf->type & SNDRV_SFNT_PAT_LOCKED) 351 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
@@ -341,10 +355,10 @@ set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp)
341/* 355/*
342 * allocate a new zone record 356 * allocate a new zone record
343 */ 357 */
344static snd_sf_zone_t * 358static struct snd_sf_zone *
345sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf) 359sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
346{ 360{
347 snd_sf_zone_t *zp; 361 struct snd_sf_zone *zp;
348 362
349 if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL) 363 if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL)
350 return NULL; 364 return NULL;
@@ -362,7 +376,8 @@ sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
362 * increment sample couter 376 * increment sample couter
363 */ 377 */
364static void 378static void
365set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp) 379set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
380 struct snd_sf_sample *sp)
366{ 381{
367 sp->counter = sflist->sample_counter++; 382 sp->counter = sflist->sample_counter++;
368 if (sf->type & SNDRV_SFNT_PAT_LOCKED) 383 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
@@ -372,10 +387,10 @@ set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *
372/* 387/*
373 * allocate a new sample list record 388 * allocate a new sample list record
374 */ 389 */
375static snd_sf_sample_t * 390static struct snd_sf_sample *
376sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf) 391sf_sample_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
377{ 392{
378 snd_sf_sample_t *sp; 393 struct snd_sf_sample *sp;
379 394
380 if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL) 395 if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL)
381 return NULL; 396 return NULL;
@@ -392,7 +407,8 @@ sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
392 * only the last allocated sample can be deleted. 407 * only the last allocated sample can be deleted.
393 */ 408 */
394static void 409static void
395sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp) 410sf_sample_delete(struct snd_sf_list *sflist, struct snd_soundfont *sf,
411 struct snd_sf_sample *sp)
396{ 412{
397 /* only last sample is accepted */ 413 /* only last sample is accepted */
398 if (sp == sf->samples) { 414 if (sp == sf->samples) {
@@ -404,11 +420,11 @@ sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp
404 420
405/* load voice map */ 421/* load voice map */
406static int 422static int
407load_map(snd_sf_list_t *sflist, const void __user *data, int count) 423load_map(struct snd_sf_list *sflist, const void __user *data, int count)
408{ 424{
409 snd_sf_zone_t *zp, *prevp; 425 struct snd_sf_zone *zp, *prevp;
410 snd_soundfont_t *sf; 426 struct snd_soundfont *sf;
411 soundfont_voice_map_t map; 427 struct soundfont_voice_map map;
412 428
413 /* get the link info */ 429 /* get the link info */
414 if (count < (int)sizeof(map)) 430 if (count < (int)sizeof(map))
@@ -469,9 +485,10 @@ load_map(snd_sf_list_t *sflist, const void __user *data, int count)
469 485
470/* remove the present instrument layers */ 486/* remove the present instrument layers */
471static int 487static int
472remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr) 488remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
489 int bank, int instr)
473{ 490{
474 snd_sf_zone_t *prev, *next, *p; 491 struct snd_sf_zone *prev, *next, *p;
475 int removed = 0; 492 int removed = 0;
476 493
477 prev = NULL; 494 prev = NULL;
@@ -500,11 +517,11 @@ remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr)
500 * open soundfont. 517 * open soundfont.
501 */ 518 */
502static int 519static int
503load_info(snd_sf_list_t *sflist, const void __user *data, long count) 520load_info(struct snd_sf_list *sflist, const void __user *data, long count)
504{ 521{
505 snd_soundfont_t *sf; 522 struct snd_soundfont *sf;
506 snd_sf_zone_t *zone; 523 struct snd_sf_zone *zone;
507 soundfont_voice_rec_hdr_t hdr; 524 struct soundfont_voice_rec_hdr hdr;
508 int i; 525 int i;
509 526
510 /* patch must be opened */ 527 /* patch must be opened */
@@ -529,7 +546,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
529 return -EINVAL; 546 return -EINVAL;
530 } 547 }
531 548
532 if (count < (long)sizeof(soundfont_voice_info_t)*hdr.nvoices) { 549 if (count < (long)sizeof(struct soundfont_voice_info) * hdr.nvoices) {
533 printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n", 550 printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n",
534 count, hdr.nvoices); 551 count, hdr.nvoices);
535 return -EINVAL; 552 return -EINVAL;
@@ -553,7 +570,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
553 } 570 }
554 571
555 for (i = 0; i < hdr.nvoices; i++) { 572 for (i = 0; i < hdr.nvoices; i++) {
556 snd_sf_zone_t tmpzone; 573 struct snd_sf_zone tmpzone;
557 574
558 /* copy awe_voice_info parameters */ 575 /* copy awe_voice_info parameters */
559 if (copy_from_user(&tmpzone.v, data, sizeof(tmpzone.v))) { 576 if (copy_from_user(&tmpzone.v, data, sizeof(tmpzone.v))) {
@@ -590,7 +607,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
590 607
591/* initialize voice_info record */ 608/* initialize voice_info record */
592static void 609static void
593init_voice_info(soundfont_voice_info_t *avp) 610init_voice_info(struct soundfont_voice_info *avp)
594{ 611{
595 memset(avp, 0, sizeof(*avp)); 612 memset(avp, 0, sizeof(*avp));
596 613
@@ -614,7 +631,7 @@ init_voice_info(soundfont_voice_info_t *avp)
614 * Chorus and Reverb effects are zero. 631 * Chorus and Reverb effects are zero.
615 */ 632 */
616static void 633static void
617init_voice_parm(soundfont_voice_parm_t *pp) 634init_voice_parm(struct soundfont_voice_parm *pp)
618{ 635{
619 memset(pp, 0, sizeof(*pp)); 636 memset(pp, 0, sizeof(*pp));
620 637
@@ -635,10 +652,10 @@ init_voice_parm(soundfont_voice_parm_t *pp)
635} 652}
636 653
637/* search the specified sample */ 654/* search the specified sample */
638static snd_sf_sample_t * 655static struct snd_sf_sample *
639set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp) 656set_sample(struct snd_soundfont *sf, struct soundfont_voice_info *avp)
640{ 657{
641 snd_sf_sample_t *sample; 658 struct snd_sf_sample *sample;
642 659
643 sample = find_sample(sf, avp->sample); 660 sample = find_sample(sf, avp->sample);
644 if (sample == NULL) 661 if (sample == NULL)
@@ -661,10 +678,10 @@ set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp)
661} 678}
662 679
663/* find the sample pointer with the given id in the soundfont */ 680/* find the sample pointer with the given id in the soundfont */
664static snd_sf_sample_t * 681static struct snd_sf_sample *
665find_sample(snd_soundfont_t *sf, int sample_id) 682find_sample(struct snd_soundfont *sf, int sample_id)
666{ 683{
667 snd_sf_sample_t *p; 684 struct snd_sf_sample *p;
668 685
669 if (sf == NULL) 686 if (sf == NULL)
670 return NULL; 687 return NULL;
@@ -684,11 +701,11 @@ find_sample(snd_soundfont_t *sf, int sample_id)
684 * routine. 701 * routine.
685 */ 702 */
686static int 703static int
687load_data(snd_sf_list_t *sflist, const void __user *data, long count) 704load_data(struct snd_sf_list *sflist, const void __user *data, long count)
688{ 705{
689 snd_soundfont_t *sf; 706 struct snd_soundfont *sf;
690 soundfont_sample_info_t sample_info; 707 struct soundfont_sample_info sample_info;
691 snd_sf_sample_t *sp; 708 struct snd_sf_sample *sp;
692 long off; 709 long off;
693 710
694 /* patch must be opened */ 711 /* patch must be opened */
@@ -922,12 +939,13 @@ int snd_sf_vol_table[128] = {
922 939
923/* load GUS patch */ 940/* load GUS patch */
924static int 941static int
925load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int client) 942load_guspatch(struct snd_sf_list *sflist, const char __user *data,
943 long count, int client)
926{ 944{
927 struct patch_info patch; 945 struct patch_info patch;
928 snd_soundfont_t *sf; 946 struct snd_soundfont *sf;
929 snd_sf_zone_t *zone; 947 struct snd_sf_zone *zone;
930 snd_sf_sample_t *smp; 948 struct snd_sf_sample *smp;
931 int note, sample_id; 949 int note, sample_id;
932 int rc; 950 int rc;
933 951
@@ -992,7 +1010,8 @@ load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int cl
992 */ 1010 */
993 if (sflist->callback.sample_new) { 1011 if (sflist->callback.sample_new) {
994 rc = sflist->callback.sample_new 1012 rc = sflist->callback.sample_new
995 (sflist->callback.private_data, smp, sflist->memhdr, data, count); 1013 (sflist->callback.private_data, smp, sflist->memhdr,
1014 data, count);
996 if (rc < 0) { 1015 if (rc < 0) {
997 sf_sample_delete(sflist, sf, smp); 1016 sf_sample_delete(sflist, sf, smp);
998 return rc; 1017 return rc;
@@ -1095,7 +1114,7 @@ load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int cl
1095 1114
1096/* load GUS patch */ 1115/* load GUS patch */
1097int 1116int
1098snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 1117snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
1099 long count, int client) 1118 long count, int client)
1100{ 1119{
1101 int rc; 1120 int rc;
@@ -1114,10 +1133,10 @@ snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data,
1114 * bank/key combination). 1133 * bank/key combination).
1115 */ 1134 */
1116static void 1135static void
1117rebuild_presets(snd_sf_list_t *sflist) 1136rebuild_presets(struct snd_sf_list *sflist)
1118{ 1137{
1119 snd_soundfont_t *sf; 1138 struct snd_soundfont *sf;
1120 snd_sf_zone_t *cur; 1139 struct snd_sf_zone *cur;
1121 1140
1122 /* clear preset table */ 1141 /* clear preset table */
1123 memset(sflist->presets, 0, sizeof(sflist->presets)); 1142 memset(sflist->presets, 0, sizeof(sflist->presets));
@@ -1142,15 +1161,15 @@ rebuild_presets(snd_sf_list_t *sflist)
1142 * add the given zone to preset table 1161 * add the given zone to preset table
1143 */ 1162 */
1144static void 1163static void
1145add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur) 1164add_preset(struct snd_sf_list *sflist, struct snd_sf_zone *cur)
1146{ 1165{
1147 snd_sf_zone_t *zone; 1166 struct snd_sf_zone *zone;
1148 int index; 1167 int index;
1149 1168
1150 zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low); 1169 zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low);
1151 if (zone && zone->v.sf_id != cur->v.sf_id) { 1170 if (zone && zone->v.sf_id != cur->v.sf_id) {
1152 /* different instrument was already defined */ 1171 /* different instrument was already defined */
1153 snd_sf_zone_t *p; 1172 struct snd_sf_zone *p;
1154 /* compare the allocated time */ 1173 /* compare the allocated time */
1155 for (p = zone; p; p = p->next_zone) { 1174 for (p = zone; p; p = p->next_zone) {
1156 if (p->counter > cur->counter) 1175 if (p->counter > cur->counter)
@@ -1174,10 +1193,10 @@ add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur)
1174 * delete the given zones from preset_table 1193 * delete the given zones from preset_table
1175 */ 1194 */
1176static void 1195static void
1177delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp) 1196delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp)
1178{ 1197{
1179 int index; 1198 int index;
1180 snd_sf_zone_t *p; 1199 struct snd_sf_zone *p;
1181 1200
1182 if ((index = get_index(zp->bank, zp->instr, zp->v.low)) < 0) 1201 if ((index = get_index(zp->bank, zp->instr, zp->v.low)) < 0)
1183 return; 1202 return;
@@ -1200,10 +1219,10 @@ delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp)
1200 * This function returns the number of found zones. 0 if not found. 1219 * This function returns the number of found zones. 0 if not found.
1201 */ 1220 */
1202int 1221int
1203snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 1222snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
1204 int preset, int bank, 1223 int preset, int bank,
1205 int def_preset, int def_bank, 1224 int def_preset, int def_bank,
1206 snd_sf_zone_t **table, int max_layers) 1225 struct snd_sf_zone **table, int max_layers)
1207{ 1226{
1208 int nvoices; 1227 int nvoices;
1209 unsigned long flags; 1228 unsigned long flags;
@@ -1217,10 +1236,13 @@ snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
1217 spin_unlock_irqrestore(&sflist->lock, flags); 1236 spin_unlock_irqrestore(&sflist->lock, flags);
1218 return 0; 1237 return 0;
1219 } 1238 }
1220 nvoices = search_zones(sflist, notep, vel, preset, bank, table, max_layers, 0); 1239 nvoices = search_zones(sflist, notep, vel, preset, bank,
1240 table, max_layers, 0);
1221 if (! nvoices) { 1241 if (! nvoices) {
1222 if (preset != def_preset || bank != def_bank) 1242 if (preset != def_preset || bank != def_bank)
1223 nvoices = search_zones(sflist, notep, vel, def_preset, def_bank, table, max_layers, 0); 1243 nvoices = search_zones(sflist, notep, vel,
1244 def_preset, def_bank,
1245 table, max_layers, 0);
1224 } 1246 }
1225 spin_unlock_irqrestore(&sflist->lock, flags); 1247 spin_unlock_irqrestore(&sflist->lock, flags);
1226 return nvoices; 1248 return nvoices;
@@ -1230,11 +1252,11 @@ snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
1230/* 1252/*
1231 * search the first matching zone 1253 * search the first matching zone
1232 */ 1254 */
1233static snd_sf_zone_t * 1255static struct snd_sf_zone *
1234search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key) 1256search_first_zone(struct snd_sf_list *sflist, int bank, int preset, int key)
1235{ 1257{
1236 int index; 1258 int index;
1237 snd_sf_zone_t *zp; 1259 struct snd_sf_zone *zp;
1238 1260
1239 if ((index = get_index(bank, preset, key)) < 0) 1261 if ((index = get_index(bank, preset, key)) < 0)
1240 return NULL; 1262 return NULL;
@@ -1250,9 +1272,11 @@ search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key)
1250 * search matching zones from sflist. can be called recursively. 1272 * search matching zones from sflist. can be called recursively.
1251 */ 1273 */
1252static int 1274static int
1253search_zones(snd_sf_list_t *sflist, int *notep, int vel, int preset, int bank, snd_sf_zone_t **table, int max_layers, int level) 1275search_zones(struct snd_sf_list *sflist, int *notep, int vel,
1276 int preset, int bank, struct snd_sf_zone **table,
1277 int max_layers, int level)
1254{ 1278{
1255 snd_sf_zone_t *zp; 1279 struct snd_sf_zone *zp;
1256 int nvoices; 1280 int nvoices;
1257 1281
1258 zp = search_first_zone(sflist, bank, preset, *notep); 1282 zp = search_first_zone(sflist, bank, preset, *notep);
@@ -1310,7 +1334,7 @@ get_index(int bank, int instr, int key)
1310 * Initialise the sflist structure. 1334 * Initialise the sflist structure.
1311 */ 1335 */
1312static void 1336static void
1313snd_sf_init(snd_sf_list_t *sflist) 1337snd_sf_init(struct snd_sf_list *sflist)
1314{ 1338{
1315 memset(sflist->presets, 0, sizeof(sflist->presets)); 1339 memset(sflist->presets, 0, sizeof(sflist->presets));
1316 1340
@@ -1329,11 +1353,11 @@ snd_sf_init(snd_sf_list_t *sflist)
1329 * Release all list records 1353 * Release all list records
1330 */ 1354 */
1331static void 1355static void
1332snd_sf_clear(snd_sf_list_t *sflist) 1356snd_sf_clear(struct snd_sf_list *sflist)
1333{ 1357{
1334 snd_soundfont_t *sf, *nextsf; 1358 struct snd_soundfont *sf, *nextsf;
1335 snd_sf_zone_t *zp, *nextzp; 1359 struct snd_sf_zone *zp, *nextzp;
1336 snd_sf_sample_t *sp, *nextsp; 1360 struct snd_sf_sample *sp, *nextsp;
1337 1361
1338 for (sf = sflist->fonts; sf; sf = nextsf) { 1362 for (sf = sflist->fonts; sf; sf = nextsf) {
1339 nextsf = sf->next; 1363 nextsf = sf->next;
@@ -1344,7 +1368,8 @@ snd_sf_clear(snd_sf_list_t *sflist)
1344 for (sp = sf->samples; sp; sp = nextsp) { 1368 for (sp = sf->samples; sp; sp = nextsp) {
1345 nextsp = sp->next; 1369 nextsp = sp->next;
1346 if (sflist->callback.sample_free) 1370 if (sflist->callback.sample_free)
1347 sflist->callback.sample_free(sflist->callback.private_data, sp, sflist->memhdr); 1371 sflist->callback.sample_free(sflist->callback.private_data,
1372 sp, sflist->memhdr);
1348 kfree(sp); 1373 kfree(sp);
1349 } 1374 }
1350 kfree(sf); 1375 kfree(sf);
@@ -1357,10 +1382,10 @@ snd_sf_clear(snd_sf_list_t *sflist)
1357/* 1382/*
1358 * Create a new sflist structure 1383 * Create a new sflist structure
1359 */ 1384 */
1360snd_sf_list_t * 1385struct snd_sf_list *
1361snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr) 1386snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr)
1362{ 1387{
1363 snd_sf_list_t *sflist; 1388 struct snd_sf_list *sflist;
1364 1389
1365 if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL) 1390 if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
1366 return NULL; 1391 return NULL;
@@ -1381,7 +1406,7 @@ snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr)
1381 * Free everything allocated off the sflist structure. 1406 * Free everything allocated off the sflist structure.
1382 */ 1407 */
1383void 1408void
1384snd_sf_free(snd_sf_list_t *sflist) 1409snd_sf_free(struct snd_sf_list *sflist)
1385{ 1410{
1386 if (sflist == NULL) 1411 if (sflist == NULL)
1387 return; 1412 return;
@@ -1400,7 +1425,7 @@ snd_sf_free(snd_sf_list_t *sflist)
1400 * The soundcard should be silet before calling this function. 1425 * The soundcard should be silet before calling this function.
1401 */ 1426 */
1402int 1427int
1403snd_soundfont_remove_samples(snd_sf_list_t *sflist) 1428snd_soundfont_remove_samples(struct snd_sf_list *sflist)
1404{ 1429{
1405 lock_preset(sflist); 1430 lock_preset(sflist);
1406 if (sflist->callback.sample_reset) 1431 if (sflist->callback.sample_reset)
@@ -1416,11 +1441,11 @@ snd_soundfont_remove_samples(snd_sf_list_t *sflist)
1416 * The soundcard should be silent before calling this function. 1441 * The soundcard should be silent before calling this function.
1417 */ 1442 */
1418int 1443int
1419snd_soundfont_remove_unlocked(snd_sf_list_t *sflist) 1444snd_soundfont_remove_unlocked(struct snd_sf_list *sflist)
1420{ 1445{
1421 snd_soundfont_t *sf; 1446 struct snd_soundfont *sf;
1422 snd_sf_zone_t *zp, *nextzp; 1447 struct snd_sf_zone *zp, *nextzp;
1423 snd_sf_sample_t *sp, *nextsp; 1448 struct snd_sf_sample *sp, *nextsp;
1424 1449
1425 lock_preset(sflist); 1450 lock_preset(sflist);
1426 1451
@@ -1446,7 +1471,8 @@ snd_soundfont_remove_unlocked(snd_sf_list_t *sflist)
1446 sf->samples = nextsp; 1471 sf->samples = nextsp;
1447 sflist->mem_used -= sp->v.truesize; 1472 sflist->mem_used -= sp->v.truesize;
1448 if (sflist->callback.sample_free) 1473 if (sflist->callback.sample_free)
1449 sflist->callback.sample_free(sflist->callback.private_data, sp, sflist->memhdr); 1474 sflist->callback.sample_free(sflist->callback.private_data,
1475 sp, sflist->memhdr);
1450 kfree(sp); 1476 kfree(sp);
1451 } 1477 }
1452 } 1478 }
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c
index 5f75bf31bc36..217e8e552a42 100644
--- a/sound/synth/util_mem.c
+++ b/sound/synth/util_mem.c
@@ -28,15 +28,15 @@ MODULE_AUTHOR("Takashi Iwai");
28MODULE_DESCRIPTION("Generic memory management routines for soundcard memory allocation"); 28MODULE_DESCRIPTION("Generic memory management routines for soundcard memory allocation");
29MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
30 30
31#define get_memblk(p) list_entry(p, snd_util_memblk_t, list) 31#define get_memblk(p) list_entry(p, struct snd_util_memblk, list)
32 32
33/* 33/*
34 * create a new memory manager 34 * create a new memory manager
35 */ 35 */
36snd_util_memhdr_t * 36struct snd_util_memhdr *
37snd_util_memhdr_new(int memsize) 37snd_util_memhdr_new(int memsize)
38{ 38{
39 snd_util_memhdr_t *hdr; 39 struct snd_util_memhdr *hdr;
40 40
41 hdr = kzalloc(sizeof(*hdr), GFP_KERNEL); 41 hdr = kzalloc(sizeof(*hdr), GFP_KERNEL);
42 if (hdr == NULL) 42 if (hdr == NULL)
@@ -51,7 +51,7 @@ snd_util_memhdr_new(int memsize)
51/* 51/*
52 * free a memory manager 52 * free a memory manager
53 */ 53 */
54void snd_util_memhdr_free(snd_util_memhdr_t *hdr) 54void snd_util_memhdr_free(struct snd_util_memhdr *hdr)
55{ 55{
56 struct list_head *p; 56 struct list_head *p;
57 57
@@ -67,11 +67,11 @@ void snd_util_memhdr_free(snd_util_memhdr_t *hdr)
67/* 67/*
68 * allocate a memory block (without mutex) 68 * allocate a memory block (without mutex)
69 */ 69 */
70snd_util_memblk_t * 70struct snd_util_memblk *
71__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size) 71__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size)
72{ 72{
73 snd_util_memblk_t *blk; 73 struct snd_util_memblk *blk;
74 snd_util_unit_t units, prev_offset; 74 unsigned int units, prev_offset;
75 struct list_head *p; 75 struct list_head *p;
76 76
77 snd_assert(hdr != NULL, return NULL); 77 snd_assert(hdr != NULL, return NULL);
@@ -104,20 +104,21 @@ __found:
104 * create a new memory block with the given size 104 * create a new memory block with the given size
105 * the block is linked next to prev 105 * the block is linked next to prev
106 */ 106 */
107snd_util_memblk_t * 107struct snd_util_memblk *
108__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, 108__snd_util_memblk_new(struct snd_util_memhdr *hdr, unsigned int units,
109 struct list_head *prev) 109 struct list_head *prev)
110{ 110{
111 snd_util_memblk_t *blk; 111 struct snd_util_memblk *blk;
112 112
113 blk = kmalloc(sizeof(snd_util_memblk_t) + hdr->block_extra_size, GFP_KERNEL); 113 blk = kmalloc(sizeof(struct snd_util_memblk) + hdr->block_extra_size,
114 GFP_KERNEL);
114 if (blk == NULL) 115 if (blk == NULL)
115 return NULL; 116 return NULL;
116 117
117 if (! prev || prev == &hdr->block) 118 if (! prev || prev == &hdr->block)
118 blk->offset = 0; 119 blk->offset = 0;
119 else { 120 else {
120 snd_util_memblk_t *p = get_memblk(prev); 121 struct snd_util_memblk *p = get_memblk(prev);
121 blk->offset = p->offset + p->size; 122 blk->offset = p->offset + p->size;
122 } 123 }
123 blk->size = units; 124 blk->size = units;
@@ -131,10 +132,10 @@ __snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units,
131/* 132/*
132 * allocate a memory block (with mutex) 133 * allocate a memory block (with mutex)
133 */ 134 */
134snd_util_memblk_t * 135struct snd_util_memblk *
135snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size) 136snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size)
136{ 137{
137 snd_util_memblk_t *blk; 138 struct snd_util_memblk *blk;
138 down(&hdr->block_mutex); 139 down(&hdr->block_mutex);
139 blk = __snd_util_mem_alloc(hdr, size); 140 blk = __snd_util_mem_alloc(hdr, size);
140 up(&hdr->block_mutex); 141 up(&hdr->block_mutex);
@@ -147,7 +148,7 @@ snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size)
147 * (without mutex) 148 * (without mutex)
148 */ 149 */
149void 150void
150__snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk) 151__snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
151{ 152{
152 list_del(&blk->list); 153 list_del(&blk->list);
153 hdr->nblocks--; 154 hdr->nblocks--;
@@ -158,7 +159,7 @@ __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk)
158/* 159/*
159 * free a memory block (with mutex) 160 * free a memory block (with mutex)
160 */ 161 */
161int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk) 162int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
162{ 163{
163 snd_assert(hdr && blk, return -EINVAL); 164 snd_assert(hdr && blk, return -EINVAL);
164 165
@@ -171,7 +172,7 @@ int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk)
171/* 172/*
172 * return available memory size 173 * return available memory size
173 */ 174 */
174int snd_util_mem_avail(snd_util_memhdr_t *hdr) 175int snd_util_mem_avail(struct snd_util_memhdr *hdr)
175{ 176{
176 unsigned int size; 177 unsigned int size;
177 down(&hdr->block_mutex); 178 down(&hdr->block_mutex);