aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/asequencer.h368
-rw-r--r--include/sound/seq_device.h18
-rw-r--r--include/sound/seq_instr.h64
-rw-r--r--include/sound/seq_kernel.h119
-rw-r--r--include/sound/seq_midi_emul.h44
-rw-r--r--include/sound/seq_midi_event.h22
-rw-r--r--include/sound/seq_virmidi.h22
-rw-r--r--sound/core/seq/seq_clientmgr.c460
-rw-r--r--sound/core/seq/seq_clientmgr.h42
-rw-r--r--sound/core/seq/seq_compat.c22
-rw-r--r--sound/core/seq/seq_device.c120
-rw-r--r--sound/core/seq/seq_dummy.c31
-rw-r--r--sound/core/seq/seq_fifo.c40
-rw-r--r--sound/core/seq/seq_fifo.h26
-rw-r--r--sound/core/seq/seq_info.c13
-rw-r--r--sound/core/seq/seq_info.h6
-rw-r--r--sound/core/seq/seq_instr.c162
-rw-r--r--sound/core/seq/seq_memory.c71
-rw-r--r--sound/core/seq/seq_memory.h37
-rw-r--r--sound/core/seq/seq_midi.c102
-rw-r--r--sound/core/seq/seq_midi_emul.c86
-rw-r--r--sound/core/seq/seq_midi_event.c98
-rw-r--r--sound/core/seq/seq_ports.c152
-rw-r--r--sound/core/seq/seq_ports.h64
-rw-r--r--sound/core/seq/seq_prioq.c52
-rw-r--r--sound/core/seq/seq_prioq.h26
-rw-r--r--sound/core/seq/seq_queue.c105
-rw-r--r--sound/core/seq/seq_queue.h22
-rw-r--r--sound/core/seq/seq_system.c18
-rw-r--r--sound/core/seq/seq_system.h2
-rw-r--r--sound/core/seq/seq_timer.c68
-rw-r--r--sound/core/seq/seq_timer.h54
-rw-r--r--sound/core/seq/seq_virmidi.c106
33 files changed, 1363 insertions, 1279 deletions
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 562637b4884b..59485be05797 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -35,13 +35,13 @@
35 */ 35 */
36 36
37/** system messages 37/** system messages
38 * event data type = #sndrv_seq_result_t 38 * event data type = #snd_seq_result
39 */ 39 */
40#define SNDRV_SEQ_EVENT_SYSTEM 0 40#define SNDRV_SEQ_EVENT_SYSTEM 0
41#define SNDRV_SEQ_EVENT_RESULT 1 41#define SNDRV_SEQ_EVENT_RESULT 1
42 42
43/** note messages (channel specific) 43/** note messages (channel specific)
44 * event data type = #sndrv_seq_ev_note 44 * event data type = #snd_seq_ev_note
45 */ 45 */
46#define SNDRV_SEQ_EVENT_NOTE 5 46#define SNDRV_SEQ_EVENT_NOTE 5
47#define SNDRV_SEQ_EVENT_NOTEON 6 47#define SNDRV_SEQ_EVENT_NOTEON 6
@@ -49,7 +49,7 @@
49#define SNDRV_SEQ_EVENT_KEYPRESS 8 49#define SNDRV_SEQ_EVENT_KEYPRESS 8
50 50
51/** control messages (channel specific) 51/** control messages (channel specific)
52 * event data type = #sndrv_seq_ev_ctrl 52 * event data type = #snd_seq_ev_ctrl
53 */ 53 */
54#define SNDRV_SEQ_EVENT_CONTROLLER 10 54#define SNDRV_SEQ_EVENT_CONTROLLER 10
55#define SNDRV_SEQ_EVENT_PGMCHANGE 11 55#define SNDRV_SEQ_EVENT_PGMCHANGE 11
@@ -60,7 +60,7 @@
60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
61 61
62/** synchronisation messages 62/** synchronisation messages
63 * event data type = #sndrv_seq_ev_ctrl 63 * event data type = #snd_seq_ev_ctrl
64 */ 64 */
65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
@@ -69,7 +69,7 @@
69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
70 70
71/** timer messages 71/** timer messages
72 * event data type = sndrv_seq_ev_queue_control_t 72 * event data type = snd_seq_ev_queue_control
73 */ 73 */
74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
@@ -95,7 +95,7 @@
95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
96 96
97/** system status messages (broadcast for subscribers) 97/** system status messages (broadcast for subscribers)
98 * event data type = sndrv_seq_addr_t 98 * event data type = snd_seq_addr
99 */ 99 */
100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
@@ -105,13 +105,13 @@
105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
106 106
107/** port connection changes 107/** port connection changes
108 * event data type = sndrv_seq_connect_t 108 * event data type = snd_seq_connect
109 */ 109 */
110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
112 112
113/** synthesizer events 113/** synthesizer events
114 * event data type = sndrv_seq_eve_sample_control_t 114 * event data type = snd_seq_eve_sample_control
115 */ 115 */
116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ 116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ 117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
@@ -162,7 +162,7 @@
162/* 119-129: reserved */ 162/* 119-129: reserved */
163 163
164/* 130-139: variable length events 164/* 130-139: variable length events
165 * event data type = sndrv_seq_ev_ext 165 * event data type = snd_seq_ev_ext
166 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 166 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
167 */ 167 */
168#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 168#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
@@ -186,18 +186,18 @@
186#define SNDRV_SEQ_EVENT_NONE 255 186#define SNDRV_SEQ_EVENT_NONE 255
187 187
188 188
189typedef unsigned char sndrv_seq_event_type_t; 189typedef unsigned char snd_seq_event_type_t;
190 190
191/** event address */ 191/** event address */
192struct sndrv_seq_addr { 192struct snd_seq_addr {
193 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 193 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
194 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 194 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
195}; 195};
196 196
197/** port connection */ 197/** port connection */
198struct sndrv_seq_connect { 198struct snd_seq_connect {
199 struct sndrv_seq_addr sender; 199 struct snd_seq_addr sender;
200 struct sndrv_seq_addr dest; 200 struct snd_seq_addr dest;
201}; 201};
202 202
203 203
@@ -226,7 +226,7 @@ struct sndrv_seq_connect {
226 226
227 227
228 /* note event */ 228 /* note event */
229struct sndrv_seq_ev_note { 229struct snd_seq_ev_note {
230 unsigned char channel; 230 unsigned char channel;
231 unsigned char note; 231 unsigned char note;
232 unsigned char velocity; 232 unsigned char velocity;
@@ -235,7 +235,7 @@ struct sndrv_seq_ev_note {
235}; 235};
236 236
237 /* controller event */ 237 /* controller event */
238struct sndrv_seq_ev_ctrl { 238struct snd_seq_ev_ctrl {
239 unsigned char channel; 239 unsigned char channel;
240 unsigned char unused1, unused2, unused3; /* pad */ 240 unsigned char unused1, unused2, unused3; /* pad */
241 unsigned int param; 241 unsigned int param;
@@ -243,59 +243,59 @@ struct sndrv_seq_ev_ctrl {
243}; 243};
244 244
245 /* generic set of bytes (12x8 bit) */ 245 /* generic set of bytes (12x8 bit) */
246struct sndrv_seq_ev_raw8 { 246struct snd_seq_ev_raw8 {
247 unsigned char d[12]; /* 8 bit value */ 247 unsigned char d[12]; /* 8 bit value */
248}; 248};
249 249
250 /* generic set of integers (3x32 bit) */ 250 /* generic set of integers (3x32 bit) */
251struct sndrv_seq_ev_raw32 { 251struct snd_seq_ev_raw32 {
252 unsigned int d[3]; /* 32 bit value */ 252 unsigned int d[3]; /* 32 bit value */
253}; 253};
254 254
255 /* external stored data */ 255 /* external stored data */
256struct sndrv_seq_ev_ext { 256struct snd_seq_ev_ext {
257 unsigned int len; /* length of data */ 257 unsigned int len; /* length of data */
258 void *ptr; /* pointer to data (note: maybe 64-bit) */ 258 void *ptr; /* pointer to data (note: maybe 64-bit) */
259} __attribute__((packed)); 259} __attribute__((packed));
260 260
261/* Instrument cluster type */ 261/* Instrument cluster type */
262typedef unsigned int sndrv_seq_instr_cluster_t; 262typedef unsigned int snd_seq_instr_cluster_t;
263 263
264/* Instrument type */ 264/* Instrument type */
265struct sndrv_seq_instr { 265struct snd_seq_instr {
266 sndrv_seq_instr_cluster_t cluster; 266 snd_seq_instr_cluster_t cluster;
267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */ 267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
268 unsigned short bank; 268 unsigned short bank;
269 unsigned short prg; 269 unsigned short prg;
270}; 270};
271 271
272 /* sample number */ 272 /* sample number */
273struct sndrv_seq_ev_sample { 273struct snd_seq_ev_sample {
274 unsigned int std; 274 unsigned int std;
275 unsigned short bank; 275 unsigned short bank;
276 unsigned short prg; 276 unsigned short prg;
277}; 277};
278 278
279 /* sample cluster */ 279 /* sample cluster */
280struct sndrv_seq_ev_cluster { 280struct snd_seq_ev_cluster {
281 sndrv_seq_instr_cluster_t cluster; 281 snd_seq_instr_cluster_t cluster;
282}; 282};
283 283
284 /* sample position */ 284 /* sample position */
285typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */ 285typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
286 286
287 /* sample stop mode */ 287 /* sample stop mode */
288enum sndrv_seq_stop_mode { 288enum {
289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ 289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ 290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ 291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
292}; 292};
293 293
294 /* sample frequency */ 294 /* sample frequency */
295typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */ 295typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
296 296
297 /* sample volume control; if any value is set to -1 == do not change */ 297 /* sample volume control; if any value is set to -1 == do not change */
298struct sndrv_seq_ev_volume { 298struct snd_seq_ev_volume {
299 signed short volume; /* range: 0-16383 */ 299 signed short volume; /* range: 0-16383 */
300 signed short lr; /* left-right balance; range: 0-16383 */ 300 signed short lr; /* left-right balance; range: 0-16383 */
301 signed short fr; /* front-rear balance; range: 0-16383 */ 301 signed short fr; /* front-rear balance; range: 0-16383 */
@@ -303,22 +303,22 @@ struct sndrv_seq_ev_volume {
303}; 303};
304 304
305 /* simple loop redefinition */ 305 /* simple loop redefinition */
306struct sndrv_seq_ev_loop { 306struct snd_seq_ev_loop {
307 unsigned int start; /* loop start (in samples) * 16 */ 307 unsigned int start; /* loop start (in samples) * 16 */
308 unsigned int end; /* loop end (in samples) * 16 */ 308 unsigned int end; /* loop end (in samples) * 16 */
309}; 309};
310 310
311struct sndrv_seq_ev_sample_control { 311struct snd_seq_ev_sample_control {
312 unsigned char channel; 312 unsigned char channel;
313 unsigned char unused1, unused2, unused3; /* pad */ 313 unsigned char unused1, unused2, unused3; /* pad */
314 union { 314 union {
315 struct sndrv_seq_ev_sample sample; 315 struct snd_seq_ev_sample sample;
316 struct sndrv_seq_ev_cluster cluster; 316 struct snd_seq_ev_cluster cluster;
317 sndrv_seq_position_t position; 317 snd_seq_position_t position;
318 enum sndrv_seq_stop_mode stop_mode; 318 int stop_mode;
319 sndrv_seq_frequency_t frequency; 319 snd_seq_frequency_t frequency;
320 struct sndrv_seq_ev_volume volume; 320 struct snd_seq_ev_volume volume;
321 struct sndrv_seq_ev_loop loop; 321 struct snd_seq_ev_loop loop;
322 unsigned char raw8[8]; 322 unsigned char raw8[8];
323 } param; 323 } param;
324}; 324};
@@ -326,82 +326,82 @@ struct sndrv_seq_ev_sample_control {
326 326
327 327
328/* INSTR_BEGIN event */ 328/* INSTR_BEGIN event */
329struct sndrv_seq_ev_instr_begin { 329struct snd_seq_ev_instr_begin {
330 int timeout; /* zero = forever, otherwise timeout in ms */ 330 int timeout; /* zero = forever, otherwise timeout in ms */
331}; 331};
332 332
333struct sndrv_seq_result { 333struct snd_seq_result {
334 int event; /* processed event type */ 334 int event; /* processed event type */
335 int result; 335 int result;
336}; 336};
337 337
338 338
339struct sndrv_seq_real_time { 339struct snd_seq_real_time {
340 unsigned int tv_sec; /* seconds */ 340 unsigned int tv_sec; /* seconds */
341 unsigned int tv_nsec; /* nanoseconds */ 341 unsigned int tv_nsec; /* nanoseconds */
342}; 342};
343 343
344typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */ 344typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
345 345
346union sndrv_seq_timestamp { 346union snd_seq_timestamp {
347 sndrv_seq_tick_time_t tick; 347 snd_seq_tick_time_t tick;
348 struct sndrv_seq_real_time time; 348 struct snd_seq_real_time time;
349}; 349};
350 350
351struct sndrv_seq_queue_skew { 351struct snd_seq_queue_skew {
352 unsigned int value; 352 unsigned int value;
353 unsigned int base; 353 unsigned int base;
354}; 354};
355 355
356 /* queue timer control */ 356 /* queue timer control */
357struct sndrv_seq_ev_queue_control { 357struct snd_seq_ev_queue_control {
358 unsigned char queue; /* affected queue */ 358 unsigned char queue; /* affected queue */
359 unsigned char pad[3]; /* reserved */ 359 unsigned char pad[3]; /* reserved */
360 union { 360 union {
361 signed int value; /* affected value (e.g. tempo) */ 361 signed int value; /* affected value (e.g. tempo) */
362 union sndrv_seq_timestamp time; /* time */ 362 union snd_seq_timestamp time; /* time */
363 unsigned int position; /* sync position */ 363 unsigned int position; /* sync position */
364 struct sndrv_seq_queue_skew skew; 364 struct snd_seq_queue_skew skew;
365 unsigned int d32[2]; 365 unsigned int d32[2];
366 unsigned char d8[8]; 366 unsigned char d8[8];
367 } param; 367 } param;
368}; 368};
369 369
370 /* quoted event - inside the kernel only */ 370 /* quoted event - inside the kernel only */
371struct sndrv_seq_ev_quote { 371struct snd_seq_ev_quote {
372 struct sndrv_seq_addr origin; /* original sender */ 372 struct snd_seq_addr origin; /* original sender */
373 unsigned short value; /* optional data */ 373 unsigned short value; /* optional data */
374 struct sndrv_seq_event *event; /* quoted event */ 374 struct snd_seq_event *event; /* quoted event */
375} __attribute__((packed)); 375} __attribute__((packed));
376 376
377 377
378 /* sequencer event */ 378 /* sequencer event */
379struct sndrv_seq_event { 379struct snd_seq_event {
380 sndrv_seq_event_type_t type; /* event type */ 380 snd_seq_event_type_t type; /* event type */
381 unsigned char flags; /* event flags */ 381 unsigned char flags; /* event flags */
382 char tag; 382 char tag;
383 383
384 unsigned char queue; /* schedule queue */ 384 unsigned char queue; /* schedule queue */
385 union sndrv_seq_timestamp time; /* schedule time */ 385 union snd_seq_timestamp time; /* schedule time */
386 386
387 387
388 struct sndrv_seq_addr source; /* source address */ 388 struct snd_seq_addr source; /* source address */
389 struct sndrv_seq_addr dest; /* destination address */ 389 struct snd_seq_addr dest; /* destination address */
390 390
391 union { /* event data... */ 391 union { /* event data... */
392 struct sndrv_seq_ev_note note; 392 struct snd_seq_ev_note note;
393 struct sndrv_seq_ev_ctrl control; 393 struct snd_seq_ev_ctrl control;
394 struct sndrv_seq_ev_raw8 raw8; 394 struct snd_seq_ev_raw8 raw8;
395 struct sndrv_seq_ev_raw32 raw32; 395 struct snd_seq_ev_raw32 raw32;
396 struct sndrv_seq_ev_ext ext; 396 struct snd_seq_ev_ext ext;
397 struct sndrv_seq_ev_queue_control queue; 397 struct snd_seq_ev_queue_control queue;
398 union sndrv_seq_timestamp time; 398 union snd_seq_timestamp time;
399 struct sndrv_seq_addr addr; 399 struct snd_seq_addr addr;
400 struct sndrv_seq_connect connect; 400 struct snd_seq_connect connect;
401 struct sndrv_seq_result result; 401 struct snd_seq_result result;
402 struct sndrv_seq_ev_instr_begin instr_begin; 402 struct snd_seq_ev_instr_begin instr_begin;
403 struct sndrv_seq_ev_sample_control sample; 403 struct snd_seq_ev_sample_control sample;
404 struct sndrv_seq_ev_quote quote; 404 struct snd_seq_ev_quote quote;
405 } data; 405 } data;
406}; 406};
407 407
@@ -409,72 +409,77 @@ struct sndrv_seq_event {
409/* 409/*
410 * bounce event - stored as variable size data 410 * bounce event - stored as variable size data
411 */ 411 */
412struct sndrv_seq_event_bounce { 412struct snd_seq_event_bounce {
413 int err; 413 int err;
414 struct sndrv_seq_event event; 414 struct snd_seq_event event;
415 /* external data follows here. */ 415 /* external data follows here. */
416}; 416};
417 417
418#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t))) 418#ifdef __KERNEL__
419
420/* helper macro */
421#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
419 422
420/* 423/*
421 * type check macros 424 * type check macros
422 */ 425 */
423/* result events: 0-4 */ 426/* result events: 0-4 */
424#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5) 427#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
425/* channel specific events: 5-19 */ 428/* channel specific events: 5-19 */
426#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) 429#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
427/* note events: 5-9 */ 430/* note events: 5-9 */
428#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) 431#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
429/* control events: 10-19 */ 432/* control events: 10-19 */
430#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) 433#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
431/* queue control events: 30-39 */ 434/* queue control events: 30-39 */
432#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) 435#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
433/* system status messages */ 436/* system status messages */
434#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) 437#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
435/* sample messages */ 438/* sample messages */
436#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) 439#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
437/* user-defined messages */ 440/* user-defined messages */
438#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) 441#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
439/* fixed length events: 0-99 */ 442/* fixed length events: 0-99 */
440#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100) 443#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
441/* instrument layer events: 100-129 */ 444/* instrument layer events: 100-129 */
442#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) 445#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
443/* variable length events: 130-139 */ 446/* variable length events: 130-139 */
444#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) 447#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
445/* reserved for kernel */ 448/* reserved for kernel */
446#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150) 449#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
447 450
448/* direct dispatched events */ 451/* direct dispatched events */
449#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) 452#define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
450 453
451/* 454/*
452 * macros to check event flags 455 * macros to check event flags
453 */ 456 */
454/* prior events */ 457/* prior events */
455#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) 458#define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
456 459
457/* event length type */ 460/* event length type */
458#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) 461#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
459#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) 462#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
460#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) 463#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
461#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) 464#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
462 465
463/* time-stamp type */ 466/* time-stamp type */
464#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) 467#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
465#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) 468#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
466#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) 469#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
467 470
468/* time-mode type */ 471/* time-mode type */
469#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) 472#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
470#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) 473#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
471#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) 474#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
472 475
473/* queue sync port */ 476/* queue sync port */
474#define sndrv_seq_queue_sync_port(q) ((q) + 16) 477#define snd_seq_queue_sync_port(q) ((q) + 16)
478
479#endif /* __KERNEL__ */
475 480
476 /* system information */ 481 /* system information */
477struct sndrv_seq_system_info { 482struct snd_seq_system_info {
478 int queues; /* maximum queues count */ 483 int queues; /* maximum queues count */
479 int clients; /* maximum clients count */ 484 int clients; /* maximum clients count */
480 int ports; /* maximum ports per client */ 485 int ports; /* maximum ports per client */
@@ -486,7 +491,7 @@ struct sndrv_seq_system_info {
486 491
487 492
488 /* system running information */ 493 /* system running information */
489struct sndrv_seq_running_info { 494struct snd_seq_running_info {
490 unsigned char client; /* client id */ 495 unsigned char client; /* client id */
491 unsigned char big_endian; /* 1 = big-endian */ 496 unsigned char big_endian; /* 1 = big-endian */
492 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ 497 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
@@ -502,11 +507,10 @@ struct sndrv_seq_running_info {
502 507
503 508
504 /* client types */ 509 /* client types */
505enum sndrv_seq_client_type { 510typedef int __bitwise snd_seq_client_type_t;
506 NO_CLIENT = 0, 511#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
507 USER_CLIENT = 1, 512#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
508 KERNEL_CLIENT = 2 513#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
509};
510 514
511 /* event filter flags */ 515 /* event filter flags */
512#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ 516#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
@@ -514,9 +518,9 @@ enum sndrv_seq_client_type {
514#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ 518#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
515#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ 519#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
516 520
517struct sndrv_seq_client_info { 521struct snd_seq_client_info {
518 int client; /* client number to inquire */ 522 int client; /* client number to inquire */
519 enum sndrv_seq_client_type type; /* client type */ 523 snd_seq_client_type_t type; /* client type */
520 char name[64]; /* client name */ 524 char name[64]; /* client name */
521 unsigned int filter; /* filter flags */ 525 unsigned int filter; /* filter flags */
522 unsigned char multicast_filter[8]; /* multicast filter bitmap */ 526 unsigned char multicast_filter[8]; /* multicast filter bitmap */
@@ -528,7 +532,7 @@ struct sndrv_seq_client_info {
528 532
529 533
530/* client pool size */ 534/* client pool size */
531struct sndrv_seq_client_pool { 535struct snd_seq_client_pool {
532 int client; /* client number to inquire */ 536 int client; /* client number to inquire */
533 int output_pool; /* outgoing (write) pool size */ 537 int output_pool; /* outgoing (write) pool size */
534 int input_pool; /* incoming (read) pool size */ 538 int input_pool; /* incoming (read) pool size */
@@ -552,13 +556,13 @@ struct sndrv_seq_client_pool {
552#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ 556#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
553#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ 557#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
554 558
555struct sndrv_seq_remove_events { 559struct snd_seq_remove_events {
556 unsigned int remove_mode; /* Flags that determine what gets removed */ 560 unsigned int remove_mode; /* Flags that determine what gets removed */
557 561
558 union sndrv_seq_timestamp time; 562 union snd_seq_timestamp time;
559 563
560 unsigned char queue; /* Queue for REMOVE_DEST */ 564 unsigned char queue; /* Queue for REMOVE_DEST */
561 struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */ 565 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
562 unsigned char channel; /* Channel for REMOVE_DEST */ 566 unsigned char channel; /* Channel for REMOVE_DEST */
563 567
564 int type; /* For REMOVE_EVENT_TYPE */ 568 int type; /* For REMOVE_EVENT_TYPE */
@@ -607,8 +611,8 @@ struct sndrv_seq_remove_events {
607#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) 611#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
608#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) 612#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
609 613
610struct sndrv_seq_port_info { 614struct snd_seq_port_info {
611 struct sndrv_seq_addr addr; /* client/port numbers */ 615 struct snd_seq_addr addr; /* client/port numbers */
612 char name[64]; /* port name */ 616 char name[64]; /* port name */
613 617
614 unsigned int capability; /* port capability bits */ 618 unsigned int capability; /* port capability bits */
@@ -631,7 +635,7 @@ struct sndrv_seq_port_info {
631#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ 635#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
632 636
633/* queue information */ 637/* queue information */
634struct sndrv_seq_queue_info { 638struct snd_seq_queue_info {
635 int queue; /* queue id */ 639 int queue; /* queue id */
636 640
637 /* 641 /*
@@ -647,11 +651,11 @@ struct sndrv_seq_queue_info {
647}; 651};
648 652
649/* queue info/status */ 653/* queue info/status */
650struct sndrv_seq_queue_status { 654struct snd_seq_queue_status {
651 int queue; /* queue id */ 655 int queue; /* queue id */
652 int events; /* read-only - queue size */ 656 int events; /* read-only - queue size */
653 sndrv_seq_tick_time_t tick; /* current tick */ 657 snd_seq_tick_time_t tick; /* current tick */
654 struct sndrv_seq_real_time time; /* current time */ 658 struct snd_seq_real_time time; /* current time */
655 int running; /* running state of queue */ 659 int running; /* running state of queue */
656 int flags; /* various flags */ 660 int flags; /* various flags */
657 char reserved[64]; /* for the future */ 661 char reserved[64]; /* for the future */
@@ -659,7 +663,7 @@ struct sndrv_seq_queue_status {
659 663
660 664
661/* queue tempo */ 665/* queue tempo */
662struct sndrv_seq_queue_tempo { 666struct snd_seq_queue_tempo {
663 int queue; /* sequencer queue */ 667 int queue; /* sequencer queue */
664 unsigned int tempo; /* current tempo, us/tick */ 668 unsigned int tempo; /* current tempo, us/tick */
665 int ppq; /* time resolution, ticks/quarter */ 669 int ppq; /* time resolution, ticks/quarter */
@@ -675,12 +679,12 @@ struct sndrv_seq_queue_tempo {
675#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ 679#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
676 680
677/* queue timer info */ 681/* queue timer info */
678struct sndrv_seq_queue_timer { 682struct snd_seq_queue_timer {
679 int queue; /* sequencer queue */ 683 int queue; /* sequencer queue */
680 int type; /* source timer type */ 684 int type; /* source timer type */
681 union { 685 union {
682 struct { 686 struct {
683 struct sndrv_timer_id id; /* ALSA's timer ID */ 687 struct snd_timer_id id; /* ALSA's timer ID */
684 unsigned int resolution; /* resolution in Hz */ 688 unsigned int resolution; /* resolution in Hz */
685 } alsa; 689 } alsa;
686 } u; 690 } u;
@@ -688,7 +692,7 @@ struct sndrv_seq_queue_timer {
688}; 692};
689 693
690 694
691struct sndrv_seq_queue_client { 695struct snd_seq_queue_client {
692 int queue; /* sequencer queue */ 696 int queue; /* sequencer queue */
693 int client; /* sequencer client */ 697 int client; /* sequencer client */
694 int used; /* queue is used with this client 698 int used; /* queue is used with this client
@@ -702,9 +706,9 @@ struct sndrv_seq_queue_client {
702#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) 706#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
703#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) 707#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
704 708
705struct sndrv_seq_port_subscribe { 709struct snd_seq_port_subscribe {
706 struct sndrv_seq_addr sender; /* sender address */ 710 struct snd_seq_addr sender; /* sender address */
707 struct sndrv_seq_addr dest; /* destination address */ 711 struct snd_seq_addr dest; /* destination address */
708 unsigned int voices; /* number of voices to be allocated (0 = don't care) */ 712 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
709 unsigned int flags; /* modes */ 713 unsigned int flags; /* modes */
710 unsigned char queue; /* input time-stamp queue (optional) */ 714 unsigned char queue; /* input time-stamp queue (optional) */
@@ -716,12 +720,12 @@ struct sndrv_seq_port_subscribe {
716#define SNDRV_SEQ_QUERY_SUBS_READ 0 720#define SNDRV_SEQ_QUERY_SUBS_READ 0
717#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 721#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
718 722
719struct sndrv_seq_query_subs { 723struct snd_seq_query_subs {
720 struct sndrv_seq_addr root; /* client/port id to be searched */ 724 struct snd_seq_addr root; /* client/port id to be searched */
721 int type; /* READ or WRITE */ 725 int type; /* READ or WRITE */
722 int index; /* 0..N-1 */ 726 int index; /* 0..N-1 */
723 int num_subs; /* R/O: number of subscriptions on this port */ 727 int num_subs; /* R/O: number of subscriptions on this port */
724 struct sndrv_seq_addr addr; /* R/O: result */ 728 struct snd_seq_addr addr; /* R/O: result */
725 unsigned char queue; /* R/O: result */ 729 unsigned char queue; /* R/O: result */
726 unsigned int flags; /* R/O: result */ 730 unsigned int flags; /* R/O: result */
727 char reserved[64]; /* for future use */ 731 char reserved[64]; /* for future use */
@@ -778,72 +782,72 @@ struct sndrv_seq_query_subs {
778#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 782#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
779 783
780/* size of ROM/RAM */ 784/* size of ROM/RAM */
781typedef unsigned int sndrv_seq_instr_size_t; 785typedef unsigned int snd_seq_instr_size_t;
782 786
783/* INSTR_INFO */ 787/* INSTR_INFO */
784 788
785struct sndrv_seq_instr_info { 789struct snd_seq_instr_info {
786 int result; /* operation result */ 790 int result; /* operation result */
787 unsigned int formats[8]; /* bitmap of supported formats */ 791 unsigned int formats[8]; /* bitmap of supported formats */
788 int ram_count; /* count of RAM banks */ 792 int ram_count; /* count of RAM banks */
789 sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ 793 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
790 int rom_count; /* count of ROM banks */ 794 int rom_count; /* count of ROM banks */
791 sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ 795 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
792 char reserved[128]; 796 char reserved[128];
793}; 797};
794 798
795/* INSTR_STATUS */ 799/* INSTR_STATUS */
796 800
797struct sndrv_seq_instr_status { 801struct snd_seq_instr_status {
798 int result; /* operation result */ 802 int result; /* operation result */
799 sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */ 803 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
800 int instrument_count; /* count of downloaded instruments */ 804 int instrument_count; /* count of downloaded instruments */
801 char reserved[128]; 805 char reserved[128];
802}; 806};
803 807
804/* INSTR_FORMAT_INFO */ 808/* INSTR_FORMAT_INFO */
805 809
806struct sndrv_seq_instr_format_info { 810struct snd_seq_instr_format_info {
807 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ 811 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
808 unsigned int len; /* max data length (without this structure) */ 812 unsigned int len; /* max data length (without this structure) */
809}; 813};
810 814
811struct sndrv_seq_instr_format_info_result { 815struct snd_seq_instr_format_info_result {
812 int result; /* operation result */ 816 int result; /* operation result */
813 char format[16]; /* format identifier */ 817 char format[16]; /* format identifier */
814 unsigned int len; /* filled data length (without this structure) */ 818 unsigned int len; /* filled data length (without this structure) */
815}; 819};
816 820
817/* instrument data */ 821/* instrument data */
818struct sndrv_seq_instr_data { 822struct snd_seq_instr_data {
819 char name[32]; /* instrument name */ 823 char name[32]; /* instrument name */
820 char reserved[16]; /* for the future use */ 824 char reserved[16]; /* for the future use */
821 int type; /* instrument type */ 825 int type; /* instrument type */
822 union { 826 union {
823 char format[16]; /* format identifier */ 827 char format[16]; /* format identifier */
824 struct sndrv_seq_instr alias; 828 struct snd_seq_instr alias;
825 } data; 829 } data;
826}; 830};
827 831
828/* INSTR_PUT/GET, data are stored in one block (extended), header + data */ 832/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
829 833
830struct sndrv_seq_instr_header { 834struct snd_seq_instr_header {
831 union { 835 union {
832 struct sndrv_seq_instr instr; 836 struct snd_seq_instr instr;
833 sndrv_seq_instr_cluster_t cluster; 837 snd_seq_instr_cluster_t cluster;
834 } id; /* instrument identifier */ 838 } id; /* instrument identifier */
835 unsigned int cmd; /* get/put/free command */ 839 unsigned int cmd; /* get/put/free command */
836 unsigned int flags; /* query flags (only for get) */ 840 unsigned int flags; /* query flags (only for get) */
837 unsigned int len; /* real instrument data length (without header) */ 841 unsigned int len; /* real instrument data length (without header) */
838 int result; /* operation result */ 842 int result; /* operation result */
839 char reserved[16]; /* for the future */ 843 char reserved[16]; /* for the future */
840 struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */ 844 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
841}; 845};
842 846
843/* INSTR_CLUSTER_SET */ 847/* INSTR_CLUSTER_SET */
844 848
845struct sndrv_seq_instr_cluster_set { 849struct snd_seq_instr_cluster_set {
846 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 850 snd_seq_instr_cluster_t cluster; /* cluster identifier */
847 char name[32]; /* cluster name */ 851 char name[32]; /* cluster name */
848 int priority; /* cluster priority */ 852 int priority; /* cluster priority */
849 char reserved[64]; /* for the future use */ 853 char reserved[64]; /* for the future use */
@@ -851,8 +855,8 @@ struct sndrv_seq_instr_cluster_set {
851 855
852/* INSTR_CLUSTER_GET */ 856/* INSTR_CLUSTER_GET */
853 857
854struct sndrv_seq_instr_cluster_get { 858struct snd_seq_instr_cluster_get {
855 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 859 snd_seq_instr_cluster_t cluster; /* cluster identifier */
856 char name[32]; /* cluster name */ 860 char name[32]; /* cluster name */
857 int priority; /* cluster priority */ 861 int priority; /* cluster priority */
858 char reserved[64]; /* for the future use */ 862 char reserved[64]; /* for the future use */
@@ -864,44 +868,44 @@ struct sndrv_seq_instr_cluster_get {
864 868
865#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) 869#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
866#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) 870#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
867#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) 871#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
868#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) 872#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
869 873
870#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) 874#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
871#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) 875#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
872 876
873#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info) 877#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
874#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info) 878#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
875#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info) 879#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
876#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info) 880#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
877 881
878#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe) 882#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
879#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe) 883#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
880 884
881#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info) 885#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
882#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info) 886#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
883#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info) 887#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
884#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info) 888#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
885#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info) 889#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
886#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status) 890#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
887#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo) 891#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
888#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo) 892#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
889#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner) 893#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
890#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner) 894#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
891#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer) 895#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
892#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer) 896#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
893/* XXX 897/* XXX
894#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync) 898#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
895#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync) 899#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
896*/ 900*/
897#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client) 901#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
898#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client) 902#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
899#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool) 903#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
900#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool) 904#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
901#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events) 905#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
902#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs) 906#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
903#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe) 907#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
904#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info) 908#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
905#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info) 909#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
906 910
907#endif /* __SOUND_ASEQUENCER_H */ 911#endif /* __SOUND_ASEQUENCER_H */
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h
index 204ca540c28e..2b5f24cc7548 100644
--- a/include/sound/seq_device.h
+++ b/include/sound/seq_device.h
@@ -21,9 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct snd_seq_device snd_seq_device_t;
25typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
26
27/* 24/*
28 * registered device information 25 * registered device information
29 */ 26 */
@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
36 33
37struct snd_seq_device { 34struct snd_seq_device {
38 /* device info */ 35 /* device info */
39 snd_card_t *card; /* sound card */ 36 struct snd_card *card; /* sound card */
40 int device; /* device number */ 37 int device; /* device number */
41 char id[ID_LEN]; /* driver id */ 38 char id[ID_LEN]; /* driver id */
42 char name[80]; /* device name */ 39 char name[80]; /* device name */
@@ -44,7 +41,7 @@ struct snd_seq_device {
44 void *driver_data; /* private data for driver */ 41 void *driver_data; /* private data for driver */
45 int status; /* flag - read only */ 42 int status; /* flag - read only */
46 void *private_data; /* private data for the caller */ 43 void *private_data; /* private data for the caller */
47 void (*private_free)(snd_seq_device_t *device); 44 void (*private_free)(struct snd_seq_device *device);
48 struct list_head list; /* link to next device */ 45 struct list_head list; /* link to next device */
49}; 46};
50 47
@@ -63,19 +60,19 @@ struct snd_seq_device {
63 * Typically, call snd_device_free(dev->card, dev->driver_data) 60 * Typically, call snd_device_free(dev->card, dev->driver_data)
64 */ 61 */
65struct snd_seq_dev_ops { 62struct snd_seq_dev_ops {
66 int (*init_device)(snd_seq_device_t *dev); 63 int (*init_device)(struct snd_seq_device *dev);
67 int (*free_device)(snd_seq_device_t *dev); 64 int (*free_device)(struct snd_seq_device *dev);
68}; 65};
69 66
70/* 67/*
71 * prototypes 68 * prototypes
72 */ 69 */
73void snd_seq_device_load_drivers(void); 70void snd_seq_device_load_drivers(void);
74int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); 71int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
75int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); 72int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
76int snd_seq_device_unregister_driver(char *id); 73int snd_seq_device_unregister_driver(char *id);
77 74
78#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) 75#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
79 76
80 77
81/* 78/*
@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id);
84#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" 81#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
85#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" 82#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
86 83
87
88#endif /* __SOUND_SEQ_DEVICE_H */ 84#endif /* __SOUND_SEQ_DEVICE_H */
diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h
index 1a654df4aa97..db764f09efb7 100644
--- a/include/sound/seq_instr.h
+++ b/include/sound/seq_instr.h
@@ -24,29 +24,27 @@
24#include "seq_kernel.h" 24#include "seq_kernel.h"
25 25
26/* Instrument cluster */ 26/* Instrument cluster */
27typedef struct _snd_seq_kcluster { 27struct snd_seq_kcluster {
28 snd_seq_instr_cluster_t cluster; 28 snd_seq_instr_cluster_t cluster;
29 char name[32]; 29 char name[32];
30 int priority; 30 int priority;
31 struct _snd_seq_kcluster *next; 31 struct snd_seq_kcluster *next;
32} snd_seq_kcluster_t; 32};
33 33
34/* return pointer to private data */ 34/* return pointer to private data */
35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) 35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
36
37typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
38 36
39/* Instrument structure */ 37/* Instrument structure */
40typedef struct _snd_seq_kinstr { 38struct snd_seq_kinstr {
41 snd_seq_instr_t instr; 39 struct snd_seq_instr instr;
42 char name[32]; 40 char name[32];
43 int type; /* instrument type */ 41 int type; /* instrument type */
44 int use; /* use count */ 42 int use; /* use count */
45 int busy; /* not useable */ 43 int busy; /* not useable */
46 int add_len; /* additional length */ 44 int add_len; /* additional length */
47 snd_seq_kinstr_ops_t *ops; /* operations */ 45 struct snd_seq_kinstr_ops *ops; /* operations */
48 struct _snd_seq_kinstr *next; 46 struct snd_seq_kinstr *next;
49} snd_seq_kinstr_t; 47};
50 48
51#define SNDRV_SEQ_INSTR_HASH_SIZE 32 49#define SNDRV_SEQ_INSTR_HASH_SIZE 32
52 50
@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr {
54#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ 52#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
55 53
56/* List of all instruments */ 54/* List of all instruments */
57typedef struct { 55struct snd_seq_kinstr_list {
58 snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; 56 struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
59 int count; /* count of all instruments */ 57 int count; /* count of all instruments */
60 58
61 snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; 59 struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
62 int ccount; /* count of all clusters */ 60 int ccount; /* count of all clusters */
63 61
64 int owner; /* current owner of the instrument list */ 62 int owner; /* current owner of the instrument list */
@@ -68,7 +66,7 @@ typedef struct {
68 spinlock_t ops_lock; 66 spinlock_t ops_lock;
69 struct semaphore ops_mutex; 67 struct semaphore ops_mutex;
70 unsigned long ops_flags; 68 unsigned long ops_flags;
71} snd_seq_kinstr_list_t; 69};
72 70
73#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 71#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
74#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 72#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops {
78 long add_len; /* additional length */ 76 long add_len; /* additional length */
79 char *instr_type; 77 char *instr_type;
80 int (*info)(void *private_data, char *info_data, long len); 78 int (*info)(void *private_data, char *info_data, long len);
81 int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, 79 int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
82 char __user *instr_data, long len, int atomic, int cmd); 80 char __user *instr_data, long len, int atomic, int cmd);
83 int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, 81 int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
84 char __user *instr_data, long len, int atomic, int cmd); 82 char __user *instr_data, long len, int atomic, int cmd);
85 int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); 83 int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
86 int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); 84 int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
87 void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); 85 void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
88 struct snd_seq_kinstr_ops *next; 86 struct snd_seq_kinstr_ops *next;
89}; 87};
90 88
91 89
92/* instrument operations */ 90/* instrument operations */
93snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); 91struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
94void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); 92void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
95int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, 93int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
96 snd_seq_instr_header_t *ifree, 94 struct snd_seq_instr_header *ifree,
97 int client, 95 int client,
98 int atomic); 96 int atomic);
99snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, 97struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
100 snd_seq_instr_t *instr, 98 struct snd_seq_instr *instr,
101 int exact, 99 int exact,
102 int follow_alias); 100 int follow_alias);
103void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, 101void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
104 snd_seq_kinstr_t *instr); 102 struct snd_seq_kinstr *instr);
105int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, 103int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
106 snd_seq_kinstr_list_t *list, 104 struct snd_seq_kinstr_list *list,
107 snd_seq_event_t *ev, 105 struct snd_seq_event *ev,
108 int client, 106 int client,
109 int atomic, 107 int atomic,
110 int hop); 108 int hop);
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 4beca1952c76..1b60890b44cd 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -24,62 +24,8 @@
24#include <linux/time.h> 24#include <linux/time.h>
25#include "asequencer.h" 25#include "asequencer.h"
26 26
27typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; 27typedef struct snd_seq_real_time snd_seq_real_time_t;
28typedef sndrv_seq_position_t snd_seq_position_t; 28typedef union snd_seq_timestamp snd_seq_timestamp_t;
29typedef sndrv_seq_frequency_t snd_seq_frequency_t;
30typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
31typedef enum sndrv_seq_client_type snd_seq_client_type_t;
32typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
33typedef struct sndrv_seq_port_info snd_seq_port_info_t;
34typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
35typedef struct sndrv_seq_event snd_seq_event_t;
36typedef struct sndrv_seq_addr snd_seq_addr_t;
37typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
38typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
39typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
40typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
41typedef struct sndrv_seq_real_time snd_seq_real_time_t;
42typedef struct sndrv_seq_system_info snd_seq_system_info_t;
43typedef struct sndrv_seq_client_info snd_seq_client_info_t;
44typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
45typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
46typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
47typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
48typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
49typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
50typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
51typedef struct sndrv_seq_instr snd_seq_instr_t;
52typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
53typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
54typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
55
56#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
57#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
58#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
59#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
60#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
61#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
62#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
63#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
64#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
65#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
66#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
67#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
68#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
69#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
70#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
71#define snd_seq_ev_length_type sndrv_seq_ev_length_type
72#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
73#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
74#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
75#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
76#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
77#define snd_seq_ev_is_real sndrv_seq_ev_is_real
78#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
79#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
80#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
81#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
82#define snd_seq_queue_owner sndrv_seq_queue_owner
83 29
84/* maximum number of events dequeued per schedule interval */ 30/* maximum number of events dequeued per schedule interval */
85#define SNDRV_SEQ_MAX_DEQUEUE 50 31#define SNDRV_SEQ_MAX_DEQUEUE 50
@@ -114,69 +60,56 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
114/* max size of event size */ 60/* max size of event size */
115#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff 61#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
116 62
117/* typedefs */
118struct _snd_seq_user_client;
119struct _snd_seq_kernel_client;
120struct _snd_seq_client;
121struct _snd_seq_queue;
122
123typedef struct _snd_seq_user_client user_client_t;
124typedef struct _snd_seq_kernel_client kernel_client_t;
125typedef struct _snd_seq_client client_t;
126typedef struct _snd_seq_queue queue_t;
127
128/* call-backs for kernel client */ 63/* call-backs for kernel client */
129 64
130typedef struct { 65struct snd_seq_client_callback {
131 void *private_data; 66 void *private_data;
132 unsigned allow_input: 1, 67 unsigned allow_input: 1,
133 allow_output: 1; 68 allow_output: 1;
134 /*...*/ 69 /*...*/
135} snd_seq_client_callback_t; 70};
136 71
137/* call-backs for kernel port */ 72/* call-backs for kernel port */
138typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); 73struct snd_seq_port_callback {
139typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
140typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
141typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
142
143typedef struct {
144 struct module *owner; 74 struct module *owner;
145 void *private_data; 75 void *private_data;
146 snd_seq_kernel_port_open_t *subscribe; 76 int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
147 snd_seq_kernel_port_close_t *unsubscribe; 77 int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
148 snd_seq_kernel_port_open_t *use; 78 int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
149 snd_seq_kernel_port_close_t *unuse; 79 int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
150 snd_seq_kernel_port_input_t *event_input; 80 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
151 snd_seq_kernel_port_private_free_t *private_free; 81 void (*private_free)(void *private_data);
152 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ 82 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
153 /*...*/ 83 /*...*/
154} snd_seq_port_callback_t; 84};
155 85
156/* interface for kernel client */ 86/* interface for kernel client */
157extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); 87int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
158extern int snd_seq_delete_kernel_client(int client); 88 struct snd_seq_client_callback *callback);
159extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); 89int snd_seq_delete_kernel_client(int client);
160extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); 90int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
161extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); 91int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
92int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
162 93
163#define SNDRV_SEQ_EXT_MASK 0xc0000000 94#define SNDRV_SEQ_EXT_MASK 0xc0000000
164#define SNDRV_SEQ_EXT_USRPTR 0x80000000 95#define SNDRV_SEQ_EXT_USRPTR 0x80000000
165#define SNDRV_SEQ_EXT_CHAINED 0x40000000 96#define SNDRV_SEQ_EXT_CHAINED 0x40000000
166 97
167typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); 98typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
168int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); 99int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
169int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); 100 int in_kernel, int size_aligned);
101int snd_seq_dump_var_event(const struct snd_seq_event *event,
102 snd_seq_dump_func_t func, void *private_data);
170 103
171/* interface for OSS emulation */ 104/* interface for OSS emulation */
172int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); 105int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
173 106
174/* port callback routines */ 107/* port callback routines */
175void snd_port_init_callback(snd_seq_port_callback_t *p); 108void snd_port_init_callback(struct snd_seq_port_callback *p);
176snd_seq_port_callback_t *snd_port_alloc_callback(void); 109struct snd_seq_port_callback *snd_port_alloc_callback(void);
177 110
178/* port attach/detach */ 111/* port attach/detach */
179int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, 112int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
180 int cap, int type, int midi_channels, int midi_voices, char *portname); 113 int cap, int type, int midi_channels, int midi_voices, char *portname);
181int snd_seq_event_port_detach(int client, int port); 114int snd_seq_event_port_detach(int client, int port);
182 115
diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index e58ca45bc73b..d6c4615901b9 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -29,7 +29,7 @@
29 * channel. All drivers for hardware that does not understand midi 29 * channel. All drivers for hardware that does not understand midi
30 * directly will probably need to use this structure. 30 * directly will probably need to use this structure.
31 */ 31 */
32typedef struct snd_midi_channel { 32struct snd_midi_channel {
33 void *private; /* A back pointer to driver data */ 33 void *private; /* A back pointer to driver data */
34 int number; /* The channel number */ 34 int number; /* The channel number */
35 int client; /* The client associated with this channel */ 35 int client; /* The client associated with this channel */
@@ -53,41 +53,43 @@ typedef struct snd_midi_channel {
53 short gm_rpn_fine_tuning; /* Master fine tuning */ 53 short gm_rpn_fine_tuning; /* Master fine tuning */
54 short gm_rpn_coarse_tuning; /* Master coarse tuning */ 54 short gm_rpn_coarse_tuning; /* Master coarse tuning */
55 55
56} snd_midi_channel_t; 56};
57 57
58/* 58/*
59 * A structure that represets a set of channels bound to a port. There 59 * A structure that represets a set of channels bound to a port. There
60 * would usually be 16 channels per port. But fewer could be used for 60 * would usually be 16 channels per port. But fewer could be used for
61 * particular cases. 61 * particular cases.
62 * The channel set consists of information describing the client and 62 * The channel set consists of information describing the client and
63 * port for this midi synth and an array of snd_midi_channel_t structures. 63 * port for this midi synth and an array of snd_midi_channel structures.
64 * A driver that had no need for snd_midi_channel_t could still use the 64 * A driver that had no need for snd_midi_channel could still use the
65 * channel set type if it wished with the channel array null. 65 * channel set type if it wished with the channel array null.
66 */ 66 */
67typedef struct snd_midi_channel_set { 67struct snd_midi_channel_set {
68 void *private_data; /* Driver data */ 68 void *private_data; /* Driver data */
69 int client; /* Client for this port */ 69 int client; /* Client for this port */
70 int port; /* The port number */ 70 int port; /* The port number */
71 71
72 int max_channels; /* Size of the channels array */ 72 int max_channels; /* Size of the channels array */
73 snd_midi_channel_t *channels; 73 struct snd_midi_channel *channels;
74 74
75 unsigned char midi_mode; /* MIDI operating mode */ 75 unsigned char midi_mode; /* MIDI operating mode */
76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ 76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
77 unsigned char gs_chorus_mode; 77 unsigned char gs_chorus_mode;
78 unsigned char gs_reverb_mode; 78 unsigned char gs_reverb_mode;
79 79
80} snd_midi_channel_set_t; 80};
81 81
82typedef struct snd_seq_midi_op { 82struct snd_midi_op {
83 void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 83 void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
84 void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ 84 void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
85 void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 85 void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
86 void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ 86 void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
87 void (*control)(void *private_data, int type, snd_midi_channel_t *chan); 87 void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
88 void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 88 void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
89 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 89 struct snd_midi_channel_set *chset);
90} snd_midi_op_t; 90 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
91 struct snd_midi_channel_set *chset);
92};
91 93
92/* 94/*
93 * These defines are used so that pitchbend, aftertouch etc, can be 95 * These defines are used so that pitchbend, aftertouch etc, can be
@@ -186,10 +188,10 @@ enum {
186}; 188};
187 189
188/* Prototypes for midi_process.c */ 190/* Prototypes for midi_process.c */
189void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, 191void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev,
190 snd_midi_channel_set_t *chanset); 192 struct snd_midi_channel_set *chanset);
191void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); 193void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
192snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); 194struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
193void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); 195void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);
194 196
195#endif /* __SOUND_SEQ_MIDI_EMUL_H */ 197#endif /* __SOUND_SEQ_MIDI_EMUL_H */
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h
index 8857e2bd31a5..dd789e7cdb20 100644
--- a/include/sound/seq_midi_event.h
+++ b/include/sound/seq_midi_event.h
@@ -26,10 +26,8 @@
26 26
27#define MAX_MIDI_EVENT_BUF 256 27#define MAX_MIDI_EVENT_BUF 256
28 28
29typedef struct snd_midi_event_t snd_midi_event_t;
30
31/* midi status */ 29/* midi status */
32struct snd_midi_event_t { 30struct snd_midi_event {
33 int qlen; /* queue length */ 31 int qlen; /* queue length */
34 int read; /* chars read */ 32 int read; /* chars read */
35 int type; /* current event type */ 33 int type; /* current event type */
@@ -40,15 +38,17 @@ struct snd_midi_event_t {
40 spinlock_t lock; 38 spinlock_t lock;
41}; 39};
42 40
43int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); 41int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
44void snd_midi_event_free(snd_midi_event_t *dev); 42void snd_midi_event_free(struct snd_midi_event *dev);
45void snd_midi_event_reset_encode(snd_midi_event_t *dev); 43void snd_midi_event_reset_encode(struct snd_midi_event *dev);
46void snd_midi_event_reset_decode(snd_midi_event_t *dev); 44void snd_midi_event_reset_decode(struct snd_midi_event *dev);
47void snd_midi_event_no_status(snd_midi_event_t *dev, int on); 45void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
48/* encode from byte stream - return number of written bytes if success */ 46/* encode from byte stream - return number of written bytes if success */
49long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 47long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
50int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); 48 struct snd_seq_event *ev);
49int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
51/* decode from event to bytes - return number of written bytes if success */ 50/* decode from event to bytes - return number of written bytes if success */
52long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 51long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
52 struct snd_seq_event *ev);
53 53
54#endif /* __SOUND_SEQ_MIDI_EVENT_H */ 54#endif /* __SOUND_SEQ_MIDI_EVENT_H */
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
index 1ad27e859af3..8d5aea76d7c3 100644
--- a/include/sound/seq_virmidi.h
+++ b/include/sound/seq_virmidi.h
@@ -25,25 +25,23 @@
25#include "rawmidi.h" 25#include "rawmidi.h"
26#include "seq_midi_event.h" 26#include "seq_midi_event.h"
27 27
28typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
29
30/* 28/*
31 * device file instance: 29 * device file instance:
32 * This instance is created at each time the midi device file is 30 * This instance is created at each time the midi device file is
33 * opened. Each instance has its own input buffer and MIDI parser 31 * opened. Each instance has its own input buffer and MIDI parser
34 * (buffer), and is associated with the device instance. 32 * (buffer), and is associated with the device instance.
35 */ 33 */
36typedef struct _snd_virmidi { 34struct snd_virmidi {
37 struct list_head list; 35 struct list_head list;
38 int seq_mode; 36 int seq_mode;
39 int client; 37 int client;
40 int port; 38 int port;
41 unsigned int trigger: 1; 39 unsigned int trigger: 1;
42 snd_midi_event_t *parser; 40 struct snd_midi_event *parser;
43 snd_seq_event_t event; 41 struct snd_seq_event event;
44 snd_virmidi_dev_t *rdev; 42 struct snd_virmidi_dev *rdev;
45 snd_rawmidi_substream_t *substream; 43 struct snd_rawmidi_substream *substream;
46} snd_virmidi_t; 44};
47 45
48#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) 46#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
49#define SNDRV_VIRMIDI_USE (1<<1) 47#define SNDRV_VIRMIDI_USE (1<<1)
@@ -53,9 +51,9 @@ typedef struct _snd_virmidi {
53 * Each virtual midi device has one device instance. It contains 51 * Each virtual midi device has one device instance. It contains
54 * common information and the linked-list of opened files, 52 * common information and the linked-list of opened files,
55 */ 53 */
56struct _snd_virmidi_dev { 54struct snd_virmidi_dev {
57 snd_card_t *card; /* associated card */ 55 struct snd_card *card; /* associated card */
58 snd_rawmidi_t *rmidi; /* rawmidi device */ 56 struct snd_rawmidi *rmidi; /* rawmidi device */
59 int seq_mode; /* SNDRV_VIRMIDI_XXX */ 57 int seq_mode; /* SNDRV_VIRMIDI_XXX */
60 int device; /* sequencer device */ 58 int device; /* sequencer device */
61 int client; /* created/attached client */ 59 int client; /* created/attached client */
@@ -78,6 +76,6 @@ struct _snd_virmidi_dev {
78#define SNDRV_VIRMIDI_SEQ_ATTACH 1 76#define SNDRV_VIRMIDI_SEQ_ATTACH 1
79#define SNDRV_VIRMIDI_SEQ_DISPATCH 2 77#define SNDRV_VIRMIDI_SEQ_DISPATCH 2
80 78
81int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); 79int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
82 80
83#endif /* __SOUND_SEQ_VIRMIDI */ 81#endif /* __SOUND_SEQ_VIRMIDI */
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index a886db94b1fa..5eab4201c640 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -58,14 +58,18 @@ static DECLARE_MUTEX(register_mutex);
58 * client table 58 * client table
59 */ 59 */
60static char clienttablock[SNDRV_SEQ_MAX_CLIENTS]; 60static char clienttablock[SNDRV_SEQ_MAX_CLIENTS];
61static client_t *clienttab[SNDRV_SEQ_MAX_CLIENTS]; 61static struct snd_seq_client *clienttab[SNDRV_SEQ_MAX_CLIENTS];
62static usage_t client_usage; 62static struct snd_seq_usage client_usage;
63 63
64/* 64/*
65 * prototypes 65 * prototypes
66 */ 66 */
67static int bounce_error_event(client_t *client, snd_seq_event_t *event, int err, int atomic, int hop); 67static int bounce_error_event(struct snd_seq_client *client,
68static int snd_seq_deliver_single_event(client_t *client, snd_seq_event_t *event, int filter, int atomic, int hop); 68 struct snd_seq_event *event,
69 int err, int atomic, int hop);
70static int snd_seq_deliver_single_event(struct snd_seq_client *client,
71 struct snd_seq_event *event,
72 int filter, int atomic, int hop);
69 73
70/* 74/*
71 */ 75 */
@@ -96,16 +100,17 @@ static inline unsigned short snd_seq_file_flags(struct file *file)
96 } 100 }
97} 101}
98 102
99static inline int snd_seq_write_pool_allocated(client_t *client) 103static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client)
100{ 104{
101 return snd_seq_total_cells(client->pool) > 0; 105 return snd_seq_total_cells(client->pool) > 0;
102} 106}
103 107
104/* return pointer to client structure for specified id */ 108/* return pointer to client structure for specified id */
105static client_t *clientptr(int clientid) 109static struct snd_seq_client *clientptr(int clientid)
106{ 110{
107 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { 111 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) {
108 snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); 112 snd_printd("Seq: oops. Trying to get pointer to client %d\n",
113 clientid);
109 return NULL; 114 return NULL;
110 } 115 }
111 return clienttab[clientid]; 116 return clienttab[clientid];
@@ -113,13 +118,14 @@ static client_t *clientptr(int clientid)
113 118
114extern int seq_client_load[]; 119extern int seq_client_load[];
115 120
116client_t *snd_seq_client_use_ptr(int clientid) 121struct snd_seq_client *snd_seq_client_use_ptr(int clientid)
117{ 122{
118 unsigned long flags; 123 unsigned long flags;
119 client_t *client; 124 struct snd_seq_client *client;
120 125
121 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { 126 if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) {
122 snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); 127 snd_printd("Seq: oops. Trying to get pointer to client %d\n",
128 clientid);
123 return NULL; 129 return NULL;
124 } 130 }
125 spin_lock_irqsave(&clients_lock, flags); 131 spin_lock_irqsave(&clients_lock, flags);
@@ -144,7 +150,8 @@ client_t *snd_seq_client_use_ptr(int clientid)
144 if (seq_client_load[idx] < 0) 150 if (seq_client_load[idx] < 0)
145 break; 151 break;
146 if (seq_client_load[idx] == clientid) { 152 if (seq_client_load[idx] == clientid) {
147 request_module("snd-seq-client-%i", clientid); 153 request_module("snd-seq-client-%i",
154 clientid);
148 break; 155 break;
149 } 156 }
150 } 157 }
@@ -174,14 +181,14 @@ client_t *snd_seq_client_use_ptr(int clientid)
174 return client; 181 return client;
175} 182}
176 183
177static void usage_alloc(usage_t * res, int num) 184static void usage_alloc(struct snd_seq_usage *res, int num)
178{ 185{
179 res->cur += num; 186 res->cur += num;
180 if (res->cur > res->peak) 187 if (res->cur > res->peak)
181 res->peak = res->cur; 188 res->peak = res->cur;
182} 189}
183 190
184static void usage_free(usage_t * res, int num) 191static void usage_free(struct snd_seq_usage *res, int num)
185{ 192{
186 res->cur -= num; 193 res->cur -= num;
187} 194}
@@ -196,11 +203,11 @@ int __init client_init_data(void)
196} 203}
197 204
198 205
199static client_t *seq_create_client1(int client_index, int poolsize) 206static struct snd_seq_client *seq_create_client1(int client_index, int poolsize)
200{ 207{
201 unsigned long flags; 208 unsigned long flags;
202 int c; 209 int c;
203 client_t *client; 210 struct snd_seq_client *client;
204 211
205 /* init client data */ 212 /* init client data */
206 client = kzalloc(sizeof(*client), GFP_KERNEL); 213 client = kzalloc(sizeof(*client), GFP_KERNEL);
@@ -241,7 +248,7 @@ static client_t *seq_create_client1(int client_index, int poolsize)
241} 248}
242 249
243 250
244static int seq_free_client1(client_t *client) 251static int seq_free_client1(struct snd_seq_client *client)
245{ 252{
246 unsigned long flags; 253 unsigned long flags;
247 254
@@ -263,12 +270,13 @@ static int seq_free_client1(client_t *client)
263} 270}
264 271
265 272
266static void seq_free_client(client_t * client) 273static void seq_free_client(struct snd_seq_client * client)
267{ 274{
268 down(&register_mutex); 275 down(&register_mutex);
269 switch (client->type) { 276 switch (client->type) {
270 case NO_CLIENT: 277 case NO_CLIENT:
271 snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", client->number); 278 snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n",
279 client->number);
272 break; 280 break;
273 case USER_CLIENT: 281 case USER_CLIENT:
274 case KERNEL_CLIENT: 282 case KERNEL_CLIENT:
@@ -277,7 +285,8 @@ static void seq_free_client(client_t * client)
277 break; 285 break;
278 286
279 default: 287 default:
280 snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); 288 snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n",
289 client->number, client->type);
281 } 290 }
282 up(&register_mutex); 291 up(&register_mutex);
283 292
@@ -292,8 +301,8 @@ static void seq_free_client(client_t * client)
292static int snd_seq_open(struct inode *inode, struct file *file) 301static int snd_seq_open(struct inode *inode, struct file *file)
293{ 302{
294 int c, mode; /* client id */ 303 int c, mode; /* client id */
295 client_t *client; 304 struct snd_seq_client *client;
296 user_client_t *user; 305 struct snd_seq_user_client *user;
297 306
298 if (down_interruptible(&register_mutex)) 307 if (down_interruptible(&register_mutex))
299 return -ERESTARTSYS; 308 return -ERESTARTSYS;
@@ -344,7 +353,7 @@ static int snd_seq_open(struct inode *inode, struct file *file)
344/* delete a user client */ 353/* delete a user client */
345static int snd_seq_release(struct inode *inode, struct file *file) 354static int snd_seq_release(struct inode *inode, struct file *file)
346{ 355{
347 client_t *client = (client_t *) file->private_data; 356 struct snd_seq_client *client = file->private_data;
348 357
349 if (client) { 358 if (client) {
350 seq_free_client(client); 359 seq_free_client(client);
@@ -364,13 +373,14 @@ static int snd_seq_release(struct inode *inode, struct file *file)
364 * -EINVAL no enough user-space buffer to write the whole event 373 * -EINVAL no enough user-space buffer to write the whole event
365 * -EFAULT seg. fault during copy to user space 374 * -EFAULT seg. fault during copy to user space
366 */ 375 */
367static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, loff_t *offset) 376static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count,
377 loff_t *offset)
368{ 378{
369 client_t *client = (client_t *) file->private_data; 379 struct snd_seq_client *client = file->private_data;
370 fifo_t *fifo; 380 struct snd_seq_fifo *fifo;
371 int err; 381 int err;
372 long result = 0; 382 long result = 0;
373 snd_seq_event_cell_t *cell; 383 struct snd_seq_event_cell *cell;
374 384
375 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT)) 385 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT))
376 return -ENXIO; 386 return -ENXIO;
@@ -396,7 +406,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
396 snd_seq_fifo_lock(fifo); 406 snd_seq_fifo_lock(fifo);
397 407
398 /* while data available in queue */ 408 /* while data available in queue */
399 while (count >= sizeof(snd_seq_event_t)) { 409 while (count >= sizeof(struct snd_seq_event)) {
400 int nonblock; 410 int nonblock;
401 411
402 nonblock = (file->f_flags & O_NONBLOCK) || result > 0; 412 nonblock = (file->f_flags & O_NONBLOCK) || result > 0;
@@ -404,34 +414,34 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
404 break; 414 break;
405 } 415 }
406 if (snd_seq_ev_is_variable(&cell->event)) { 416 if (snd_seq_ev_is_variable(&cell->event)) {
407 snd_seq_event_t tmpev; 417 struct snd_seq_event tmpev;
408 tmpev = cell->event; 418 tmpev = cell->event;
409 tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK; 419 tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK;
410 if (copy_to_user(buf, &tmpev, sizeof(snd_seq_event_t))) { 420 if (copy_to_user(buf, &tmpev, sizeof(struct snd_seq_event))) {
411 err = -EFAULT; 421 err = -EFAULT;
412 break; 422 break;
413 } 423 }
414 count -= sizeof(snd_seq_event_t); 424 count -= sizeof(struct snd_seq_event);
415 buf += sizeof(snd_seq_event_t); 425 buf += sizeof(struct snd_seq_event);
416 err = snd_seq_expand_var_event(&cell->event, count, 426 err = snd_seq_expand_var_event(&cell->event, count,
417 (char __force *)buf, 0, 427 (char __force *)buf, 0,
418 sizeof(snd_seq_event_t)); 428 sizeof(struct snd_seq_event));
419 if (err < 0) 429 if (err < 0)
420 break; 430 break;
421 result += err; 431 result += err;
422 count -= err; 432 count -= err;
423 buf += err; 433 buf += err;
424 } else { 434 } else {
425 if (copy_to_user(buf, &cell->event, sizeof(snd_seq_event_t))) { 435 if (copy_to_user(buf, &cell->event, sizeof(struct snd_seq_event))) {
426 err = -EFAULT; 436 err = -EFAULT;
427 break; 437 break;
428 } 438 }
429 count -= sizeof(snd_seq_event_t); 439 count -= sizeof(struct snd_seq_event);
430 buf += sizeof(snd_seq_event_t); 440 buf += sizeof(struct snd_seq_event);
431 } 441 }
432 snd_seq_cell_free(cell); 442 snd_seq_cell_free(cell);
433 cell = NULL; /* to be sure */ 443 cell = NULL; /* to be sure */
434 result += sizeof(snd_seq_event_t); 444 result += sizeof(struct snd_seq_event);
435 } 445 }
436 446
437 if (err < 0) { 447 if (err < 0) {
@@ -449,7 +459,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
449/* 459/*
450 * check access permission to the port 460 * check access permission to the port
451 */ 461 */
452static int check_port_perm(client_port_t *port, unsigned int flags) 462static int check_port_perm(struct snd_seq_client_port *port, unsigned int flags)
453{ 463{
454 if ((port->capability & flags) != flags) 464 if ((port->capability & flags) != flags)
455 return 0; 465 return 0;
@@ -460,9 +470,10 @@ static int check_port_perm(client_port_t *port, unsigned int flags)
460 * check if the destination client is available, and return the pointer 470 * check if the destination client is available, and return the pointer
461 * if filter is non-zero, client filter bitmap is tested. 471 * if filter is non-zero, client filter bitmap is tested.
462 */ 472 */
463static client_t *get_event_dest_client(snd_seq_event_t *event, int filter) 473static struct snd_seq_client *get_event_dest_client(struct snd_seq_event *event,
474 int filter)
464{ 475{
465 client_t *dest; 476 struct snd_seq_client *dest;
466 477
467 dest = snd_seq_client_use_ptr(event->dest.client); 478 dest = snd_seq_client_use_ptr(event->dest.client);
468 if (dest == NULL) 479 if (dest == NULL)
@@ -493,10 +504,11 @@ __not_avail:
493 * quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra 504 * quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra
494 * kmalloc. 505 * kmalloc.
495 */ 506 */
496static int bounce_error_event(client_t *client, snd_seq_event_t *event, 507static int bounce_error_event(struct snd_seq_client *client,
508 struct snd_seq_event *event,
497 int err, int atomic, int hop) 509 int err, int atomic, int hop)
498{ 510{
499 snd_seq_event_t bounce_ev; 511 struct snd_seq_event bounce_ev;
500 int result; 512 int result;
501 513
502 if (client == NULL || 514 if (client == NULL ||
@@ -531,9 +543,10 @@ static int bounce_error_event(client_t *client, snd_seq_event_t *event,
531 * of the given queue. 543 * of the given queue.
532 * return non-zero if updated. 544 * return non-zero if updated.
533 */ 545 */
534static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real_time) 546static int update_timestamp_of_queue(struct snd_seq_event *event,
547 int queue, int real_time)
535{ 548{
536 queue_t *q; 549 struct snd_seq_queue *q;
537 550
538 q = queueptr(queue); 551 q = queueptr(queue);
539 if (! q) 552 if (! q)
@@ -559,12 +572,12 @@ static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real
559 * RETURN VALUE: 0 : if succeeded 572 * RETURN VALUE: 0 : if succeeded
560 * <0 : error 573 * <0 : error
561 */ 574 */
562static int snd_seq_deliver_single_event(client_t *client, 575static int snd_seq_deliver_single_event(struct snd_seq_client *client,
563 snd_seq_event_t *event, 576 struct snd_seq_event *event,
564 int filter, int atomic, int hop) 577 int filter, int atomic, int hop)
565{ 578{
566 client_t *dest = NULL; 579 struct snd_seq_client *dest = NULL;
567 client_port_t *dest_port = NULL; 580 struct snd_seq_client_port *dest_port = NULL;
568 int result = -ENOENT; 581 int result = -ENOENT;
569 int direct; 582 int direct;
570 583
@@ -596,7 +609,9 @@ static int snd_seq_deliver_single_event(client_t *client,
596 case KERNEL_CLIENT: 609 case KERNEL_CLIENT:
597 if (dest_port->event_input == NULL) 610 if (dest_port->event_input == NULL)
598 break; 611 break;
599 result = dest_port->event_input(event, direct, dest_port->private_data, atomic, hop); 612 result = dest_port->event_input(event, direct,
613 dest_port->private_data,
614 atomic, hop);
600 break; 615 break;
601 default: 616 default:
602 break; 617 break;
@@ -618,16 +633,16 @@ static int snd_seq_deliver_single_event(client_t *client,
618/* 633/*
619 * send the event to all subscribers: 634 * send the event to all subscribers:
620 */ 635 */
621static int deliver_to_subscribers(client_t *client, 636static int deliver_to_subscribers(struct snd_seq_client *client,
622 snd_seq_event_t *event, 637 struct snd_seq_event *event,
623 int atomic, int hop) 638 int atomic, int hop)
624{ 639{
625 subscribers_t *subs; 640 struct snd_seq_subscribers *subs;
626 int err = 0, num_ev = 0; 641 int err = 0, num_ev = 0;
627 snd_seq_event_t event_saved; 642 struct snd_seq_event event_saved;
628 client_port_t *src_port; 643 struct snd_seq_client_port *src_port;
629 struct list_head *p; 644 struct list_head *p;
630 port_subs_info_t *grp; 645 struct snd_seq_port_subs_info *grp;
631 646
632 src_port = snd_seq_port_use_ptr(client, event->source.port); 647 src_port = snd_seq_port_use_ptr(client, event->source.port);
633 if (src_port == NULL) 648 if (src_port == NULL)
@@ -642,7 +657,7 @@ static int deliver_to_subscribers(client_t *client,
642 else 657 else
643 down_read(&grp->list_mutex); 658 down_read(&grp->list_mutex);
644 list_for_each(p, &grp->list_head) { 659 list_for_each(p, &grp->list_head) {
645 subs = list_entry(p, subscribers_t, src_list); 660 subs = list_entry(p, struct snd_seq_subscribers, src_list);
646 event->dest = subs->info.dest; 661 event->dest = subs->info.dest;
647 if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) 662 if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP)
648 /* convert time according to flag with subscription */ 663 /* convert time according to flag with subscription */
@@ -670,12 +685,12 @@ static int deliver_to_subscribers(client_t *client,
670/* 685/*
671 * broadcast to all ports: 686 * broadcast to all ports:
672 */ 687 */
673static int port_broadcast_event(client_t *client, 688static int port_broadcast_event(struct snd_seq_client *client,
674 snd_seq_event_t *event, 689 struct snd_seq_event *event,
675 int atomic, int hop) 690 int atomic, int hop)
676{ 691{
677 int num_ev = 0, err = 0; 692 int num_ev = 0, err = 0;
678 client_t *dest_client; 693 struct snd_seq_client *dest_client;
679 struct list_head *p; 694 struct list_head *p;
680 695
681 dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST); 696 dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST);
@@ -684,7 +699,7 @@ static int port_broadcast_event(client_t *client,
684 699
685 read_lock(&dest_client->ports_lock); 700 read_lock(&dest_client->ports_lock);
686 list_for_each(p, &dest_client->ports_list_head) { 701 list_for_each(p, &dest_client->ports_list_head) {
687 client_port_t *port = list_entry(p, client_port_t, list); 702 struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list);
688 event->dest.port = port->addr.port; 703 event->dest.port = port->addr.port;
689 /* pass NULL as source client to avoid error bounce */ 704 /* pass NULL as source client to avoid error bounce */
690 err = snd_seq_deliver_single_event(NULL, event, 705 err = snd_seq_deliver_single_event(NULL, event,
@@ -704,12 +719,12 @@ static int port_broadcast_event(client_t *client,
704 * send the event to all clients: 719 * send the event to all clients:
705 * if destination port is also ADDRESS_BROADCAST, deliver to all ports. 720 * if destination port is also ADDRESS_BROADCAST, deliver to all ports.
706 */ 721 */
707static int broadcast_event(client_t *client, 722static int broadcast_event(struct snd_seq_client *client,
708 snd_seq_event_t *event, int atomic, int hop) 723 struct snd_seq_event *event, int atomic, int hop)
709{ 724{
710 int err = 0, num_ev = 0; 725 int err = 0, num_ev = 0;
711 int dest; 726 int dest;
712 snd_seq_addr_t addr; 727 struct snd_seq_addr addr;
713 728
714 addr = event->dest; /* save */ 729 addr = event->dest; /* save */
715 730
@@ -736,7 +751,7 @@ static int broadcast_event(client_t *client,
736 751
737 752
738/* multicast - not supported yet */ 753/* multicast - not supported yet */
739static int multicast_event(client_t *client, snd_seq_event_t *event, 754static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event,
740 int atomic, int hop) 755 int atomic, int hop)
741{ 756{
742 snd_printd("seq: multicast not supported yet.\n"); 757 snd_printd("seq: multicast not supported yet.\n");
@@ -753,7 +768,7 @@ static int multicast_event(client_t *client, snd_seq_event_t *event,
753 * n == 0 : the event was not passed to any client. 768 * n == 0 : the event was not passed to any client.
754 * n < 0 : error - event was not processed. 769 * n < 0 : error - event was not processed.
755 */ 770 */
756static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event, 771static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_event *event,
757 int atomic, int hop) 772 int atomic, int hop)
758{ 773{
759 int result; 774 int result;
@@ -794,9 +809,9 @@ static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event,
794 * n == 0 : the event was not passed to any client. 809 * n == 0 : the event was not passed to any client.
795 * n < 0 : error - event was not processed. 810 * n < 0 : error - event was not processed.
796 */ 811 */
797int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) 812int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop)
798{ 813{
799 client_t *client; 814 struct snd_seq_client *client;
800 int result; 815 int result;
801 816
802 snd_assert(cell != NULL, return -EINVAL); 817 snd_assert(cell != NULL, return -EINVAL);
@@ -812,7 +827,7 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop)
812 * the event cell is re-used as a NOTE-OFF event and 827 * the event cell is re-used as a NOTE-OFF event and
813 * enqueued again. 828 * enqueued again.
814 */ 829 */
815 snd_seq_event_t tmpev, *ev; 830 struct snd_seq_event tmpev, *ev;
816 831
817 /* reserve this event to enqueue note-off later */ 832 /* reserve this event to enqueue note-off later */
818 tmpev = cell->event; 833 tmpev = cell->event;
@@ -865,12 +880,12 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop)
865 * if pool is empty and blocking is TRUE, sleep until a new cell is 880 * if pool is empty and blocking is TRUE, sleep until a new cell is
866 * available. 881 * available.
867 */ 882 */
868static int snd_seq_client_enqueue_event(client_t *client, 883static int snd_seq_client_enqueue_event(struct snd_seq_client *client,
869 snd_seq_event_t *event, 884 struct snd_seq_event *event,
870 struct file *file, int blocking, 885 struct file *file, int blocking,
871 int atomic, int hop) 886 int atomic, int hop)
872{ 887{
873 snd_seq_event_cell_t *cell; 888 struct snd_seq_event_cell *cell;
874 int err; 889 int err;
875 890
876 /* special queue values - force direct passing */ 891 /* special queue values - force direct passing */
@@ -886,7 +901,7 @@ static int snd_seq_client_enqueue_event(client_t *client,
886#endif 901#endif
887 if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) { 902 if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) {
888 /* check presence of source port */ 903 /* check presence of source port */
889 client_port_t *src_port = snd_seq_port_use_ptr(client, event->source.port); 904 struct snd_seq_client_port *src_port = snd_seq_port_use_ptr(client, event->source.port);
890 if (src_port == NULL) 905 if (src_port == NULL)
891 return -EINVAL; 906 return -EINVAL;
892 snd_seq_port_unlock(src_port); 907 snd_seq_port_unlock(src_port);
@@ -924,7 +939,7 @@ static int snd_seq_client_enqueue_event(client_t *client,
924 * check validity of event type and data length. 939 * check validity of event type and data length.
925 * return non-zero if invalid. 940 * return non-zero if invalid.
926 */ 941 */
927static int check_event_type_and_length(snd_seq_event_t *ev) 942static int check_event_type_and_length(struct snd_seq_event *ev)
928{ 943{
929 switch (snd_seq_ev_length_type(ev)) { 944 switch (snd_seq_ev_length_type(ev)) {
930 case SNDRV_SEQ_EVENT_LENGTH_FIXED: 945 case SNDRV_SEQ_EVENT_LENGTH_FIXED:
@@ -957,12 +972,13 @@ static int check_event_type_and_length(snd_seq_event_t *ev)
957 * -EMLINK too many hops 972 * -EMLINK too many hops
958 * others depends on return value from driver callback 973 * others depends on return value from driver callback
959 */ 974 */
960static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) 975static ssize_t snd_seq_write(struct file *file, const char __user *buf,
976 size_t count, loff_t *offset)
961{ 977{
962 client_t *client = (client_t *) file->private_data; 978 struct snd_seq_client *client = file->private_data;
963 int written = 0, len; 979 int written = 0, len;
964 int err = -EINVAL; 980 int err = -EINVAL;
965 snd_seq_event_t event; 981 struct snd_seq_event event;
966 982
967 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT)) 983 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
968 return -ENXIO; 984 return -ENXIO;
@@ -980,7 +996,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
980 } 996 }
981 997
982 /* only process whole events */ 998 /* only process whole events */
983 while (count >= sizeof(snd_seq_event_t)) { 999 while (count >= sizeof(struct snd_seq_event)) {
984 /* Read in the event header from the user */ 1000 /* Read in the event header from the user */
985 len = sizeof(event); 1001 len = sizeof(event);
986 if (copy_from_user(&event, buf, len)) { 1002 if (copy_from_user(&event, buf, len)) {
@@ -1012,7 +1028,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
1012 /* set user space pointer */ 1028 /* set user space pointer */
1013 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; 1029 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
1014 event.data.ext.ptr = (char __force *)buf 1030 event.data.ext.ptr = (char __force *)buf
1015 + sizeof(snd_seq_event_t); 1031 + sizeof(struct snd_seq_event);
1016 len += extlen; /* increment data length */ 1032 len += extlen; /* increment data length */
1017 } else { 1033 } else {
1018#ifdef CONFIG_COMPAT 1034#ifdef CONFIG_COMPAT
@@ -1046,7 +1062,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
1046 */ 1062 */
1047static unsigned int snd_seq_poll(struct file *file, poll_table * wait) 1063static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
1048{ 1064{
1049 client_t *client = (client_t *) file->private_data; 1065 struct snd_seq_client *client = file->private_data;
1050 unsigned int mask = 0; 1066 unsigned int mask = 0;
1051 1067
1052 /* check client structures are in place */ 1068 /* check client structures are in place */
@@ -1076,9 +1092,9 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
1076 1092
1077 1093
1078/* SYSTEM_INFO ioctl() */ 1094/* SYSTEM_INFO ioctl() */
1079static int snd_seq_ioctl_system_info(client_t *client, void __user *arg) 1095static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void __user *arg)
1080{ 1096{
1081 snd_seq_system_info_t info; 1097 struct snd_seq_system_info info;
1082 1098
1083 memset(&info, 0, sizeof(info)); 1099 memset(&info, 0, sizeof(info));
1084 /* fill the info fields */ 1100 /* fill the info fields */
@@ -1096,10 +1112,10 @@ static int snd_seq_ioctl_system_info(client_t *client, void __user *arg)
1096 1112
1097 1113
1098/* RUNNING_MODE ioctl() */ 1114/* RUNNING_MODE ioctl() */
1099static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg) 1115static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void __user *arg)
1100{ 1116{
1101 struct sndrv_seq_running_info info; 1117 struct snd_seq_running_info info;
1102 client_t *cptr; 1118 struct snd_seq_client *cptr;
1103 int err = 0; 1119 int err = 0;
1104 1120
1105 if (copy_from_user(&info, arg, sizeof(info))) 1121 if (copy_from_user(&info, arg, sizeof(info)))
@@ -1133,7 +1149,8 @@ static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg)
1133} 1149}
1134 1150
1135/* CLIENT_INFO ioctl() */ 1151/* CLIENT_INFO ioctl() */
1136static void get_client_info(client_t *cptr, snd_seq_client_info_t *info) 1152static void get_client_info(struct snd_seq_client *cptr,
1153 struct snd_seq_client_info *info)
1137{ 1154{
1138 info->client = cptr->number; 1155 info->client = cptr->number;
1139 1156
@@ -1147,10 +1164,11 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info)
1147 memset(info->reserved, 0, sizeof(info->reserved)); 1164 memset(info->reserved, 0, sizeof(info->reserved));
1148} 1165}
1149 1166
1150static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg) 1167static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client,
1168 void __user *arg)
1151{ 1169{
1152 client_t *cptr; 1170 struct snd_seq_client *cptr;
1153 snd_seq_client_info_t client_info; 1171 struct snd_seq_client_info client_info;
1154 1172
1155 if (copy_from_user(&client_info, arg, sizeof(client_info))) 1173 if (copy_from_user(&client_info, arg, sizeof(client_info)))
1156 return -EFAULT; 1174 return -EFAULT;
@@ -1170,9 +1188,10 @@ static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg)
1170 1188
1171 1189
1172/* CLIENT_INFO ioctl() */ 1190/* CLIENT_INFO ioctl() */
1173static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg) 1191static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
1192 void __user *arg)
1174{ 1193{
1175 snd_seq_client_info_t client_info; 1194 struct snd_seq_client_info client_info;
1176 1195
1177 if (copy_from_user(&client_info, arg, sizeof(client_info))) 1196 if (copy_from_user(&client_info, arg, sizeof(client_info)))
1178 return -EFAULT; 1197 return -EFAULT;
@@ -1199,11 +1218,12 @@ static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg)
1199/* 1218/*
1200 * CREATE PORT ioctl() 1219 * CREATE PORT ioctl()
1201 */ 1220 */
1202static int snd_seq_ioctl_create_port(client_t * client, void __user *arg) 1221static int snd_seq_ioctl_create_port(struct snd_seq_client *client,
1222 void __user *arg)
1203{ 1223{
1204 client_port_t *port; 1224 struct snd_seq_client_port *port;
1205 snd_seq_port_info_t info; 1225 struct snd_seq_port_info info;
1206 snd_seq_port_callback_t *callback; 1226 struct snd_seq_port_callback *callback;
1207 1227
1208 if (copy_from_user(&info, arg, sizeof(info))) 1228 if (copy_from_user(&info, arg, sizeof(info)))
1209 return -EFAULT; 1229 return -EFAULT;
@@ -1249,9 +1269,10 @@ static int snd_seq_ioctl_create_port(client_t * client, void __user *arg)
1249/* 1269/*
1250 * DELETE PORT ioctl() 1270 * DELETE PORT ioctl()
1251 */ 1271 */
1252static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg) 1272static int snd_seq_ioctl_delete_port(struct snd_seq_client *client,
1273 void __user *arg)
1253{ 1274{
1254 snd_seq_port_info_t info; 1275 struct snd_seq_port_info info;
1255 int err; 1276 int err;
1256 1277
1257 /* set passed parameters */ 1278 /* set passed parameters */
@@ -1272,11 +1293,12 @@ static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg)
1272/* 1293/*
1273 * GET_PORT_INFO ioctl() (on any client) 1294 * GET_PORT_INFO ioctl() (on any client)
1274 */ 1295 */
1275static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg) 1296static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client,
1297 void __user *arg)
1276{ 1298{
1277 client_t *cptr; 1299 struct snd_seq_client *cptr;
1278 client_port_t *port; 1300 struct snd_seq_client_port *port;
1279 snd_seq_port_info_t info; 1301 struct snd_seq_port_info info;
1280 1302
1281 if (copy_from_user(&info, arg, sizeof(info))) 1303 if (copy_from_user(&info, arg, sizeof(info)))
1282 return -EFAULT; 1304 return -EFAULT;
@@ -1304,10 +1326,11 @@ static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg)
1304/* 1326/*
1305 * SET_PORT_INFO ioctl() (only ports on this/own client) 1327 * SET_PORT_INFO ioctl() (only ports on this/own client)
1306 */ 1328 */
1307static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg) 1329static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client,
1330 void __user *arg)
1308{ 1331{
1309 client_port_t *port; 1332 struct snd_seq_client_port *port;
1310 snd_seq_port_info_t info; 1333 struct snd_seq_port_info info;
1311 1334
1312 if (copy_from_user(&info, arg, sizeof(info))) 1335 if (copy_from_user(&info, arg, sizeof(info)))
1313 return -EFAULT; 1336 return -EFAULT;
@@ -1329,9 +1352,10 @@ static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg)
1329#define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ) 1352#define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ)
1330#define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE) 1353#define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE)
1331 1354
1332static int check_subscription_permission(client_t *client, client_port_t *sport, 1355static int check_subscription_permission(struct snd_seq_client *client,
1333 client_port_t *dport, 1356 struct snd_seq_client_port *sport,
1334 snd_seq_port_subscribe_t *subs) 1357 struct snd_seq_client_port *dport,
1358 struct snd_seq_port_subscribe *subs)
1335{ 1359{
1336 if (client->number != subs->sender.client && 1360 if (client->number != subs->sender.client &&
1337 client->number != subs->dest.client) { 1361 client->number != subs->dest.client) {
@@ -1363,9 +1387,10 @@ static int check_subscription_permission(client_t *client, client_port_t *sport,
1363 * client must be user client. 1387 * client must be user client.
1364 */ 1388 */
1365int snd_seq_client_notify_subscription(int client, int port, 1389int snd_seq_client_notify_subscription(int client, int port,
1366 snd_seq_port_subscribe_t *info, int evtype) 1390 struct snd_seq_port_subscribe *info,
1391 int evtype)
1367{ 1392{
1368 snd_seq_event_t event; 1393 struct snd_seq_event event;
1369 1394
1370 memset(&event, 0, sizeof(event)); 1395 memset(&event, 0, sizeof(event));
1371 event.type = evtype; 1396 event.type = evtype;
@@ -1379,12 +1404,13 @@ int snd_seq_client_notify_subscription(int client, int port,
1379/* 1404/*
1380 * add to port's subscription list IOCTL interface 1405 * add to port's subscription list IOCTL interface
1381 */ 1406 */
1382static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg) 1407static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client,
1408 void __user *arg)
1383{ 1409{
1384 int result = -EINVAL; 1410 int result = -EINVAL;
1385 client_t *receiver = NULL, *sender = NULL; 1411 struct snd_seq_client *receiver = NULL, *sender = NULL;
1386 client_port_t *sport = NULL, *dport = NULL; 1412 struct snd_seq_client_port *sport = NULL, *dport = NULL;
1387 snd_seq_port_subscribe_t subs; 1413 struct snd_seq_port_subscribe subs;
1388 1414
1389 if (copy_from_user(&subs, arg, sizeof(subs))) 1415 if (copy_from_user(&subs, arg, sizeof(subs)))
1390 return -EFAULT; 1416 return -EFAULT;
@@ -1423,12 +1449,13 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg)
1423/* 1449/*
1424 * remove from port's subscription list 1450 * remove from port's subscription list
1425 */ 1451 */
1426static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg) 1452static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client,
1453 void __user *arg)
1427{ 1454{
1428 int result = -ENXIO; 1455 int result = -ENXIO;
1429 client_t *receiver = NULL, *sender = NULL; 1456 struct snd_seq_client *receiver = NULL, *sender = NULL;
1430 client_port_t *sport = NULL, *dport = NULL; 1457 struct snd_seq_client_port *sport = NULL, *dport = NULL;
1431 snd_seq_port_subscribe_t subs; 1458 struct snd_seq_port_subscribe subs;
1432 1459
1433 if (copy_from_user(&subs, arg, sizeof(subs))) 1460 if (copy_from_user(&subs, arg, sizeof(subs)))
1434 return -EFAULT; 1461 return -EFAULT;
@@ -1464,11 +1491,12 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg)
1464 1491
1465 1492
1466/* CREATE_QUEUE ioctl() */ 1493/* CREATE_QUEUE ioctl() */
1467static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg) 1494static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
1495 void __user *arg)
1468{ 1496{
1469 snd_seq_queue_info_t info; 1497 struct snd_seq_queue_info info;
1470 int result; 1498 int result;
1471 queue_t *q; 1499 struct snd_seq_queue *q;
1472 1500
1473 if (copy_from_user(&info, arg, sizeof(info))) 1501 if (copy_from_user(&info, arg, sizeof(info)))
1474 return -EFAULT; 1502 return -EFAULT;
@@ -1498,9 +1526,10 @@ static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg)
1498} 1526}
1499 1527
1500/* DELETE_QUEUE ioctl() */ 1528/* DELETE_QUEUE ioctl() */
1501static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg) 1529static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client,
1530 void __user *arg)
1502{ 1531{
1503 snd_seq_queue_info_t info; 1532 struct snd_seq_queue_info info;
1504 1533
1505 if (copy_from_user(&info, arg, sizeof(info))) 1534 if (copy_from_user(&info, arg, sizeof(info)))
1506 return -EFAULT; 1535 return -EFAULT;
@@ -1509,10 +1538,11 @@ static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg)
1509} 1538}
1510 1539
1511/* GET_QUEUE_INFO ioctl() */ 1540/* GET_QUEUE_INFO ioctl() */
1512static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg) 1541static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client,
1542 void __user *arg)
1513{ 1543{
1514 snd_seq_queue_info_t info; 1544 struct snd_seq_queue_info info;
1515 queue_t *q; 1545 struct snd_seq_queue *q;
1516 1546
1517 if (copy_from_user(&info, arg, sizeof(info))) 1547 if (copy_from_user(&info, arg, sizeof(info)))
1518 return -EFAULT; 1548 return -EFAULT;
@@ -1535,10 +1565,11 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg)
1535} 1565}
1536 1566
1537/* SET_QUEUE_INFO ioctl() */ 1567/* SET_QUEUE_INFO ioctl() */
1538static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg) 1568static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client,
1569 void __user *arg)
1539{ 1570{
1540 snd_seq_queue_info_t info; 1571 struct snd_seq_queue_info info;
1541 queue_t *q; 1572 struct snd_seq_queue *q;
1542 1573
1543 if (copy_from_user(&info, arg, sizeof(info))) 1574 if (copy_from_user(&info, arg, sizeof(info)))
1544 return -EFAULT; 1575 return -EFAULT;
@@ -1570,10 +1601,10 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg)
1570} 1601}
1571 1602
1572/* GET_NAMED_QUEUE ioctl() */ 1603/* GET_NAMED_QUEUE ioctl() */
1573static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg) 1604static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, void __user *arg)
1574{ 1605{
1575 snd_seq_queue_info_t info; 1606 struct snd_seq_queue_info info;
1576 queue_t *q; 1607 struct snd_seq_queue *q;
1577 1608
1578 if (copy_from_user(&info, arg, sizeof(info))) 1609 if (copy_from_user(&info, arg, sizeof(info)))
1579 return -EFAULT; 1610 return -EFAULT;
@@ -1593,11 +1624,12 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg)
1593} 1624}
1594 1625
1595/* GET_QUEUE_STATUS ioctl() */ 1626/* GET_QUEUE_STATUS ioctl() */
1596static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg) 1627static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client,
1628 void __user *arg)
1597{ 1629{
1598 snd_seq_queue_status_t status; 1630 struct snd_seq_queue_status status;
1599 queue_t *queue; 1631 struct snd_seq_queue *queue;
1600 seq_timer_t *tmr; 1632 struct snd_seq_timer *tmr;
1601 1633
1602 if (copy_from_user(&status, arg, sizeof(status))) 1634 if (copy_from_user(&status, arg, sizeof(status)))
1603 return -EFAULT; 1635 return -EFAULT;
@@ -1626,11 +1658,12 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg)
1626 1658
1627 1659
1628/* GET_QUEUE_TEMPO ioctl() */ 1660/* GET_QUEUE_TEMPO ioctl() */
1629static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg) 1661static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client,
1662 void __user *arg)
1630{ 1663{
1631 snd_seq_queue_tempo_t tempo; 1664 struct snd_seq_queue_tempo tempo;
1632 queue_t *queue; 1665 struct snd_seq_queue *queue;
1633 seq_timer_t *tmr; 1666 struct snd_seq_timer *tmr;
1634 1667
1635 if (copy_from_user(&tempo, arg, sizeof(tempo))) 1668 if (copy_from_user(&tempo, arg, sizeof(tempo)))
1636 return -EFAULT; 1669 return -EFAULT;
@@ -1656,17 +1689,18 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg)
1656 1689
1657 1690
1658/* SET_QUEUE_TEMPO ioctl() */ 1691/* SET_QUEUE_TEMPO ioctl() */
1659int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo) 1692int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo)
1660{ 1693{
1661 if (!snd_seq_queue_check_access(tempo->queue, client)) 1694 if (!snd_seq_queue_check_access(tempo->queue, client))
1662 return -EPERM; 1695 return -EPERM;
1663 return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); 1696 return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo);
1664} 1697}
1665 1698
1666static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg) 1699static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client,
1700 void __user *arg)
1667{ 1701{
1668 int result; 1702 int result;
1669 snd_seq_queue_tempo_t tempo; 1703 struct snd_seq_queue_tempo tempo;
1670 1704
1671 if (copy_from_user(&tempo, arg, sizeof(tempo))) 1705 if (copy_from_user(&tempo, arg, sizeof(tempo)))
1672 return -EFAULT; 1706 return -EFAULT;
@@ -1677,11 +1711,12 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg)
1677 1711
1678 1712
1679/* GET_QUEUE_TIMER ioctl() */ 1713/* GET_QUEUE_TIMER ioctl() */
1680static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg) 1714static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
1715 void __user *arg)
1681{ 1716{
1682 snd_seq_queue_timer_t timer; 1717 struct snd_seq_queue_timer timer;
1683 queue_t *queue; 1718 struct snd_seq_queue *queue;
1684 seq_timer_t *tmr; 1719 struct snd_seq_timer *tmr;
1685 1720
1686 if (copy_from_user(&timer, arg, sizeof(timer))) 1721 if (copy_from_user(&timer, arg, sizeof(timer)))
1687 return -EFAULT; 1722 return -EFAULT;
@@ -1713,10 +1748,11 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg)
1713 1748
1714 1749
1715/* SET_QUEUE_TIMER ioctl() */ 1750/* SET_QUEUE_TIMER ioctl() */
1716static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) 1751static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
1752 void __user *arg)
1717{ 1753{
1718 int result = 0; 1754 int result = 0;
1719 snd_seq_queue_timer_t timer; 1755 struct snd_seq_queue_timer timer;
1720 1756
1721 if (copy_from_user(&timer, arg, sizeof(timer))) 1757 if (copy_from_user(&timer, arg, sizeof(timer)))
1722 return -EFAULT; 1758 return -EFAULT;
@@ -1725,8 +1761,8 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg)
1725 return -EINVAL; 1761 return -EINVAL;
1726 1762
1727 if (snd_seq_queue_check_access(timer.queue, client->number)) { 1763 if (snd_seq_queue_check_access(timer.queue, client->number)) {
1728 queue_t *q; 1764 struct snd_seq_queue *q;
1729 seq_timer_t *tmr; 1765 struct snd_seq_timer *tmr;
1730 1766
1731 q = queueptr(timer.queue); 1767 q = queueptr(timer.queue);
1732 if (q == NULL) 1768 if (q == NULL)
@@ -1754,9 +1790,10 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg)
1754 1790
1755 1791
1756/* GET_QUEUE_CLIENT ioctl() */ 1792/* GET_QUEUE_CLIENT ioctl() */
1757static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg) 1793static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client,
1794 void __user *arg)
1758{ 1795{
1759 snd_seq_queue_client_t info; 1796 struct snd_seq_queue_client info;
1760 int used; 1797 int used;
1761 1798
1762 if (copy_from_user(&info, arg, sizeof(info))) 1799 if (copy_from_user(&info, arg, sizeof(info)))
@@ -1775,10 +1812,11 @@ static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg)
1775 1812
1776 1813
1777/* SET_QUEUE_CLIENT ioctl() */ 1814/* SET_QUEUE_CLIENT ioctl() */
1778static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg) 1815static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client,
1816 void __user *arg)
1779{ 1817{
1780 int err; 1818 int err;
1781 snd_seq_queue_client_t info; 1819 struct snd_seq_queue_client info;
1782 1820
1783 if (copy_from_user(&info, arg, sizeof(info))) 1821 if (copy_from_user(&info, arg, sizeof(info)))
1784 return -EFAULT; 1822 return -EFAULT;
@@ -1794,10 +1832,11 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg)
1794 1832
1795 1833
1796/* GET_CLIENT_POOL ioctl() */ 1834/* GET_CLIENT_POOL ioctl() */
1797static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg) 1835static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client,
1836 void __user *arg)
1798{ 1837{
1799 snd_seq_client_pool_t info; 1838 struct snd_seq_client_pool info;
1800 client_t *cptr; 1839 struct snd_seq_client *cptr;
1801 1840
1802 if (copy_from_user(&info, arg, sizeof(info))) 1841 if (copy_from_user(&info, arg, sizeof(info)))
1803 return -EFAULT; 1842 return -EFAULT;
@@ -1828,9 +1867,10 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg)
1828} 1867}
1829 1868
1830/* SET_CLIENT_POOL ioctl() */ 1869/* SET_CLIENT_POOL ioctl() */
1831static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg) 1870static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
1871 void __user *arg)
1832{ 1872{
1833 snd_seq_client_pool_t info; 1873 struct snd_seq_client_pool info;
1834 int rc; 1874 int rc;
1835 1875
1836 if (copy_from_user(&info, arg, sizeof(info))) 1876 if (copy_from_user(&info, arg, sizeof(info)))
@@ -1872,9 +1912,10 @@ static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg)
1872 1912
1873 1913
1874/* REMOVE_EVENTS ioctl() */ 1914/* REMOVE_EVENTS ioctl() */
1875static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg) 1915static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
1916 void __user *arg)
1876{ 1917{
1877 snd_seq_remove_events_t info; 1918 struct snd_seq_remove_events info;
1878 1919
1879 if (copy_from_user(&info, arg, sizeof(info))) 1920 if (copy_from_user(&info, arg, sizeof(info)))
1880 return -EFAULT; 1921 return -EFAULT;
@@ -1901,13 +1942,14 @@ static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg)
1901/* 1942/*
1902 * get subscription info 1943 * get subscription info
1903 */ 1944 */
1904static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg) 1945static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
1946 void __user *arg)
1905{ 1947{
1906 int result; 1948 int result;
1907 client_t *sender = NULL; 1949 struct snd_seq_client *sender = NULL;
1908 client_port_t *sport = NULL; 1950 struct snd_seq_client_port *sport = NULL;
1909 snd_seq_port_subscribe_t subs; 1951 struct snd_seq_port_subscribe subs;
1910 subscribers_t *p; 1952 struct snd_seq_subscribers *p;
1911 1953
1912 if (copy_from_user(&subs, arg, sizeof(subs))) 1954 if (copy_from_user(&subs, arg, sizeof(subs)))
1913 return -EFAULT; 1955 return -EFAULT;
@@ -1940,13 +1982,14 @@ static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg)
1940/* 1982/*
1941 * get subscription info - check only its presence 1983 * get subscription info - check only its presence
1942 */ 1984 */
1943static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) 1985static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
1986 void __user *arg)
1944{ 1987{
1945 int result = -ENXIO; 1988 int result = -ENXIO;
1946 client_t *cptr = NULL; 1989 struct snd_seq_client *cptr = NULL;
1947 client_port_t *port = NULL; 1990 struct snd_seq_client_port *port = NULL;
1948 snd_seq_query_subs_t subs; 1991 struct snd_seq_query_subs subs;
1949 port_subs_info_t *group; 1992 struct snd_seq_port_subs_info *group;
1950 struct list_head *p; 1993 struct list_head *p;
1951 int i; 1994 int i;
1952 1995
@@ -1977,12 +2020,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg)
1977 list_for_each(p, &group->list_head) { 2020 list_for_each(p, &group->list_head) {
1978 if (i++ == subs.index) { 2021 if (i++ == subs.index) {
1979 /* found! */ 2022 /* found! */
1980 subscribers_t *s; 2023 struct snd_seq_subscribers *s;
1981 if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) { 2024 if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) {
1982 s = list_entry(p, subscribers_t, src_list); 2025 s = list_entry(p, struct snd_seq_subscribers, src_list);
1983 subs.addr = s->info.dest; 2026 subs.addr = s->info.dest;
1984 } else { 2027 } else {
1985 s = list_entry(p, subscribers_t, dest_list); 2028 s = list_entry(p, struct snd_seq_subscribers, dest_list);
1986 subs.addr = s->info.sender; 2029 subs.addr = s->info.sender;
1987 } 2030 }
1988 subs.flags = s->info.flags; 2031 subs.flags = s->info.flags;
@@ -2009,10 +2052,11 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg)
2009/* 2052/*
2010 * query next client 2053 * query next client
2011 */ 2054 */
2012static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg) 2055static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
2056 void __user *arg)
2013{ 2057{
2014 client_t *cptr = NULL; 2058 struct snd_seq_client *cptr = NULL;
2015 snd_seq_client_info_t info; 2059 struct snd_seq_client_info info;
2016 2060
2017 if (copy_from_user(&info, arg, sizeof(info))) 2061 if (copy_from_user(&info, arg, sizeof(info)))
2018 return -EFAULT; 2062 return -EFAULT;
@@ -2040,11 +2084,12 @@ static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg)
2040/* 2084/*
2041 * query next port 2085 * query next port
2042 */ 2086 */
2043static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg) 2087static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client,
2088 void __user *arg)
2044{ 2089{
2045 client_t *cptr; 2090 struct snd_seq_client *cptr;
2046 client_port_t *port = NULL; 2091 struct snd_seq_client_port *port = NULL;
2047 snd_seq_port_info_t info; 2092 struct snd_seq_port_info info;
2048 2093
2049 if (copy_from_user(&info, arg, sizeof(info))) 2094 if (copy_from_user(&info, arg, sizeof(info)))
2050 return -EFAULT; 2095 return -EFAULT;
@@ -2075,7 +2120,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg)
2075 2120
2076static struct seq_ioctl_table { 2121static struct seq_ioctl_table {
2077 unsigned int cmd; 2122 unsigned int cmd;
2078 int (*func)(client_t *client, void __user * arg); 2123 int (*func)(struct snd_seq_client *client, void __user * arg);
2079} ioctl_tables[] = { 2124} ioctl_tables[] = {
2080 { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info }, 2125 { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info },
2081 { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode }, 2126 { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode },
@@ -2109,7 +2154,8 @@ static struct seq_ioctl_table {
2109 { 0, NULL }, 2154 { 0, NULL },
2110}; 2155};
2111 2156
2112static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg) 2157static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd,
2158 void __user *arg)
2113{ 2159{
2114 struct seq_ioctl_table *p; 2160 struct seq_ioctl_table *p;
2115 2161
@@ -2136,7 +2182,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg
2136 2182
2137static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2183static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2138{ 2184{
2139 client_t *client = (client_t *) file->private_data; 2185 struct snd_seq_client *client = file->private_data;
2140 2186
2141 snd_assert(client != NULL, return -ENXIO); 2187 snd_assert(client != NULL, return -ENXIO);
2142 2188
@@ -2153,9 +2199,10 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg
2153 2199
2154 2200
2155/* exported to kernel modules */ 2201/* exported to kernel modules */
2156int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t * callback) 2202int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
2203 struct snd_seq_client_callback *callback)
2157{ 2204{
2158 client_t *client; 2205 struct snd_seq_client *client;
2159 2206
2160 snd_assert(! in_interrupt(), return -EBUSY); 2207 snd_assert(! in_interrupt(), return -EBUSY);
2161 2208
@@ -2199,7 +2246,7 @@ int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_cli
2199/* exported to kernel modules */ 2246/* exported to kernel modules */
2200int snd_seq_delete_kernel_client(int client) 2247int snd_seq_delete_kernel_client(int client)
2201{ 2248{
2202 client_t *ptr; 2249 struct snd_seq_client *ptr;
2203 2250
2204 snd_assert(! in_interrupt(), return -EBUSY); 2251 snd_assert(! in_interrupt(), return -EBUSY);
2205 2252
@@ -2216,11 +2263,11 @@ int snd_seq_delete_kernel_client(int client)
2216/* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue 2263/* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue
2217 * and snd_seq_kernel_client_enqueue_blocking 2264 * and snd_seq_kernel_client_enqueue_blocking
2218 */ 2265 */
2219static int kernel_client_enqueue(int client, snd_seq_event_t *ev, 2266static int kernel_client_enqueue(int client, struct snd_seq_event *ev,
2220 struct file *file, int blocking, 2267 struct file *file, int blocking,
2221 int atomic, int hop) 2268 int atomic, int hop)
2222{ 2269{
2223 client_t *cptr; 2270 struct snd_seq_client *cptr;
2224 int result; 2271 int result;
2225 2272
2226 snd_assert(ev != NULL, return -EINVAL); 2273 snd_assert(ev != NULL, return -EINVAL);
@@ -2254,7 +2301,7 @@ static int kernel_client_enqueue(int client, snd_seq_event_t *ev,
2254 * 2301 *
2255 * RETURN VALUE: zero if succeed, negative if error 2302 * RETURN VALUE: zero if succeed, negative if error
2256 */ 2303 */
2257int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev, 2304int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event * ev,
2258 int atomic, int hop) 2305 int atomic, int hop)
2259{ 2306{
2260 return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop); 2307 return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop);
@@ -2265,7 +2312,7 @@ int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev,
2265 * 2312 *
2266 * RETURN VALUE: zero if succeed, negative if error 2313 * RETURN VALUE: zero if succeed, negative if error
2267 */ 2314 */
2268int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, 2315int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
2269 struct file *file, 2316 struct file *file,
2270 int atomic, int hop) 2317 int atomic, int hop)
2271{ 2318{
@@ -2280,10 +2327,10 @@ int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev,
2280 * RETURN VALUE: negative = delivery failed, 2327 * RETURN VALUE: negative = delivery failed,
2281 * zero, or positive: the number of delivered events 2328 * zero, or positive: the number of delivered events
2282 */ 2329 */
2283int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, 2330int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev,
2284 int atomic, int hop) 2331 int atomic, int hop)
2285{ 2332{
2286 client_t *cptr; 2333 struct snd_seq_client *cptr;
2287 int result; 2334 int result;
2288 2335
2289 snd_assert(ev != NULL, return -EINVAL); 2336 snd_assert(ev != NULL, return -EINVAL);
@@ -2315,7 +2362,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev,
2315 */ 2362 */
2316int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) 2363int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
2317{ 2364{
2318 client_t *client; 2365 struct snd_seq_client *client;
2319 mm_segment_t fs; 2366 mm_segment_t fs;
2320 int result; 2367 int result;
2321 2368
@@ -2332,7 +2379,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
2332/* exported (for OSS emulator) */ 2379/* exported (for OSS emulator) */
2333int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait) 2380int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait)
2334{ 2381{
2335 client_t *client; 2382 struct snd_seq_client *client;
2336 2383
2337 client = clientptr(clientid); 2384 client = clientptr(clientid);
2338 if (client == NULL) 2385 if (client == NULL)
@@ -2350,10 +2397,12 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table
2350/* 2397/*
2351 * /proc interface 2398 * /proc interface
2352 */ 2399 */
2353static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_info_t *group, int is_src, char *msg) 2400static void snd_seq_info_dump_subscribers(struct snd_info_buffer *buffer,
2401 struct snd_seq_port_subs_info *group,
2402 int is_src, char *msg)
2354{ 2403{
2355 struct list_head *p; 2404 struct list_head *p;
2356 subscribers_t *s; 2405 struct snd_seq_subscribers *s;
2357 int count = 0; 2406 int count = 0;
2358 2407
2359 down_read(&group->list_mutex); 2408 down_read(&group->list_mutex);
@@ -2364,9 +2413,9 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i
2364 snd_iprintf(buffer, msg); 2413 snd_iprintf(buffer, msg);
2365 list_for_each(p, &group->list_head) { 2414 list_for_each(p, &group->list_head) {
2366 if (is_src) 2415 if (is_src)
2367 s = list_entry(p, subscribers_t, src_list); 2416 s = list_entry(p, struct snd_seq_subscribers, src_list);
2368 else 2417 else
2369 s = list_entry(p, subscribers_t, dest_list); 2418 s = list_entry(p, struct snd_seq_subscribers, dest_list);
2370 if (count++) 2419 if (count++)
2371 snd_iprintf(buffer, ", "); 2420 snd_iprintf(buffer, ", ");
2372 snd_iprintf(buffer, "%d:%d", 2421 snd_iprintf(buffer, "%d:%d",
@@ -2387,13 +2436,14 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i
2387 2436
2388#define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-') 2437#define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-')
2389 2438
2390static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client) 2439static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
2440 struct snd_seq_client *client)
2391{ 2441{
2392 struct list_head *l; 2442 struct list_head *l;
2393 2443
2394 down(&client->ports_mutex); 2444 down(&client->ports_mutex);
2395 list_for_each(l, &client->ports_list_head) { 2445 list_for_each(l, &client->ports_list_head) {
2396 client_port_t *p = list_entry(l, client_port_t, list); 2446 struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
2397 snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", 2447 snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n",
2398 p->addr.port, p->name, 2448 p->addr.port, p->name,
2399 FLAG_PERM_RD(p->capability), 2449 FLAG_PERM_RD(p->capability),
@@ -2407,13 +2457,15 @@ static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client)
2407} 2457}
2408 2458
2409 2459
2460void snd_seq_info_pool(struct snd_info_buffer *buffer,
2461 struct snd_seq_pool *pool, char *space);
2462
2410/* exported to seq_info.c */ 2463/* exported to seq_info.c */
2411void snd_seq_info_clients_read(snd_info_entry_t *entry, 2464void snd_seq_info_clients_read(struct snd_info_entry *entry,
2412 snd_info_buffer_t * buffer) 2465 struct snd_info_buffer *buffer)
2413{ 2466{
2414 extern void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t * pool, char *space);
2415 int c; 2467 int c;
2416 client_t *client; 2468 struct snd_seq_client *client;
2417 2469
2418 snd_iprintf(buffer, "Client info\n"); 2470 snd_iprintf(buffer, "Client info\n");
2419 snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur); 2471 snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur);
@@ -2468,7 +2520,7 @@ static struct file_operations snd_seq_f_ops =
2468 .compat_ioctl = snd_seq_ioctl_compat, 2520 .compat_ioctl = snd_seq_ioctl_compat,
2469}; 2521};
2470 2522
2471static snd_minor_t snd_seq_reg = 2523static struct snd_minor snd_seq_reg =
2472{ 2524{
2473 .comment = "sequencer", 2525 .comment = "sequencer",
2474 .f_ops = &snd_seq_f_ops, 2526 .f_ops = &snd_seq_f_ops,
diff --git a/sound/core/seq/seq_clientmgr.h b/sound/core/seq/seq_clientmgr.h
index 3715c36183d3..9df562425e3c 100644
--- a/sound/core/seq/seq_clientmgr.h
+++ b/sound/core/seq/seq_clientmgr.h
@@ -30,24 +30,24 @@
30 30
31/* client manager */ 31/* client manager */
32 32
33struct _snd_seq_user_client { 33struct snd_seq_user_client {
34 struct file *file; /* file struct of client */ 34 struct file *file; /* file struct of client */
35 /* ... */ 35 /* ... */
36 36
37 /* fifo */ 37 /* fifo */
38 fifo_t *fifo; /* queue for incoming events */ 38 struct snd_seq_fifo *fifo; /* queue for incoming events */
39 int fifo_pool_size; 39 int fifo_pool_size;
40}; 40};
41 41
42struct _snd_seq_kernel_client { 42struct snd_seq_kernel_client {
43 snd_card_t *card; 43 struct snd_card *card;
44 /* pointer to client functions */ 44 /* pointer to client functions */
45 void *private_data; /* private data for client */ 45 void *private_data; /* private data for client */
46 /* ... */ 46 /* ... */
47}; 47};
48 48
49 49
50struct _snd_seq_client { 50struct snd_seq_client {
51 snd_seq_client_type_t type; 51 snd_seq_client_type_t type;
52 unsigned int accept_input: 1, 52 unsigned int accept_input: 1,
53 accept_output: 1; 53 accept_output: 1;
@@ -65,40 +65,42 @@ struct _snd_seq_client {
65 int convert32; /* convert 32->64bit */ 65 int convert32; /* convert 32->64bit */
66 66
67 /* output pool */ 67 /* output pool */
68 pool_t *pool; /* memory pool for this client */ 68 struct snd_seq_pool *pool; /* memory pool for this client */
69 69
70 union { 70 union {
71 user_client_t user; 71 struct snd_seq_user_client user;
72 kernel_client_t kernel; 72 struct snd_seq_kernel_client kernel;
73 } data; 73 } data;
74}; 74};
75 75
76/* usage statistics */ 76/* usage statistics */
77typedef struct { 77struct snd_seq_usage {
78 int cur; 78 int cur;
79 int peak; 79 int peak;
80} usage_t; 80};
81 81
82 82
83extern int client_init_data(void); 83int client_init_data(void);
84extern int snd_sequencer_device_init(void); 84int snd_sequencer_device_init(void);
85extern void snd_sequencer_device_done(void); 85void snd_sequencer_device_done(void);
86 86
87/* get locked pointer to client */ 87/* get locked pointer to client */
88extern client_t *snd_seq_client_use_ptr(int clientid); 88struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
89 89
90/* unlock pointer to client */ 90/* unlock pointer to client */
91#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock) 91#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
92 92
93/* dispatch event to client(s) */ 93/* dispatch event to client(s) */
94extern int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop); 94int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
95 95
96/* exported to other modules */ 96/* exported to other modules */
97extern int snd_seq_register_kernel_client(snd_seq_client_callback_t *callback, void *private_data); 97int snd_seq_register_kernel_client(struct snd_seq_client_callback *callback, void *private_data);
98extern int snd_seq_unregister_kernel_client(int client); 98int snd_seq_unregister_kernel_client(int client);
99extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); 99int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
100int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, struct file *file, int atomic, int hop); 100int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
101 struct file *file, int atomic, int hop);
101int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait); 102int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
102int snd_seq_client_notify_subscription(int client, int port, snd_seq_port_subscribe_t *info, int evtype); 103int snd_seq_client_notify_subscription(int client, int port,
104 struct snd_seq_port_subscribe *info, int evtype);
103 105
104#endif 106#endif
diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c
index 902ad8b0c355..9628c06e4eab 100644
--- a/sound/core/seq/seq_compat.c
+++ b/sound/core/seq/seq_compat.c
@@ -22,8 +22,8 @@
22 22
23#include <linux/compat.h> 23#include <linux/compat.h>
24 24
25struct sndrv_seq_port_info32 { 25struct snd_seq_port_info32 {
26 struct sndrv_seq_addr addr; /* client/port numbers */ 26 struct snd_seq_addr addr; /* client/port numbers */
27 char name[64]; /* port name */ 27 char name[64]; /* port name */
28 28
29 u32 capability; /* port capability bits */ 29 u32 capability; /* port capability bits */
@@ -41,11 +41,11 @@ struct sndrv_seq_port_info32 {
41 char reserved[59]; /* for future use */ 41 char reserved[59]; /* for future use */
42}; 42};
43 43
44static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd, 44static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned int cmd,
45 struct sndrv_seq_port_info32 __user *data32) 45 struct snd_seq_port_info32 __user *data32)
46{ 46{
47 int err = -EFAULT; 47 int err = -EFAULT;
48 snd_seq_port_info_t *data; 48 struct snd_seq_port_info *data;
49 mm_segment_t fs; 49 mm_segment_t fs;
50 50
51 data = kmalloc(sizeof(*data), GFP_KERNEL); 51 data = kmalloc(sizeof(*data), GFP_KERNEL);
@@ -80,16 +80,16 @@ static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd,
80 */ 80 */
81 81
82enum { 82enum {
83 SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct sndrv_seq_port_info32), 83 SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct snd_seq_port_info32),
84 SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct sndrv_seq_port_info32), 84 SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct snd_seq_port_info32),
85 SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct sndrv_seq_port_info32), 85 SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct snd_seq_port_info32),
86 SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct sndrv_seq_port_info32), 86 SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct snd_seq_port_info32),
87 SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct sndrv_seq_port_info32), 87 SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct snd_seq_port_info32),
88}; 88};
89 89
90static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) 90static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
91{ 91{
92 client_t *client = (client_t *) file->private_data; 92 struct snd_seq_client *client = file->private_data;
93 void __user *argp = compat_ptr(arg); 93 void __user *argp = compat_ptr(arg);
94 94
95 snd_assert(client != NULL, return -ENXIO); 95 snd_assert(client != NULL, return -ENXIO);
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 252b52731003..3f935a18b5e7 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -50,11 +50,6 @@ MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
50MODULE_DESCRIPTION("ALSA sequencer device management"); 50MODULE_DESCRIPTION("ALSA sequencer device management");
51MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
52 52
53/*
54 * driver list
55 */
56typedef struct ops_list ops_list_t;
57
58/* driver state */ 53/* driver state */
59#define DRIVER_EMPTY 0 54#define DRIVER_EMPTY 0
60#define DRIVER_LOADED (1<<0) 55#define DRIVER_LOADED (1<<0)
@@ -68,7 +63,7 @@ struct ops_list {
68 int argsize; /* argument size */ 63 int argsize; /* argument size */
69 64
70 /* operators */ 65 /* operators */
71 snd_seq_dev_ops_t ops; 66 struct snd_seq_dev_ops ops;
72 67
73 /* registred devices */ 68 /* registred devices */
74 struct list_head dev_list; /* list of devices */ 69 struct list_head dev_list; /* list of devices */
@@ -83,35 +78,36 @@ struct ops_list {
83static LIST_HEAD(opslist); 78static LIST_HEAD(opslist);
84static int num_ops; 79static int num_ops;
85static DECLARE_MUTEX(ops_mutex); 80static DECLARE_MUTEX(ops_mutex);
86static snd_info_entry_t *info_entry = NULL; 81static struct snd_info_entry *info_entry = NULL;
87 82
88/* 83/*
89 * prototypes 84 * prototypes
90 */ 85 */
91static int snd_seq_device_free(snd_seq_device_t *dev); 86static int snd_seq_device_free(struct snd_seq_device *dev);
92static int snd_seq_device_dev_free(snd_device_t *device); 87static int snd_seq_device_dev_free(struct snd_device *device);
93static int snd_seq_device_dev_register(snd_device_t *device); 88static int snd_seq_device_dev_register(struct snd_device *device);
94static int snd_seq_device_dev_disconnect(snd_device_t *device); 89static int snd_seq_device_dev_disconnect(struct snd_device *device);
95static int snd_seq_device_dev_unregister(snd_device_t *device); 90static int snd_seq_device_dev_unregister(struct snd_device *device);
96 91
97static int init_device(snd_seq_device_t *dev, ops_list_t *ops); 92static int init_device(struct snd_seq_device *dev, struct ops_list *ops);
98static int free_device(snd_seq_device_t *dev, ops_list_t *ops); 93static int free_device(struct snd_seq_device *dev, struct ops_list *ops);
99static ops_list_t *find_driver(char *id, int create_if_empty); 94static struct ops_list *find_driver(char *id, int create_if_empty);
100static ops_list_t *create_driver(char *id); 95static struct ops_list *create_driver(char *id);
101static void unlock_driver(ops_list_t *ops); 96static void unlock_driver(struct ops_list *ops);
102static void remove_drivers(void); 97static void remove_drivers(void);
103 98
104/* 99/*
105 * show all drivers and their status 100 * show all drivers and their status
106 */ 101 */
107 102
108static void snd_seq_device_info(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 103static void snd_seq_device_info(struct snd_info_entry *entry,
104 struct snd_info_buffer *buffer)
109{ 105{
110 struct list_head *head; 106 struct list_head *head;
111 107
112 down(&ops_mutex); 108 down(&ops_mutex);
113 list_for_each(head, &opslist) { 109 list_for_each(head, &opslist) {
114 ops_list_t *ops = list_entry(head, ops_list_t, list); 110 struct ops_list *ops = list_entry(head, struct ops_list, list);
115 snd_iprintf(buffer, "snd-%s%s%s%s,%d\n", 111 snd_iprintf(buffer, "snd-%s%s%s%s,%d\n",
116 ops->id, 112 ops->id,
117 ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""), 113 ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""),
@@ -156,7 +152,7 @@ void snd_seq_device_load_drivers(void)
156 152
157 down(&ops_mutex); 153 down(&ops_mutex);
158 list_for_each(head, &opslist) { 154 list_for_each(head, &opslist) {
159 ops_list_t *ops = list_entry(head, ops_list_t, list); 155 struct ops_list *ops = list_entry(head, struct ops_list, list);
160 if (! (ops->driver & DRIVER_LOADED) && 156 if (! (ops->driver & DRIVER_LOADED) &&
161 ! (ops->driver & DRIVER_REQUESTED)) { 157 ! (ops->driver & DRIVER_REQUESTED)) {
162 ops->used++; 158 ops->used++;
@@ -178,13 +174,13 @@ void snd_seq_device_load_drivers(void)
178 * id = id of driver 174 * id = id of driver
179 * result = return pointer (NULL allowed if unnecessary) 175 * result = return pointer (NULL allowed if unnecessary)
180 */ 176 */
181int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, 177int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize,
182 snd_seq_device_t **result) 178 struct snd_seq_device **result)
183{ 179{
184 snd_seq_device_t *dev; 180 struct snd_seq_device *dev;
185 ops_list_t *ops; 181 struct ops_list *ops;
186 int err; 182 int err;
187 static snd_device_ops_t dops = { 183 static struct snd_device_ops dops = {
188 .dev_free = snd_seq_device_dev_free, 184 .dev_free = snd_seq_device_dev_free,
189 .dev_register = snd_seq_device_dev_register, 185 .dev_register = snd_seq_device_dev_register,
190 .dev_disconnect = snd_seq_device_dev_disconnect, 186 .dev_disconnect = snd_seq_device_dev_disconnect,
@@ -235,9 +231,9 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize,
235/* 231/*
236 * free the existing device 232 * free the existing device
237 */ 233 */
238static int snd_seq_device_free(snd_seq_device_t *dev) 234static int snd_seq_device_free(struct snd_seq_device *dev)
239{ 235{
240 ops_list_t *ops; 236 struct ops_list *ops;
241 237
242 snd_assert(dev != NULL, return -EINVAL); 238 snd_assert(dev != NULL, return -EINVAL);
243 239
@@ -261,19 +257,19 @@ static int snd_seq_device_free(snd_seq_device_t *dev)
261 return 0; 257 return 0;
262} 258}
263 259
264static int snd_seq_device_dev_free(snd_device_t *device) 260static int snd_seq_device_dev_free(struct snd_device *device)
265{ 261{
266 snd_seq_device_t *dev = device->device_data; 262 struct snd_seq_device *dev = device->device_data;
267 return snd_seq_device_free(dev); 263 return snd_seq_device_free(dev);
268} 264}
269 265
270/* 266/*
271 * register the device 267 * register the device
272 */ 268 */
273static int snd_seq_device_dev_register(snd_device_t *device) 269static int snd_seq_device_dev_register(struct snd_device *device)
274{ 270{
275 snd_seq_device_t *dev = device->device_data; 271 struct snd_seq_device *dev = device->device_data;
276 ops_list_t *ops; 272 struct ops_list *ops;
277 273
278 ops = find_driver(dev->id, 0); 274 ops = find_driver(dev->id, 0);
279 if (ops == NULL) 275 if (ops == NULL)
@@ -292,10 +288,10 @@ static int snd_seq_device_dev_register(snd_device_t *device)
292/* 288/*
293 * disconnect the device 289 * disconnect the device
294 */ 290 */
295static int snd_seq_device_dev_disconnect(snd_device_t *device) 291static int snd_seq_device_dev_disconnect(struct snd_device *device)
296{ 292{
297 snd_seq_device_t *dev = device->device_data; 293 struct snd_seq_device *dev = device->device_data;
298 ops_list_t *ops; 294 struct ops_list *ops;
299 295
300 ops = find_driver(dev->id, 0); 296 ops = find_driver(dev->id, 0);
301 if (ops == NULL) 297 if (ops == NULL)
@@ -310,9 +306,9 @@ static int snd_seq_device_dev_disconnect(snd_device_t *device)
310/* 306/*
311 * unregister the existing device 307 * unregister the existing device
312 */ 308 */
313static int snd_seq_device_dev_unregister(snd_device_t *device) 309static int snd_seq_device_dev_unregister(struct snd_device *device)
314{ 310{
315 snd_seq_device_t *dev = device->device_data; 311 struct snd_seq_device *dev = device->device_data;
316 return snd_seq_device_free(dev); 312 return snd_seq_device_free(dev);
317} 313}
318 314
@@ -321,10 +317,11 @@ static int snd_seq_device_dev_unregister(snd_device_t *device)
321 * id = driver id 317 * id = driver id
322 * entry = driver operators - duplicated to each instance 318 * entry = driver operators - duplicated to each instance
323 */ 319 */
324int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize) 320int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,
321 int argsize)
325{ 322{
326 struct list_head *head; 323 struct list_head *head;
327 ops_list_t *ops; 324 struct ops_list *ops;
328 325
329 if (id == NULL || entry == NULL || 326 if (id == NULL || entry == NULL ||
330 entry->init_device == NULL || entry->free_device == NULL) 327 entry->init_device == NULL || entry->free_device == NULL)
@@ -351,7 +348,7 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi
351 348
352 /* initialize existing devices if necessary */ 349 /* initialize existing devices if necessary */
353 list_for_each(head, &ops->dev_list) { 350 list_for_each(head, &ops->dev_list) {
354 snd_seq_device_t *dev = list_entry(head, snd_seq_device_t, list); 351 struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
355 init_device(dev, ops); 352 init_device(dev, ops);
356 } 353 }
357 up(&ops->reg_mutex); 354 up(&ops->reg_mutex);
@@ -366,9 +363,9 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi
366/* 363/*
367 * create driver record 364 * create driver record
368 */ 365 */
369static ops_list_t * create_driver(char *id) 366static struct ops_list * create_driver(char *id)
370{ 367{
371 ops_list_t *ops; 368 struct ops_list *ops;
372 369
373 ops = kmalloc(sizeof(*ops), GFP_KERNEL); 370 ops = kmalloc(sizeof(*ops), GFP_KERNEL);
374 if (ops == NULL) 371 if (ops == NULL)
@@ -399,14 +396,15 @@ static ops_list_t * create_driver(char *id)
399int snd_seq_device_unregister_driver(char *id) 396int snd_seq_device_unregister_driver(char *id)
400{ 397{
401 struct list_head *head; 398 struct list_head *head;
402 ops_list_t *ops; 399 struct ops_list *ops;
403 400
404 ops = find_driver(id, 0); 401 ops = find_driver(id, 0);
405 if (ops == NULL) 402 if (ops == NULL)
406 return -ENXIO; 403 return -ENXIO;
407 if (! (ops->driver & DRIVER_LOADED) || 404 if (! (ops->driver & DRIVER_LOADED) ||
408 (ops->driver & DRIVER_LOCKED)) { 405 (ops->driver & DRIVER_LOCKED)) {
409 snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", id, ops->driver); 406 snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n",
407 id, ops->driver);
410 unlock_driver(ops); 408 unlock_driver(ops);
411 return -EBUSY; 409 return -EBUSY;
412 } 410 }
@@ -415,13 +413,14 @@ int snd_seq_device_unregister_driver(char *id)
415 down(&ops->reg_mutex); 413 down(&ops->reg_mutex);
416 ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */ 414 ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */
417 list_for_each(head, &ops->dev_list) { 415 list_for_each(head, &ops->dev_list) {
418 snd_seq_device_t *dev = list_entry(head, snd_seq_device_t, list); 416 struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
419 free_device(dev, ops); 417 free_device(dev, ops);
420 } 418 }
421 419
422 ops->driver = 0; 420 ops->driver = 0;
423 if (ops->num_init_devices > 0) 421 if (ops->num_init_devices > 0)
424 snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", ops->num_init_devices); 422 snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n",
423 ops->num_init_devices);
425 up(&ops->reg_mutex); 424 up(&ops->reg_mutex);
426 425
427 unlock_driver(ops); 426 unlock_driver(ops);
@@ -443,7 +442,7 @@ static void remove_drivers(void)
443 down(&ops_mutex); 442 down(&ops_mutex);
444 head = opslist.next; 443 head = opslist.next;
445 while (head != &opslist) { 444 while (head != &opslist) {
446 ops_list_t *ops = list_entry(head, ops_list_t, list); 445 struct ops_list *ops = list_entry(head, struct ops_list, list);
447 if (! (ops->driver & DRIVER_LOADED) && 446 if (! (ops->driver & DRIVER_LOADED) &&
448 ops->used == 0 && ops->num_devices == 0) { 447 ops->used == 0 && ops->num_devices == 0) {
449 head = head->next; 448 head = head->next;
@@ -459,21 +458,23 @@ static void remove_drivers(void)
459/* 458/*
460 * initialize the device - call init_device operator 459 * initialize the device - call init_device operator
461 */ 460 */
462static int init_device(snd_seq_device_t *dev, ops_list_t *ops) 461static int init_device(struct snd_seq_device *dev, struct ops_list *ops)
463{ 462{
464 if (! (ops->driver & DRIVER_LOADED)) 463 if (! (ops->driver & DRIVER_LOADED))
465 return 0; /* driver is not loaded yet */ 464 return 0; /* driver is not loaded yet */
466 if (dev->status != SNDRV_SEQ_DEVICE_FREE) 465 if (dev->status != SNDRV_SEQ_DEVICE_FREE)
467 return 0; /* already initialized */ 466 return 0; /* already initialized */
468 if (ops->argsize != dev->argsize) { 467 if (ops->argsize != dev->argsize) {
469 snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); 468 snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n",
469 dev->name, ops->id, ops->argsize, dev->argsize);
470 return -EINVAL; 470 return -EINVAL;
471 } 471 }
472 if (ops->ops.init_device(dev) >= 0) { 472 if (ops->ops.init_device(dev) >= 0) {
473 dev->status = SNDRV_SEQ_DEVICE_REGISTERED; 473 dev->status = SNDRV_SEQ_DEVICE_REGISTERED;
474 ops->num_init_devices++; 474 ops->num_init_devices++;
475 } else { 475 } else {
476 snd_printk(KERN_ERR "init_device failed: %s: %s\n", dev->name, dev->id); 476 snd_printk(KERN_ERR "init_device failed: %s: %s\n",
477 dev->name, dev->id);
477 } 478 }
478 479
479 return 0; 480 return 0;
@@ -482,7 +483,7 @@ static int init_device(snd_seq_device_t *dev, ops_list_t *ops)
482/* 483/*
483 * release the device - call free_device operator 484 * release the device - call free_device operator
484 */ 485 */
485static int free_device(snd_seq_device_t *dev, ops_list_t *ops) 486static int free_device(struct snd_seq_device *dev, struct ops_list *ops)
486{ 487{
487 int result; 488 int result;
488 489
@@ -491,7 +492,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops)
491 if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) 492 if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED)
492 return 0; /* not registered */ 493 return 0; /* not registered */
493 if (ops->argsize != dev->argsize) { 494 if (ops->argsize != dev->argsize) {
494 snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); 495 snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n",
496 dev->name, ops->id, ops->argsize, dev->argsize);
495 return -EINVAL; 497 return -EINVAL;
496 } 498 }
497 if ((result = ops->ops.free_device(dev)) >= 0 || result == -ENXIO) { 499 if ((result = ops->ops.free_device(dev)) >= 0 || result == -ENXIO) {
@@ -499,7 +501,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops)
499 dev->driver_data = NULL; 501 dev->driver_data = NULL;
500 ops->num_init_devices--; 502 ops->num_init_devices--;
501 } else { 503 } else {
502 snd_printk(KERN_ERR "free_device failed: %s: %s\n", dev->name, dev->id); 504 snd_printk(KERN_ERR "free_device failed: %s: %s\n",
505 dev->name, dev->id);
503 } 506 }
504 507
505 return 0; 508 return 0;
@@ -508,13 +511,13 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops)
508/* 511/*
509 * find the matching driver with given id 512 * find the matching driver with given id
510 */ 513 */
511static ops_list_t * find_driver(char *id, int create_if_empty) 514static struct ops_list * find_driver(char *id, int create_if_empty)
512{ 515{
513 struct list_head *head; 516 struct list_head *head;
514 517
515 down(&ops_mutex); 518 down(&ops_mutex);
516 list_for_each(head, &opslist) { 519 list_for_each(head, &opslist) {
517 ops_list_t *ops = list_entry(head, ops_list_t, list); 520 struct ops_list *ops = list_entry(head, struct ops_list, list);
518 if (strcmp(ops->id, id) == 0) { 521 if (strcmp(ops->id, id) == 0) {
519 ops->used++; 522 ops->used++;
520 up(&ops_mutex); 523 up(&ops_mutex);
@@ -527,7 +530,7 @@ static ops_list_t * find_driver(char *id, int create_if_empty)
527 return NULL; 530 return NULL;
528} 531}
529 532
530static void unlock_driver(ops_list_t *ops) 533static void unlock_driver(struct ops_list *ops)
531{ 534{
532 down(&ops_mutex); 535 down(&ops_mutex);
533 ops->used--; 536 ops->used--;
@@ -541,7 +544,8 @@ static void unlock_driver(ops_list_t *ops)
541 544
542static int __init alsa_seq_device_init(void) 545static int __init alsa_seq_device_init(void)
543{ 546{
544 info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers", snd_seq_root); 547 info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers",
548 snd_seq_root);
545 if (info_entry == NULL) 549 if (info_entry == NULL)
546 return -ENOMEM; 550 return -ENOMEM;
547 info_entry->content = SNDRV_INFO_CONTENT_TEXT; 551 info_entry->content = SNDRV_INFO_CONTENT_TEXT;
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c
index 5dd0e6a19e50..8101a475e3e5 100644
--- a/sound/core/seq/seq_dummy.c
+++ b/sound/core/seq/seq_dummy.c
@@ -73,12 +73,12 @@ MODULE_PARM_DESC(ports, "number of ports to be created");
73module_param(duplex, bool, 0444); 73module_param(duplex, bool, 0444);
74MODULE_PARM_DESC(duplex, "create DUPLEX ports"); 74MODULE_PARM_DESC(duplex, "create DUPLEX ports");
75 75
76typedef struct snd_seq_dummy_port { 76struct snd_seq_dummy_port {
77 int client; 77 int client;
78 int port; 78 int port;
79 int duplex; 79 int duplex;
80 int connect; 80 int connect;
81} snd_seq_dummy_port_t; 81};
82 82
83static int my_client = -1; 83static int my_client = -1;
84 84
@@ -88,11 +88,11 @@ static int my_client = -1;
88 * Note: this callback is called only after all subscribers are removed. 88 * Note: this callback is called only after all subscribers are removed.
89 */ 89 */
90static int 90static int
91dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info) 91dummy_unuse(void *private_data, struct snd_seq_port_subscribe *info)
92{ 92{
93 snd_seq_dummy_port_t *p; 93 struct snd_seq_dummy_port *p;
94 int i; 94 int i;
95 snd_seq_event_t ev; 95 struct snd_seq_event ev;
96 96
97 p = private_data; 97 p = private_data;
98 memset(&ev, 0, sizeof(ev)); 98 memset(&ev, 0, sizeof(ev));
@@ -116,10 +116,11 @@ dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info)
116 * event input callback - just redirect events to subscribers 116 * event input callback - just redirect events to subscribers
117 */ 117 */
118static int 118static int
119dummy_input(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop) 119dummy_input(struct snd_seq_event *ev, int direct, void *private_data,
120 int atomic, int hop)
120{ 121{
121 snd_seq_dummy_port_t *p; 122 struct snd_seq_dummy_port *p;
122 snd_seq_event_t tmpev; 123 struct snd_seq_event tmpev;
123 124
124 p = private_data; 125 p = private_data;
125 if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM || 126 if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM ||
@@ -146,12 +147,12 @@ dummy_free(void *private_data)
146/* 147/*
147 * create a port 148 * create a port
148 */ 149 */
149static snd_seq_dummy_port_t __init * 150static struct snd_seq_dummy_port __init *
150create_port(int idx, int type) 151create_port(int idx, int type)
151{ 152{
152 snd_seq_port_info_t pinfo; 153 struct snd_seq_port_info pinfo;
153 snd_seq_port_callback_t pcb; 154 struct snd_seq_port_callback pcb;
154 snd_seq_dummy_port_t *rec; 155 struct snd_seq_dummy_port *rec;
155 156
156 if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) 157 if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL)
157 return NULL; 158 return NULL;
@@ -192,9 +193,9 @@ create_port(int idx, int type)
192static int __init 193static int __init
193register_client(void) 194register_client(void)
194{ 195{
195 snd_seq_client_callback_t cb; 196 struct snd_seq_client_callback cb;
196 snd_seq_client_info_t cinfo; 197 struct snd_seq_client_info cinfo;
197 snd_seq_dummy_port_t *rec1, *rec2; 198 struct snd_seq_dummy_port *rec1, *rec2;
198 int i; 199 int i;
199 200
200 if (ports < 1) { 201 if (ports < 1) {
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index 4767cfdc361f..6b055aed7a4b 100644
--- a/sound/core/seq/seq_fifo.c
+++ b/sound/core/seq/seq_fifo.c
@@ -29,9 +29,9 @@
29/* FIFO */ 29/* FIFO */
30 30
31/* create new fifo */ 31/* create new fifo */
32fifo_t *snd_seq_fifo_new(int poolsize) 32struct snd_seq_fifo *snd_seq_fifo_new(int poolsize)
33{ 33{
34 fifo_t *f; 34 struct snd_seq_fifo *f;
35 35
36 f = kzalloc(sizeof(*f), GFP_KERNEL); 36 f = kzalloc(sizeof(*f), GFP_KERNEL);
37 if (f == NULL) { 37 if (f == NULL) {
@@ -62,9 +62,9 @@ fifo_t *snd_seq_fifo_new(int poolsize)
62 return f; 62 return f;
63} 63}
64 64
65void snd_seq_fifo_delete(fifo_t **fifo) 65void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
66{ 66{
67 fifo_t *f; 67 struct snd_seq_fifo *f;
68 68
69 snd_assert(fifo != NULL, return); 69 snd_assert(fifo != NULL, return);
70 f = *fifo; 70 f = *fifo;
@@ -88,12 +88,12 @@ void snd_seq_fifo_delete(fifo_t **fifo)
88 kfree(f); 88 kfree(f);
89} 89}
90 90
91static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f); 91static struct snd_seq_event_cell *fifo_cell_out(struct snd_seq_fifo *f);
92 92
93/* clear queue */ 93/* clear queue */
94void snd_seq_fifo_clear(fifo_t *f) 94void snd_seq_fifo_clear(struct snd_seq_fifo *f)
95{ 95{
96 snd_seq_event_cell_t *cell; 96 struct snd_seq_event_cell *cell;
97 unsigned long flags; 97 unsigned long flags;
98 98
99 /* clear overflow flag */ 99 /* clear overflow flag */
@@ -110,9 +110,10 @@ void snd_seq_fifo_clear(fifo_t *f)
110 110
111 111
112/* enqueue event to fifo */ 112/* enqueue event to fifo */
113int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event) 113int snd_seq_fifo_event_in(struct snd_seq_fifo *f,
114 struct snd_seq_event *event)
114{ 115{
115 snd_seq_event_cell_t *cell; 116 struct snd_seq_event_cell *cell;
116 unsigned long flags; 117 unsigned long flags;
117 int err; 118 int err;
118 119
@@ -148,9 +149,9 @@ int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event)
148} 149}
149 150
150/* dequeue cell from fifo */ 151/* dequeue cell from fifo */
151static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f) 152static struct snd_seq_event_cell *fifo_cell_out(struct snd_seq_fifo *f)
152{ 153{
153 snd_seq_event_cell_t *cell; 154 struct snd_seq_event_cell *cell;
154 155
155 if ((cell = f->head) != NULL) { 156 if ((cell = f->head) != NULL) {
156 f->head = cell->next; 157 f->head = cell->next;
@@ -167,9 +168,10 @@ static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f)
167} 168}
168 169
169/* dequeue cell from fifo and copy on user space */ 170/* dequeue cell from fifo and copy on user space */
170int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock) 171int snd_seq_fifo_cell_out(struct snd_seq_fifo *f,
172 struct snd_seq_event_cell **cellp, int nonblock)
171{ 173{
172 snd_seq_event_cell_t *cell; 174 struct snd_seq_event_cell *cell;
173 unsigned long flags; 175 unsigned long flags;
174 wait_queue_t wait; 176 wait_queue_t wait;
175 177
@@ -202,7 +204,8 @@ int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock)
202} 204}
203 205
204 206
205void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell) 207void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f,
208 struct snd_seq_event_cell *cell)
206{ 209{
207 unsigned long flags; 210 unsigned long flags;
208 211
@@ -217,18 +220,19 @@ void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell)
217 220
218 221
219/* polling; return non-zero if queue is available */ 222/* polling; return non-zero if queue is available */
220int snd_seq_fifo_poll_wait(fifo_t *f, struct file *file, poll_table *wait) 223int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file,
224 poll_table *wait)
221{ 225{
222 poll_wait(file, &f->input_sleep, wait); 226 poll_wait(file, &f->input_sleep, wait);
223 return (f->cells > 0); 227 return (f->cells > 0);
224} 228}
225 229
226/* change the size of pool; all old events are removed */ 230/* change the size of pool; all old events are removed */
227int snd_seq_fifo_resize(fifo_t *f, int poolsize) 231int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
228{ 232{
229 unsigned long flags; 233 unsigned long flags;
230 pool_t *newpool, *oldpool; 234 struct snd_seq_pool *newpool, *oldpool;
231 snd_seq_event_cell_t *cell, *next, *oldhead; 235 struct snd_seq_event_cell *cell, *next, *oldhead;
232 236
233 snd_assert(f != NULL && f->pool != NULL, return -EINVAL); 237 snd_assert(f != NULL && f->pool != NULL, return -EINVAL);
234 238
diff --git a/sound/core/seq/seq_fifo.h b/sound/core/seq/seq_fifo.h
index d677c261b0a4..062c446e7867 100644
--- a/sound/core/seq/seq_fifo.h
+++ b/sound/core/seq/seq_fifo.h
@@ -27,46 +27,46 @@
27 27
28/* === FIFO === */ 28/* === FIFO === */
29 29
30typedef struct { 30struct snd_seq_fifo {
31 pool_t *pool; /* FIFO pool */ 31 struct snd_seq_pool *pool; /* FIFO pool */
32 snd_seq_event_cell_t* head; /* pointer to head of fifo */ 32 struct snd_seq_event_cell *head; /* pointer to head of fifo */
33 snd_seq_event_cell_t* tail; /* pointer to tail of fifo */ 33 struct snd_seq_event_cell *tail; /* pointer to tail of fifo */
34 int cells; 34 int cells;
35 spinlock_t lock; 35 spinlock_t lock;
36 snd_use_lock_t use_lock; 36 snd_use_lock_t use_lock;
37 wait_queue_head_t input_sleep; 37 wait_queue_head_t input_sleep;
38 atomic_t overflow; 38 atomic_t overflow;
39 39
40} fifo_t; 40};
41 41
42/* create new fifo (constructor) */ 42/* create new fifo (constructor) */
43extern fifo_t *snd_seq_fifo_new(int poolsize); 43struct snd_seq_fifo *snd_seq_fifo_new(int poolsize);
44 44
45/* delete fifo (destructor) */ 45/* delete fifo (destructor) */
46extern void snd_seq_fifo_delete(fifo_t **f); 46void snd_seq_fifo_delete(struct snd_seq_fifo **f);
47 47
48 48
49/* enqueue event to fifo */ 49/* enqueue event to fifo */
50extern int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event); 50int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event);
51 51
52/* lock fifo from release */ 52/* lock fifo from release */
53#define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock) 53#define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock)
54#define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock) 54#define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock)
55 55
56/* get a cell from fifo - fifo should be locked */ 56/* get a cell from fifo - fifo should be locked */
57int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock); 57int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, struct snd_seq_event_cell **cellp, int nonblock);
58 58
59/* free dequeued cell - fifo should be locked */ 59/* free dequeued cell - fifo should be locked */
60extern void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell); 60void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f, struct snd_seq_event_cell *cell);
61 61
62/* clean up queue */ 62/* clean up queue */
63extern void snd_seq_fifo_clear(fifo_t *f); 63void snd_seq_fifo_clear(struct snd_seq_fifo *f);
64 64
65/* polling */ 65/* polling */
66extern int snd_seq_fifo_poll_wait(fifo_t *f, struct file *file, poll_table *wait); 66int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table *wait);
67 67
68/* resize pool in fifo */ 68/* resize pool in fifo */
69int snd_seq_fifo_resize(fifo_t *f, int poolsize); 69int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
70 70
71 71
72#endif 72#endif
diff --git a/sound/core/seq/seq_info.c b/sound/core/seq/seq_info.c
index b50b695c41c4..3257cf4ec258 100644
--- a/sound/core/seq/seq_info.c
+++ b/sound/core/seq/seq_info.c
@@ -28,15 +28,16 @@
28#include "seq_timer.h" 28#include "seq_timer.h"
29 29
30 30
31static snd_info_entry_t *queues_entry; 31static struct snd_info_entry *queues_entry;
32static snd_info_entry_t *clients_entry; 32static struct snd_info_entry *clients_entry;
33static snd_info_entry_t *timer_entry; 33static struct snd_info_entry *timer_entry;
34 34
35 35
36static snd_info_entry_t * __init 36static struct snd_info_entry * __init
37create_info_entry(char *name, int size, void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) 37create_info_entry(char *name, int size, void (*read)(struct snd_info_entry *,
38 struct snd_info_buffer *))
38{ 39{
39 snd_info_entry_t *entry; 40 struct snd_info_entry *entry;
40 41
41 entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root); 42 entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root);
42 if (entry == NULL) 43 if (entry == NULL)
diff --git a/sound/core/seq/seq_info.h b/sound/core/seq/seq_info.h
index efd099a858e4..5a91ebce43a0 100644
--- a/sound/core/seq/seq_info.h
+++ b/sound/core/seq/seq_info.h
@@ -24,9 +24,9 @@
24#include <sound/info.h> 24#include <sound/info.h>
25#include <sound/seq_kernel.h> 25#include <sound/seq_kernel.h>
26 26
27void snd_seq_info_clients_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); 27void snd_seq_info_clients_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
28void snd_seq_info_timer_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); 28void snd_seq_info_timer_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
29void snd_seq_info_queues_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); 29void snd_seq_info_queues_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
30 30
31 31
32int snd_seq_info_init( void ); 32int snd_seq_info_init( void );
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c
index 1d525b13ebb6..487452063965 100644
--- a/sound/core/seq/seq_instr.c
+++ b/sound/core/seq/seq_instr.c
@@ -31,7 +31,7 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer instrument libra
31MODULE_LICENSE("GPL"); 31MODULE_LICENSE("GPL");
32 32
33 33
34static void snd_instr_lock_ops(snd_seq_kinstr_list_t *list) 34static void snd_instr_lock_ops(struct snd_seq_kinstr_list *list)
35{ 35{
36 if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { 36 if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
37 spin_lock_irqsave(&list->ops_lock, list->ops_flags); 37 spin_lock_irqsave(&list->ops_lock, list->ops_flags);
@@ -40,7 +40,7 @@ static void snd_instr_lock_ops(snd_seq_kinstr_list_t *list)
40 } 40 }
41} 41}
42 42
43static void snd_instr_unlock_ops(snd_seq_kinstr_list_t *list) 43static void snd_instr_unlock_ops(struct snd_seq_kinstr_list *list)
44{ 44{
45 if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { 45 if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
46 spin_unlock_irqrestore(&list->ops_lock, list->ops_flags); 46 spin_unlock_irqrestore(&list->ops_lock, list->ops_flags);
@@ -49,18 +49,18 @@ static void snd_instr_unlock_ops(snd_seq_kinstr_list_t *list)
49 } 49 }
50} 50}
51 51
52static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic) 52static struct snd_seq_kinstr *snd_seq_instr_new(int add_len, int atomic)
53{ 53{
54 snd_seq_kinstr_t *instr; 54 struct snd_seq_kinstr *instr;
55 55
56 instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); 56 instr = kzalloc(sizeof(struct snd_seq_kinstr) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
57 if (instr == NULL) 57 if (instr == NULL)
58 return NULL; 58 return NULL;
59 instr->add_len = add_len; 59 instr->add_len = add_len;
60 return instr; 60 return instr;
61} 61}
62 62
63static int snd_seq_instr_free(snd_seq_kinstr_t *instr, int atomic) 63static int snd_seq_instr_free(struct snd_seq_kinstr *instr, int atomic)
64{ 64{
65 int result = 0; 65 int result = 0;
66 66
@@ -73,11 +73,11 @@ static int snd_seq_instr_free(snd_seq_kinstr_t *instr, int atomic)
73 return result; 73 return result;
74} 74}
75 75
76snd_seq_kinstr_list_t *snd_seq_instr_list_new(void) 76struct snd_seq_kinstr_list *snd_seq_instr_list_new(void)
77{ 77{
78 snd_seq_kinstr_list_t *list; 78 struct snd_seq_kinstr_list *list;
79 79
80 list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); 80 list = kzalloc(sizeof(struct snd_seq_kinstr_list), GFP_KERNEL);
81 if (list == NULL) 81 if (list == NULL)
82 return NULL; 82 return NULL;
83 spin_lock_init(&list->lock); 83 spin_lock_init(&list->lock);
@@ -87,11 +87,11 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void)
87 return list; 87 return list;
88} 88}
89 89
90void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr) 90void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list_ptr)
91{ 91{
92 snd_seq_kinstr_list_t *list; 92 struct snd_seq_kinstr_list *list;
93 snd_seq_kinstr_t *instr; 93 struct snd_seq_kinstr *instr;
94 snd_seq_kcluster_t *cluster; 94 struct snd_seq_kcluster *cluster;
95 int idx; 95 int idx;
96 unsigned long flags; 96 unsigned long flags;
97 97
@@ -125,8 +125,8 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
125 kfree(list); 125 kfree(list);
126} 126}
127 127
128static int instr_free_compare(snd_seq_kinstr_t *instr, 128static int instr_free_compare(struct snd_seq_kinstr *instr,
129 snd_seq_instr_header_t *ifree, 129 struct snd_seq_instr_header *ifree,
130 unsigned int client) 130 unsigned int client)
131{ 131{
132 switch (ifree->cmd) { 132 switch (ifree->cmd) {
@@ -160,12 +160,12 @@ static int instr_free_compare(snd_seq_kinstr_t *instr,
160 return 1; 160 return 1;
161} 161}
162 162
163int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, 163int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
164 snd_seq_instr_header_t *ifree, 164 struct snd_seq_instr_header *ifree,
165 int client, 165 int client,
166 int atomic) 166 int atomic)
167{ 167{
168 snd_seq_kinstr_t *instr, *prev, *next, *flist; 168 struct snd_seq_kinstr *instr, *prev, *next, *flist;
169 int idx; 169 int idx;
170 unsigned long flags; 170 unsigned long flags;
171 171
@@ -209,7 +209,7 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
209 return 0; 209 return 0;
210} 210}
211 211
212static int compute_hash_instr_key(snd_seq_instr_t *instr) 212static int compute_hash_instr_key(struct snd_seq_instr *instr)
213{ 213{
214 int result; 214 int result;
215 215
@@ -233,7 +233,7 @@ static int compute_hash_cluster_key(snd_seq_instr_cluster_t cluster)
233} 233}
234#endif 234#endif
235 235
236static int compare_instr(snd_seq_instr_t *i1, snd_seq_instr_t *i2, int exact) 236static int compare_instr(struct snd_seq_instr *i1, struct snd_seq_instr *i2, int exact)
237{ 237{
238 if (exact) { 238 if (exact) {
239 if (i1->cluster != i2->cluster || 239 if (i1->cluster != i2->cluster ||
@@ -262,14 +262,14 @@ static int compare_instr(snd_seq_instr_t *i1, snd_seq_instr_t *i2, int exact)
262 } 262 }
263} 263}
264 264
265snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, 265struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
266 snd_seq_instr_t *instr, 266 struct snd_seq_instr *instr,
267 int exact, 267 int exact,
268 int follow_alias) 268 int follow_alias)
269{ 269{
270 unsigned long flags; 270 unsigned long flags;
271 int depth = 0; 271 int depth = 0;
272 snd_seq_kinstr_t *result; 272 struct snd_seq_kinstr *result;
273 273
274 if (list == NULL || instr == NULL) 274 if (list == NULL || instr == NULL)
275 return NULL; 275 return NULL;
@@ -279,7 +279,7 @@ snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list,
279 while (result) { 279 while (result) {
280 if (!compare_instr(&result->instr, instr, exact)) { 280 if (!compare_instr(&result->instr, instr, exact)) {
281 if (follow_alias && (result->type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)) { 281 if (follow_alias && (result->type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)) {
282 instr = (snd_seq_instr_t *)KINSTR_DATA(result); 282 instr = (struct snd_seq_instr *)KINSTR_DATA(result);
283 if (++depth > 10) 283 if (++depth > 10)
284 goto __not_found; 284 goto __not_found;
285 goto __again; 285 goto __again;
@@ -295,8 +295,8 @@ snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list,
295 return NULL; 295 return NULL;
296} 296}
297 297
298void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, 298void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
299 snd_seq_kinstr_t *instr) 299 struct snd_seq_kinstr *instr)
300{ 300{
301 unsigned long flags; 301 unsigned long flags;
302 302
@@ -311,7 +311,8 @@ void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list,
311 spin_unlock_irqrestore(&list->lock, flags); 311 spin_unlock_irqrestore(&list->lock, flags);
312} 312}
313 313
314static snd_seq_kinstr_ops_t *instr_ops(snd_seq_kinstr_ops_t *ops, char *instr_type) 314static struct snd_seq_kinstr_ops *instr_ops(struct snd_seq_kinstr_ops *ops,
315 char *instr_type)
315{ 316{
316 while (ops) { 317 while (ops) {
317 if (!strcmp(ops->instr_type, instr_type)) 318 if (!strcmp(ops->instr_type, instr_type))
@@ -321,11 +322,11 @@ static snd_seq_kinstr_ops_t *instr_ops(snd_seq_kinstr_ops_t *ops, char *instr_ty
321 return NULL; 322 return NULL;
322} 323}
323 324
324static int instr_result(snd_seq_event_t *ev, 325static int instr_result(struct snd_seq_event *ev,
325 int type, int result, 326 int type, int result,
326 int atomic) 327 int atomic)
327{ 328{
328 snd_seq_event_t sev; 329 struct snd_seq_event sev;
329 330
330 memset(&sev, 0, sizeof(sev)); 331 memset(&sev, 0, sizeof(sev));
331 sev.type = SNDRV_SEQ_EVENT_RESULT; 332 sev.type = SNDRV_SEQ_EVENT_RESULT;
@@ -345,9 +346,9 @@ static int instr_result(snd_seq_event_t *ev,
345 return snd_seq_kernel_client_dispatch(sev.source.client, &sev, atomic, 0); 346 return snd_seq_kernel_client_dispatch(sev.source.client, &sev, atomic, 0);
346} 347}
347 348
348static int instr_begin(snd_seq_kinstr_ops_t *ops, 349static int instr_begin(struct snd_seq_kinstr_ops *ops,
349 snd_seq_kinstr_list_t *list, 350 struct snd_seq_kinstr_list *list,
350 snd_seq_event_t *ev, 351 struct snd_seq_event *ev,
351 int atomic, int hop) 352 int atomic, int hop)
352{ 353{
353 unsigned long flags; 354 unsigned long flags;
@@ -362,9 +363,9 @@ static int instr_begin(snd_seq_kinstr_ops_t *ops,
362 return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, 0, atomic); 363 return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, 0, atomic);
363} 364}
364 365
365static int instr_end(snd_seq_kinstr_ops_t *ops, 366static int instr_end(struct snd_seq_kinstr_ops *ops,
366 snd_seq_kinstr_list_t *list, 367 struct snd_seq_kinstr_list *list,
367 snd_seq_event_t *ev, 368 struct snd_seq_event *ev,
368 int atomic, int hop) 369 int atomic, int hop)
369{ 370{
370 unsigned long flags; 371 unsigned long flags;
@@ -380,54 +381,55 @@ static int instr_end(snd_seq_kinstr_ops_t *ops,
380 return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, -EINVAL, atomic); 381 return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, -EINVAL, atomic);
381} 382}
382 383
383static int instr_info(snd_seq_kinstr_ops_t *ops, 384static int instr_info(struct snd_seq_kinstr_ops *ops,
384 snd_seq_kinstr_list_t *list, 385 struct snd_seq_kinstr_list *list,
385 snd_seq_event_t *ev, 386 struct snd_seq_event *ev,
386 int atomic, int hop) 387 int atomic, int hop)
387{ 388{
388 return -ENXIO; 389 return -ENXIO;
389} 390}
390 391
391static int instr_format_info(snd_seq_kinstr_ops_t *ops, 392static int instr_format_info(struct snd_seq_kinstr_ops *ops,
392 snd_seq_kinstr_list_t *list, 393 struct snd_seq_kinstr_list *list,
393 snd_seq_event_t *ev, 394 struct snd_seq_event *ev,
394 int atomic, int hop) 395 int atomic, int hop)
395{ 396{
396 return -ENXIO; 397 return -ENXIO;
397} 398}
398 399
399static int instr_reset(snd_seq_kinstr_ops_t *ops, 400static int instr_reset(struct snd_seq_kinstr_ops *ops,
400 snd_seq_kinstr_list_t *list, 401 struct snd_seq_kinstr_list *list,
401 snd_seq_event_t *ev, 402 struct snd_seq_event *ev,
402 int atomic, int hop) 403 int atomic, int hop)
403{ 404{
404 return -ENXIO; 405 return -ENXIO;
405} 406}
406 407
407static int instr_status(snd_seq_kinstr_ops_t *ops, 408static int instr_status(struct snd_seq_kinstr_ops *ops,
408 snd_seq_kinstr_list_t *list, 409 struct snd_seq_kinstr_list *list,
409 snd_seq_event_t *ev, 410 struct snd_seq_event *ev,
410 int atomic, int hop) 411 int atomic, int hop)
411{ 412{
412 return -ENXIO; 413 return -ENXIO;
413} 414}
414 415
415static int instr_put(snd_seq_kinstr_ops_t *ops, 416static int instr_put(struct snd_seq_kinstr_ops *ops,
416 snd_seq_kinstr_list_t *list, 417 struct snd_seq_kinstr_list *list,
417 snd_seq_event_t *ev, 418 struct snd_seq_event *ev,
418 int atomic, int hop) 419 int atomic, int hop)
419{ 420{
420 unsigned long flags; 421 unsigned long flags;
421 snd_seq_instr_header_t put; 422 struct snd_seq_instr_header put;
422 snd_seq_kinstr_t *instr; 423 struct snd_seq_kinstr *instr;
423 int result = -EINVAL, len, key; 424 int result = -EINVAL, len, key;
424 425
425 if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR) 426 if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR)
426 goto __return; 427 goto __return;
427 428
428 if (ev->data.ext.len < sizeof(snd_seq_instr_header_t)) 429 if (ev->data.ext.len < sizeof(struct snd_seq_instr_header))
429 goto __return; 430 goto __return;
430 if (copy_from_user(&put, (void __user *)ev->data.ext.ptr, sizeof(snd_seq_instr_header_t))) { 431 if (copy_from_user(&put, (void __user *)ev->data.ext.ptr,
432 sizeof(struct snd_seq_instr_header))) {
431 result = -EFAULT; 433 result = -EFAULT;
432 goto __return; 434 goto __return;
433 } 435 }
@@ -449,7 +451,7 @@ static int instr_put(snd_seq_kinstr_ops_t *ops,
449 } 451 }
450 len = ops->add_len; 452 len = ops->add_len;
451 if (put.data.type == SNDRV_SEQ_INSTR_ATYPE_ALIAS) 453 if (put.data.type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)
452 len = sizeof(snd_seq_instr_t); 454 len = sizeof(struct snd_seq_instr);
453 instr = snd_seq_instr_new(len, atomic); 455 instr = snd_seq_instr_new(len, atomic);
454 if (instr == NULL) { 456 if (instr == NULL) {
455 snd_instr_unlock_ops(list); 457 snd_instr_unlock_ops(list);
@@ -463,8 +465,8 @@ static int instr_put(snd_seq_kinstr_ops_t *ops,
463 if (instr->type == SNDRV_SEQ_INSTR_ATYPE_DATA) { 465 if (instr->type == SNDRV_SEQ_INSTR_ATYPE_DATA) {
464 result = ops->put(ops->private_data, 466 result = ops->put(ops->private_data,
465 instr, 467 instr,
466 (void __user *)ev->data.ext.ptr + sizeof(snd_seq_instr_header_t), 468 (void __user *)ev->data.ext.ptr + sizeof(struct snd_seq_instr_header),
467 ev->data.ext.len - sizeof(snd_seq_instr_header_t), 469 ev->data.ext.len - sizeof(struct snd_seq_instr_header),
468 atomic, 470 atomic,
469 put.cmd); 471 put.cmd);
470 if (result < 0) { 472 if (result < 0) {
@@ -486,21 +488,21 @@ static int instr_put(snd_seq_kinstr_ops_t *ops,
486 return result; 488 return result;
487} 489}
488 490
489static int instr_get(snd_seq_kinstr_ops_t *ops, 491static int instr_get(struct snd_seq_kinstr_ops *ops,
490 snd_seq_kinstr_list_t *list, 492 struct snd_seq_kinstr_list *list,
491 snd_seq_event_t *ev, 493 struct snd_seq_event *ev,
492 int atomic, int hop) 494 int atomic, int hop)
493{ 495{
494 return -ENXIO; 496 return -ENXIO;
495} 497}
496 498
497static int instr_free(snd_seq_kinstr_ops_t *ops, 499static int instr_free(struct snd_seq_kinstr_ops *ops,
498 snd_seq_kinstr_list_t *list, 500 struct snd_seq_kinstr_list *list,
499 snd_seq_event_t *ev, 501 struct snd_seq_event *ev,
500 int atomic, int hop) 502 int atomic, int hop)
501{ 503{
502 snd_seq_instr_header_t ifree; 504 struct snd_seq_instr_header ifree;
503 snd_seq_kinstr_t *instr, *prev; 505 struct snd_seq_kinstr *instr, *prev;
504 int result = -EINVAL; 506 int result = -EINVAL;
505 unsigned long flags; 507 unsigned long flags;
506 unsigned int hash; 508 unsigned int hash;
@@ -508,9 +510,10 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
508 if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR) 510 if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR)
509 goto __return; 511 goto __return;
510 512
511 if (ev->data.ext.len < sizeof(snd_seq_instr_header_t)) 513 if (ev->data.ext.len < sizeof(struct snd_seq_instr_header))
512 goto __return; 514 goto __return;
513 if (copy_from_user(&ifree, (void __user *)ev->data.ext.ptr, sizeof(snd_seq_instr_header_t))) { 515 if (copy_from_user(&ifree, (void __user *)ev->data.ext.ptr,
516 sizeof(struct snd_seq_instr_header))) {
514 result = -EFAULT; 517 result = -EFAULT;
515 goto __return; 518 goto __return;
516 } 519 }
@@ -548,7 +551,8 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
548 list->hash[hash] = instr->next; 551 list->hash[hash] = instr->next;
549 } 552 }
550 if (instr->ops && instr->ops->notify) 553 if (instr->ops && instr->ops->notify)
551 instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); 554 instr->ops->notify(instr->ops->private_data, instr,
555 SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
552 while (instr->use) { 556 while (instr->use) {
553 spin_unlock_irqrestore(&list->lock, flags); 557 spin_unlock_irqrestore(&list->lock, flags);
554 schedule_timeout_interruptible(1); 558 schedule_timeout_interruptible(1);
@@ -565,25 +569,25 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
565 return result; 569 return result;
566} 570}
567 571
568static int instr_list(snd_seq_kinstr_ops_t *ops, 572static int instr_list(struct snd_seq_kinstr_ops *ops,
569 snd_seq_kinstr_list_t *list, 573 struct snd_seq_kinstr_list *list,
570 snd_seq_event_t *ev, 574 struct snd_seq_event *ev,
571 int atomic, int hop) 575 int atomic, int hop)
572{ 576{
573 return -ENXIO; 577 return -ENXIO;
574} 578}
575 579
576static int instr_cluster(snd_seq_kinstr_ops_t *ops, 580static int instr_cluster(struct snd_seq_kinstr_ops *ops,
577 snd_seq_kinstr_list_t *list, 581 struct snd_seq_kinstr_list *list,
578 snd_seq_event_t *ev, 582 struct snd_seq_event *ev,
579 int atomic, int hop) 583 int atomic, int hop)
580{ 584{
581 return -ENXIO; 585 return -ENXIO;
582} 586}
583 587
584int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, 588int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
585 snd_seq_kinstr_list_t *list, 589 struct snd_seq_kinstr_list *list,
586 snd_seq_event_t *ev, 590 struct snd_seq_event *ev,
587 int client, 591 int client,
588 int atomic, 592 int atomic,
589 int hop) 593 int hop)
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 8416bcffa091..9ee6c177db0c 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -36,12 +36,12 @@
36#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem) 36#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem)
37 37
38 38
39static inline int snd_seq_pool_available(pool_t *pool) 39static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
40{ 40{
41 return pool->total_elements - atomic_read(&pool->counter); 41 return pool->total_elements - atomic_read(&pool->counter);
42} 42}
43 43
44static inline int snd_seq_output_ok(pool_t *pool) 44static inline int snd_seq_output_ok(struct snd_seq_pool *pool)
45{ 45{
46 return snd_seq_pool_available(pool) >= pool->room; 46 return snd_seq_pool_available(pool) >= pool->room;
47} 47}
@@ -72,7 +72,7 @@ static inline int snd_seq_output_ok(pool_t *pool)
72 * call dump function to expand external data. 72 * call dump function to expand external data.
73 */ 73 */
74 74
75static int get_var_len(const snd_seq_event_t *event) 75static int get_var_len(const struct snd_seq_event *event)
76{ 76{
77 if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) 77 if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
78 return -EINVAL; 78 return -EINVAL;
@@ -80,10 +80,11 @@ static int get_var_len(const snd_seq_event_t *event)
80 return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; 80 return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
81} 81}
82 82
83int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data) 83int snd_seq_dump_var_event(const struct snd_seq_event *event,
84 snd_seq_dump_func_t func, void *private_data)
84{ 85{
85 int len, err; 86 int len, err;
86 snd_seq_event_cell_t *cell; 87 struct snd_seq_event_cell *cell;
87 88
88 if ((len = get_var_len(event)) <= 0) 89 if ((len = get_var_len(event)) <= 0)
89 return len; 90 return len;
@@ -108,9 +109,9 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
108 return func(private_data, event->data.ext.ptr, len); 109 return func(private_data, event->data.ext.ptr, len);
109 } 110 }
110 111
111 cell = (snd_seq_event_cell_t*)event->data.ext.ptr; 112 cell = (struct snd_seq_event_cell *)event->data.ext.ptr;
112 for (; len > 0 && cell; cell = cell->next) { 113 for (; len > 0 && cell; cell = cell->next) {
113 int size = sizeof(snd_seq_event_t); 114 int size = sizeof(struct snd_seq_event);
114 if (len < size) 115 if (len < size)
115 size = len; 116 size = len;
116 err = func(private_data, &cell->event, size); 117 err = func(private_data, &cell->event, size);
@@ -142,7 +143,8 @@ static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
142 return 0; 143 return 0;
143} 144}
144 145
145int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned) 146int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
147 int in_kernel, int size_aligned)
146{ 148{
147 int len, newlen; 149 int len, newlen;
148 int err; 150 int err;
@@ -174,17 +176,18 @@ int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
174 * release this cell, free extended data if available 176 * release this cell, free extended data if available
175 */ 177 */
176 178
177static inline void free_cell(pool_t *pool, snd_seq_event_cell_t *cell) 179static inline void free_cell(struct snd_seq_pool *pool,
180 struct snd_seq_event_cell *cell)
178{ 181{
179 cell->next = pool->free; 182 cell->next = pool->free;
180 pool->free = cell; 183 pool->free = cell;
181 atomic_dec(&pool->counter); 184 atomic_dec(&pool->counter);
182} 185}
183 186
184void snd_seq_cell_free(snd_seq_event_cell_t * cell) 187void snd_seq_cell_free(struct snd_seq_event_cell * cell)
185{ 188{
186 unsigned long flags; 189 unsigned long flags;
187 pool_t *pool; 190 struct snd_seq_pool *pool;
188 191
189 snd_assert(cell != NULL, return); 192 snd_assert(cell != NULL, return);
190 pool = cell->pool; 193 pool = cell->pool;
@@ -194,7 +197,7 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
194 free_cell(pool, cell); 197 free_cell(pool, cell);
195 if (snd_seq_ev_is_variable(&cell->event)) { 198 if (snd_seq_ev_is_variable(&cell->event)) {
196 if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) { 199 if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) {
197 snd_seq_event_cell_t *curp, *nextptr; 200 struct snd_seq_event_cell *curp, *nextptr;
198 curp = cell->event.data.ext.ptr; 201 curp = cell->event.data.ext.ptr;
199 for (; curp; curp = nextptr) { 202 for (; curp; curp = nextptr) {
200 nextptr = curp->next; 203 nextptr = curp->next;
@@ -215,9 +218,11 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
215/* 218/*
216 * allocate an event cell. 219 * allocate an event cell.
217 */ 220 */
218static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int nonblock, struct file *file) 221static int snd_seq_cell_alloc(struct snd_seq_pool *pool,
222 struct snd_seq_event_cell **cellp,
223 int nonblock, struct file *file)
219{ 224{
220 snd_seq_event_cell_t *cell; 225 struct snd_seq_event_cell *cell;
221 unsigned long flags; 226 unsigned long flags;
222 int err = -EAGAIN; 227 int err = -EAGAIN;
223 wait_queue_t wait; 228 wait_queue_t wait;
@@ -280,11 +285,13 @@ __error:
280 * if the event has external data, the data is decomposed to additional 285 * if the event has external data, the data is decomposed to additional
281 * cells. 286 * cells.
282 */ 287 */
283int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file) 288int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
289 struct snd_seq_event_cell **cellp, int nonblock,
290 struct file *file)
284{ 291{
285 int ncells, err; 292 int ncells, err;
286 unsigned int extlen; 293 unsigned int extlen;
287 snd_seq_event_cell_t *cell; 294 struct snd_seq_event_cell *cell;
288 295
289 *cellp = NULL; 296 *cellp = NULL;
290 297
@@ -292,7 +299,7 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
292 extlen = 0; 299 extlen = 0;
293 if (snd_seq_ev_is_variable(event)) { 300 if (snd_seq_ev_is_variable(event)) {
294 extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; 301 extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
295 ncells = (extlen + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t); 302 ncells = (extlen + sizeof(struct snd_seq_event) - 1) / sizeof(struct snd_seq_event);
296 } 303 }
297 if (ncells >= pool->total_elements) 304 if (ncells >= pool->total_elements)
298 return -ENOMEM; 305 return -ENOMEM;
@@ -309,18 +316,18 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
309 int len = extlen; 316 int len = extlen;
310 int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED; 317 int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED;
311 int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR; 318 int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR;
312 snd_seq_event_cell_t *src, *tmp, *tail; 319 struct snd_seq_event_cell *src, *tmp, *tail;
313 char *buf; 320 char *buf;
314 321
315 cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED; 322 cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED;
316 cell->event.data.ext.ptr = NULL; 323 cell->event.data.ext.ptr = NULL;
317 324
318 src = (snd_seq_event_cell_t*)event->data.ext.ptr; 325 src = (struct snd_seq_event_cell *)event->data.ext.ptr;
319 buf = (char *)event->data.ext.ptr; 326 buf = (char *)event->data.ext.ptr;
320 tail = NULL; 327 tail = NULL;
321 328
322 while (ncells-- > 0) { 329 while (ncells-- > 0) {
323 int size = sizeof(snd_seq_event_t); 330 int size = sizeof(struct snd_seq_event);
324 if (len < size) 331 if (len < size)
325 size = len; 332 size = len;
326 err = snd_seq_cell_alloc(pool, &tmp, nonblock, file); 333 err = snd_seq_cell_alloc(pool, &tmp, nonblock, file);
@@ -358,7 +365,8 @@ __error:
358 365
359 366
360/* poll wait */ 367/* poll wait */
361int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait) 368int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file,
369 poll_table *wait)
362{ 370{
363 poll_wait(file, &pool->output_sleep, wait); 371 poll_wait(file, &pool->output_sleep, wait);
364 return snd_seq_output_ok(pool); 372 return snd_seq_output_ok(pool);
@@ -366,17 +374,17 @@ int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait)
366 374
367 375
368/* allocate room specified number of events */ 376/* allocate room specified number of events */
369int snd_seq_pool_init(pool_t *pool) 377int snd_seq_pool_init(struct snd_seq_pool *pool)
370{ 378{
371 int cell; 379 int cell;
372 snd_seq_event_cell_t *cellptr; 380 struct snd_seq_event_cell *cellptr;
373 unsigned long flags; 381 unsigned long flags;
374 382
375 snd_assert(pool != NULL, return -EINVAL); 383 snd_assert(pool != NULL, return -EINVAL);
376 if (pool->ptr) /* should be atomic? */ 384 if (pool->ptr) /* should be atomic? */
377 return 0; 385 return 0;
378 386
379 pool->ptr = vmalloc(sizeof(snd_seq_event_cell_t) * pool->size); 387 pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size);
380 if (pool->ptr == NULL) { 388 if (pool->ptr == NULL) {
381 snd_printd("seq: malloc for sequencer events failed\n"); 389 snd_printd("seq: malloc for sequencer events failed\n");
382 return -ENOMEM; 390 return -ENOMEM;
@@ -402,10 +410,10 @@ int snd_seq_pool_init(pool_t *pool)
402} 410}
403 411
404/* remove events */ 412/* remove events */
405int snd_seq_pool_done(pool_t *pool) 413int snd_seq_pool_done(struct snd_seq_pool *pool)
406{ 414{
407 unsigned long flags; 415 unsigned long flags;
408 snd_seq_event_cell_t *ptr; 416 struct snd_seq_event_cell *ptr;
409 int max_count = 5 * HZ; 417 int max_count = 5 * HZ;
410 418
411 snd_assert(pool != NULL, return -EINVAL); 419 snd_assert(pool != NULL, return -EINVAL);
@@ -446,9 +454,9 @@ int snd_seq_pool_done(pool_t *pool)
446 454
447 455
448/* init new memory pool */ 456/* init new memory pool */
449pool_t *snd_seq_pool_new(int poolsize) 457struct snd_seq_pool *snd_seq_pool_new(int poolsize)
450{ 458{
451 pool_t *pool; 459 struct snd_seq_pool *pool;
452 460
453 /* create pool block */ 461 /* create pool block */
454 pool = kzalloc(sizeof(*pool), GFP_KERNEL); 462 pool = kzalloc(sizeof(*pool), GFP_KERNEL);
@@ -472,9 +480,9 @@ pool_t *snd_seq_pool_new(int poolsize)
472} 480}
473 481
474/* remove memory pool */ 482/* remove memory pool */
475int snd_seq_pool_delete(pool_t **ppool) 483int snd_seq_pool_delete(struct snd_seq_pool **ppool)
476{ 484{
477 pool_t *pool = *ppool; 485 struct snd_seq_pool *pool = *ppool;
478 486
479 *ppool = NULL; 487 *ppool = NULL;
480 if (pool == NULL) 488 if (pool == NULL)
@@ -497,7 +505,8 @@ void __exit snd_sequencer_memory_done(void)
497 505
498 506
499/* exported to seq_clientmgr.c */ 507/* exported to seq_clientmgr.c */
500void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t *pool, char *space) 508void snd_seq_info_pool(struct snd_info_buffer *buffer,
509 struct snd_seq_pool *pool, char *space)
501{ 510{
502 if (pool == NULL) 511 if (pool == NULL)
503 return; 512 return;
diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
index 6c4dde5d3d6f..39c60d9e1efc 100644
--- a/sound/core/seq/seq_memory.h
+++ b/sound/core/seq/seq_memory.h
@@ -24,23 +24,21 @@
24#include <sound/seq_kernel.h> 24#include <sound/seq_kernel.h>
25#include <linux/poll.h> 25#include <linux/poll.h>
26 26
27typedef struct pool pool_t;
28
29/* container for sequencer event (internal use) */ 27/* container for sequencer event (internal use) */
30typedef struct snd_seq_event_cell_t { 28struct snd_seq_event_cell {
31 snd_seq_event_t event; 29 struct snd_seq_event event;
32 pool_t *pool; /* used pool */ 30 struct snd_seq_pool *pool; /* used pool */
33 struct snd_seq_event_cell_t *next; /* next cell */ 31 struct snd_seq_event_cell *next; /* next cell */
34} snd_seq_event_cell_t; 32};
35 33
36/* design note: the pool is a contigious block of memory, if we dynamicly 34/* design note: the pool is a contigious block of memory, if we dynamicly
37 want to add additional cells to the pool be better store this in another 35 want to add additional cells to the pool be better store this in another
38 pool as we need to know the base address of the pool when releasing 36 pool as we need to know the base address of the pool when releasing
39 memory. */ 37 memory. */
40 38
41struct pool { 39struct snd_seq_pool {
42 snd_seq_event_cell_t *ptr; /* pointer to first event chunk */ 40 struct snd_seq_event_cell *ptr; /* pointer to first event chunk */
43 snd_seq_event_cell_t *free; /* pointer to the head of the free list */ 41 struct snd_seq_event_cell *free; /* pointer to the head of the free list */
44 42
45 int total_elements; /* pool size actually allocated */ 43 int total_elements; /* pool size actually allocated */
46 atomic_t counter; /* cells free */ 44 atomic_t counter; /* cells free */
@@ -63,33 +61,34 @@ struct pool {
63 spinlock_t lock; 61 spinlock_t lock;
64}; 62};
65 63
66extern void snd_seq_cell_free(snd_seq_event_cell_t* cell); 64void snd_seq_cell_free(struct snd_seq_event_cell *cell);
67 65
68int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file); 66int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
67 struct snd_seq_event_cell **cellp, int nonblock, struct file *file);
69 68
70/* return number of unused (free) cells */ 69/* return number of unused (free) cells */
71static inline int snd_seq_unused_cells(pool_t *pool) 70static inline int snd_seq_unused_cells(struct snd_seq_pool *pool)
72{ 71{
73 return pool ? pool->total_elements - atomic_read(&pool->counter) : 0; 72 return pool ? pool->total_elements - atomic_read(&pool->counter) : 0;
74} 73}
75 74
76/* return total number of allocated cells */ 75/* return total number of allocated cells */
77static inline int snd_seq_total_cells(pool_t *pool) 76static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
78{ 77{
79 return pool ? pool->total_elements : 0; 78 return pool ? pool->total_elements : 0;
80} 79}
81 80
82/* init pool - allocate events */ 81/* init pool - allocate events */
83int snd_seq_pool_init(pool_t *pool); 82int snd_seq_pool_init(struct snd_seq_pool *pool);
84 83
85/* done pool - free events */ 84/* done pool - free events */
86int snd_seq_pool_done(pool_t *pool); 85int snd_seq_pool_done(struct snd_seq_pool *pool);
87 86
88/* create pool */ 87/* create pool */
89pool_t *snd_seq_pool_new(int poolsize); 88struct snd_seq_pool *snd_seq_pool_new(int poolsize);
90 89
91/* remove pool */ 90/* remove pool */
92int snd_seq_pool_delete(pool_t **pool); 91int snd_seq_pool_delete(struct snd_seq_pool **pool);
93 92
94/* init memory */ 93/* init memory */
95int snd_sequencer_memory_init(void); 94int snd_sequencer_memory_init(void);
@@ -98,7 +97,7 @@ int snd_sequencer_memory_init(void);
98void snd_sequencer_memory_done(void); 97void snd_sequencer_memory_done(void);
99 98
100/* polling */ 99/* polling */
101int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait); 100int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait);
102 101
103 102
104#endif 103#endif
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index f89f40f44876..f88d2e3ee66e 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -51,40 +51,40 @@ module_param(input_buffer_size, int, 0644);
51MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes."); 51MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes.");
52 52
53/* data for this midi synth driver */ 53/* data for this midi synth driver */
54typedef struct { 54struct seq_midisynth {
55 snd_card_t *card; 55 struct snd_card *card;
56 int device; 56 int device;
57 int subdevice; 57 int subdevice;
58 snd_rawmidi_file_t input_rfile; 58 struct snd_rawmidi_file input_rfile;
59 snd_rawmidi_file_t output_rfile; 59 struct snd_rawmidi_file output_rfile;
60 int seq_client; 60 int seq_client;
61 int seq_port; 61 int seq_port;
62 snd_midi_event_t *parser; 62 struct snd_midi_event *parser;
63} seq_midisynth_t; 63};
64 64
65typedef struct { 65struct seq_midisynth_client {
66 int seq_client; 66 int seq_client;
67 int num_ports; 67 int num_ports;
68 int ports_per_device[SNDRV_RAWMIDI_DEVICES]; 68 int ports_per_device[SNDRV_RAWMIDI_DEVICES];
69 seq_midisynth_t *ports[SNDRV_RAWMIDI_DEVICES]; 69 struct seq_midisynth *ports[SNDRV_RAWMIDI_DEVICES];
70} seq_midisynth_client_t; 70};
71 71
72static seq_midisynth_client_t *synths[SNDRV_CARDS]; 72static struct seq_midisynth_client *synths[SNDRV_CARDS];
73static DECLARE_MUTEX(register_mutex); 73static DECLARE_MUTEX(register_mutex);
74 74
75/* handle rawmidi input event (MIDI v1.0 stream) */ 75/* handle rawmidi input event (MIDI v1.0 stream) */
76static void snd_midi_input_event(snd_rawmidi_substream_t * substream) 76static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
77{ 77{
78 snd_rawmidi_runtime_t *runtime; 78 struct snd_rawmidi_runtime *runtime;
79 seq_midisynth_t *msynth; 79 struct seq_midisynth *msynth;
80 snd_seq_event_t ev; 80 struct snd_seq_event ev;
81 char buf[16], *pbuf; 81 char buf[16], *pbuf;
82 long res, count; 82 long res, count;
83 83
84 if (substream == NULL) 84 if (substream == NULL)
85 return; 85 return;
86 runtime = substream->runtime; 86 runtime = substream->runtime;
87 msynth = (seq_midisynth_t *) runtime->private_data; 87 msynth = runtime->private_data;
88 if (msynth == NULL) 88 if (msynth == NULL)
89 return; 89 return;
90 memset(&ev, 0, sizeof(ev)); 90 memset(&ev, 0, sizeof(ev));
@@ -112,9 +112,9 @@ static void snd_midi_input_event(snd_rawmidi_substream_t * substream)
112 } 112 }
113} 113}
114 114
115static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int count) 115static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, int count)
116{ 116{
117 snd_rawmidi_runtime_t *runtime; 117 struct snd_rawmidi_runtime *runtime;
118 int tmp; 118 int tmp;
119 119
120 snd_assert(substream != NULL || buf != NULL, return -EINVAL); 120 snd_assert(substream != NULL || buf != NULL, return -EINVAL);
@@ -128,12 +128,12 @@ static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int co
128 return 0; 128 return 0;
129} 129}
130 130
131static int event_process_midi(snd_seq_event_t * ev, int direct, 131static int event_process_midi(struct snd_seq_event *ev, int direct,
132 void *private_data, int atomic, int hop) 132 void *private_data, int atomic, int hop)
133{ 133{
134 seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; 134 struct seq_midisynth *msynth = private_data;
135 unsigned char msg[10]; /* buffer for constructing midi messages */ 135 unsigned char msg[10]; /* buffer for constructing midi messages */
136 snd_rawmidi_substream_t *substream; 136 struct snd_rawmidi_substream *substream;
137 int len; 137 int len;
138 138
139 snd_assert(msynth != NULL, return -EINVAL); 139 snd_assert(msynth != NULL, return -EINVAL);
@@ -161,8 +161,8 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
161} 161}
162 162
163 163
164static int snd_seq_midisynth_new(seq_midisynth_t *msynth, 164static int snd_seq_midisynth_new(struct seq_midisynth *msynth,
165 snd_card_t *card, 165 struct snd_card *card,
166 int device, 166 int device,
167 int subdevice) 167 int subdevice)
168{ 168{
@@ -175,12 +175,12 @@ static int snd_seq_midisynth_new(seq_midisynth_t *msynth,
175} 175}
176 176
177/* open associated midi device for input */ 177/* open associated midi device for input */
178static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *info) 178static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
179{ 179{
180 int err; 180 int err;
181 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 181 struct seq_midisynth *msynth = private_data;
182 snd_rawmidi_runtime_t *runtime; 182 struct snd_rawmidi_runtime *runtime;
183 snd_rawmidi_params_t params; 183 struct snd_rawmidi_params params;
184 184
185 /* open midi port */ 185 /* open midi port */
186 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) { 186 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) {
@@ -203,10 +203,10 @@ static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *inf
203} 203}
204 204
205/* close associated midi device for input */ 205/* close associated midi device for input */
206static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *info) 206static int midisynth_unsubscribe(void *private_data, struct snd_seq_port_subscribe *info)
207{ 207{
208 int err; 208 int err;
209 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 209 struct seq_midisynth *msynth = private_data;
210 210
211 snd_assert(msynth->input_rfile.input != NULL, return -EINVAL); 211 snd_assert(msynth->input_rfile.input != NULL, return -EINVAL);
212 err = snd_rawmidi_kernel_release(&msynth->input_rfile); 212 err = snd_rawmidi_kernel_release(&msynth->input_rfile);
@@ -214,11 +214,11 @@ static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *i
214} 214}
215 215
216/* open associated midi device for output */ 216/* open associated midi device for output */
217static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info) 217static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info)
218{ 218{
219 int err; 219 int err;
220 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 220 struct seq_midisynth *msynth = private_data;
221 snd_rawmidi_params_t params; 221 struct snd_rawmidi_params params;
222 222
223 /* open midi port */ 223 /* open midi port */
224 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) { 224 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) {
@@ -237,9 +237,9 @@ static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info)
237} 237}
238 238
239/* close associated midi device for output */ 239/* close associated midi device for output */
240static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info) 240static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
241{ 241{
242 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 242 struct seq_midisynth *msynth = private_data;
243 unsigned char buf = 0xff; /* MIDI reset */ 243 unsigned char buf = 0xff; /* MIDI reset */
244 244
245 snd_assert(msynth->output_rfile.output != NULL, return -EINVAL); 245 snd_assert(msynth->output_rfile.output != NULL, return -EINVAL);
@@ -250,7 +250,7 @@ static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info)
250} 250}
251 251
252/* delete given midi synth port */ 252/* delete given midi synth port */
253static void snd_seq_midisynth_delete(seq_midisynth_t *msynth) 253static void snd_seq_midisynth_delete(struct seq_midisynth *msynth)
254{ 254{
255 if (msynth == NULL) 255 if (msynth == NULL)
256 return; 256 return;
@@ -265,10 +265,10 @@ static void snd_seq_midisynth_delete(seq_midisynth_t *msynth)
265} 265}
266 266
267/* set our client name */ 267/* set our client name */
268static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card, 268static int set_client_name(struct seq_midisynth_client *client, struct snd_card *card,
269 snd_rawmidi_info_t *rmidi) 269 struct snd_rawmidi_info *rmidi)
270{ 270{
271 snd_seq_client_info_t cinfo; 271 struct snd_seq_client_info cinfo;
272 const char *name; 272 const char *name;
273 273
274 memset(&cinfo, 0, sizeof(cinfo)); 274 memset(&cinfo, 0, sizeof(cinfo));
@@ -281,17 +281,17 @@ static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card,
281 281
282/* register new midi synth port */ 282/* register new midi synth port */
283static int 283static int
284snd_seq_midisynth_register_port(snd_seq_device_t *dev) 284snd_seq_midisynth_register_port(struct snd_seq_device *dev)
285{ 285{
286 seq_midisynth_client_t *client; 286 struct seq_midisynth_client *client;
287 seq_midisynth_t *msynth, *ms; 287 struct seq_midisynth *msynth, *ms;
288 snd_seq_port_info_t *port; 288 struct snd_seq_port_info *port;
289 snd_rawmidi_info_t *info; 289 struct snd_rawmidi_info *info;
290 int newclient = 0; 290 int newclient = 0;
291 unsigned int p, ports; 291 unsigned int p, ports;
292 snd_seq_client_callback_t callbacks; 292 struct snd_seq_client_callback callbacks;
293 snd_seq_port_callback_t pcallbacks; 293 struct snd_seq_port_callback pcallbacks;
294 snd_card_t *card = dev->card; 294 struct snd_card *card = dev->card;
295 int device = dev->device; 295 int device = dev->device;
296 unsigned int input_count = 0, output_count = 0; 296 unsigned int input_count = 0, output_count = 0;
297 297
@@ -342,7 +342,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
342 } else if (device == 0) 342 } else if (device == 0)
343 set_client_name(client, card, info); /* use the first device's name */ 343 set_client_name(client, card, info); /* use the first device's name */
344 344
345 msynth = kcalloc(ports, sizeof(seq_midisynth_t), GFP_KERNEL); 345 msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL);
346 port = kmalloc(sizeof(*port), GFP_KERNEL); 346 port = kmalloc(sizeof(*port), GFP_KERNEL);
347 if (msynth == NULL || port == NULL) 347 if (msynth == NULL || port == NULL)
348 goto __nomem; 348 goto __nomem;
@@ -432,11 +432,11 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
432 432
433/* release midi synth port */ 433/* release midi synth port */
434static int 434static int
435snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) 435snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
436{ 436{
437 seq_midisynth_client_t *client; 437 struct seq_midisynth_client *client;
438 seq_midisynth_t *msynth; 438 struct seq_midisynth *msynth;
439 snd_card_t *card = dev->card; 439 struct snd_card *card = dev->card;
440 int device = dev->device, p, ports; 440 int device = dev->device, p, ports;
441 441
442 down(&register_mutex); 442 down(&register_mutex);
@@ -465,7 +465,7 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev)
465 465
466static int __init alsa_seq_midi_init(void) 466static int __init alsa_seq_midi_init(void)
467{ 467{
468 static snd_seq_dev_ops_t ops = { 468 static struct snd_seq_dev_ops ops = {
469 snd_seq_midisynth_register_port, 469 snd_seq_midisynth_register_port,
470 snd_seq_midisynth_unregister_port, 470 snd_seq_midisynth_unregister_port,
471 }; 471 };
diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c
index 35fe8a7e34bf..d7c4fb86b9eb 100644
--- a/sound/core/seq/seq_midi_emul.c
+++ b/sound/core/seq/seq_midi_emul.c
@@ -44,17 +44,25 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer MIDI emulation."
44MODULE_LICENSE("GPL"); 44MODULE_LICENSE("GPL");
45 45
46/* Prototypes for static functions */ 46/* Prototypes for static functions */
47static void note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int vel); 47static void note_off(struct snd_midi_op *ops, void *drv,
48static void do_control(snd_midi_op_t *ops, void *private, 48 struct snd_midi_channel *chan,
49 snd_midi_channel_set_t *chset, snd_midi_channel_t *chan, 49 int note, int vel);
50static void do_control(struct snd_midi_op *ops, void *private,
51 struct snd_midi_channel_set *chset,
52 struct snd_midi_channel *chan,
50 int control, int value); 53 int control, int value);
51static void rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 54static void rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
52static void nrpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 55 struct snd_midi_channel_set *chset);
53static void sysex(snd_midi_op_t *ops, void *private, unsigned char *sysex, int len, snd_midi_channel_set_t *chset); 56static void nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
54static void all_sounds_off(snd_midi_op_t *ops, void *private, snd_midi_channel_t *chan); 57 struct snd_midi_channel_set *chset);
55static void all_notes_off(snd_midi_op_t *ops, void *private, snd_midi_channel_t *chan); 58static void sysex(struct snd_midi_op *ops, void *private, unsigned char *sysex,
56static void snd_midi_reset_controllers(snd_midi_channel_t *chan); 59 int len, struct snd_midi_channel_set *chset);
57static void reset_all_channels(snd_midi_channel_set_t *chset); 60static void all_sounds_off(struct snd_midi_op *ops, void *private,
61 struct snd_midi_channel *chan);
62static void all_notes_off(struct snd_midi_op *ops, void *private,
63 struct snd_midi_channel *chan);
64static void snd_midi_reset_controllers(struct snd_midi_channel *chan);
65static void reset_all_channels(struct snd_midi_channel_set *chset);
58 66
59 67
60/* 68/*
@@ -72,10 +80,11 @@ static void reset_all_channels(snd_midi_channel_set_t *chset);
72 * be interpreted. 80 * be interpreted.
73 */ 81 */
74void 82void
75snd_midi_process_event(snd_midi_op_t *ops, 83snd_midi_process_event(struct snd_midi_op *ops,
76 snd_seq_event_t *ev, snd_midi_channel_set_t *chanset) 84 struct snd_seq_event *ev,
85 struct snd_midi_channel_set *chanset)
77{ 86{
78 snd_midi_channel_t *chan; 87 struct snd_midi_channel *chan;
79 void *drv; 88 void *drv;
80 int dest_channel = 0; 89 int dest_channel = 0;
81 90
@@ -89,7 +98,8 @@ snd_midi_process_event(snd_midi_op_t *ops,
89 if (snd_seq_ev_is_channel_type(ev)) { 98 if (snd_seq_ev_is_channel_type(ev)) {
90 dest_channel = ev->data.note.channel; 99 dest_channel = ev->data.note.channel;
91 if (dest_channel >= chanset->max_channels) { 100 if (dest_channel >= chanset->max_channels) {
92 snd_printd("dest channel is %d, max is %d\n", dest_channel, chanset->max_channels); 101 snd_printd("dest channel is %d, max is %d\n",
102 dest_channel, chanset->max_channels);
93 return; 103 return;
94 } 104 }
95 } 105 }
@@ -239,7 +249,8 @@ snd_midi_process_event(snd_midi_op_t *ops,
239 * release note 249 * release note
240 */ 250 */
241static void 251static void
242note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int vel) 252note_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
253 int note, int vel)
243{ 254{
244 if (chan->gm_hold) { 255 if (chan->gm_hold) {
245 /* Hold this note until pedal is turned off */ 256 /* Hold this note until pedal is turned off */
@@ -260,8 +271,8 @@ note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int
260 * events that need to take place immediately to the driver. 271 * events that need to take place immediately to the driver.
261 */ 272 */
262static void 273static void
263do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset, 274do_control(struct snd_midi_op *ops, void *drv, struct snd_midi_channel_set *chset,
264 snd_midi_channel_t *chan, int control, int value) 275 struct snd_midi_channel *chan, int control, int value)
265{ 276{
266 int i; 277 int i;
267 278
@@ -376,7 +387,7 @@ do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset,
376 * initialize the MIDI status 387 * initialize the MIDI status
377 */ 388 */
378void 389void
379snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) 390snd_midi_channel_set_clear(struct snd_midi_channel_set *chset)
380{ 391{
381 int i; 392 int i;
382 393
@@ -384,7 +395,7 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset)
384 chset->gs_master_volume = 127; 395 chset->gs_master_volume = 127;
385 396
386 for (i = 0; i < chset->max_channels; i++) { 397 for (i = 0; i < chset->max_channels; i++) {
387 snd_midi_channel_t *chan = chset->channels + i; 398 struct snd_midi_channel *chan = chset->channels + i;
388 memset(chan->note, 0, sizeof(chan->note)); 399 memset(chan->note, 0, sizeof(chan->note));
389 400
390 chan->midi_aftertouch = 0; 401 chan->midi_aftertouch = 0;
@@ -407,8 +418,8 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset)
407 * Process a rpn message. 418 * Process a rpn message.
408 */ 419 */
409static void 420static void
410rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, 421rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
411 snd_midi_channel_set_t *chset) 422 struct snd_midi_channel_set *chset)
412{ 423{
413 int type; 424 int type;
414 int val; 425 int val;
@@ -447,8 +458,8 @@ rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan,
447 * Process an nrpn message. 458 * Process an nrpn message.
448 */ 459 */
449static void 460static void
450nrpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, 461nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
451 snd_midi_channel_set_t *chset) 462 struct snd_midi_channel_set *chset)
452{ 463{
453 /* parse XG NRPNs here if possible */ 464 /* parse XG NRPNs here if possible */
454 if (ops->nrpn) 465 if (ops->nrpn)
@@ -475,7 +486,8 @@ get_channel(unsigned char cmd)
475 * Process a sysex message. 486 * Process a sysex message.
476 */ 487 */
477static void 488static void
478sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_channel_set_t *chset) 489sysex(struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
490 struct snd_midi_channel_set *chset)
479{ 491{
480 /* GM on */ 492 /* GM on */
481 static unsigned char gm_on_macro[] = { 493 static unsigned char gm_on_macro[] = {
@@ -588,7 +600,7 @@ sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_c
588 * all sound off 600 * all sound off
589 */ 601 */
590static void 602static void
591all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) 603all_sounds_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
592{ 604{
593 int n; 605 int n;
594 606
@@ -606,7 +618,7 @@ all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan)
606 * all notes off 618 * all notes off
607 */ 619 */
608static void 620static void
609all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) 621all_notes_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
610{ 622{
611 int n; 623 int n;
612 624
@@ -621,12 +633,12 @@ all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan)
621/* 633/*
622 * Initialise a single midi channel control block. 634 * Initialise a single midi channel control block.
623 */ 635 */
624static void snd_midi_channel_init(snd_midi_channel_t *p, int n) 636static void snd_midi_channel_init(struct snd_midi_channel *p, int n)
625{ 637{
626 if (p == NULL) 638 if (p == NULL)
627 return; 639 return;
628 640
629 memset(p, 0, sizeof(snd_midi_channel_t)); 641 memset(p, 0, sizeof(struct snd_midi_channel));
630 p->private = NULL; 642 p->private = NULL;
631 p->number = n; 643 p->number = n;
632 644
@@ -642,12 +654,12 @@ static void snd_midi_channel_init(snd_midi_channel_t *p, int n)
642/* 654/*
643 * Allocate and initialise a set of midi channel control blocks. 655 * Allocate and initialise a set of midi channel control blocks.
644 */ 656 */
645static snd_midi_channel_t *snd_midi_channel_init_set(int n) 657static struct snd_midi_channel *snd_midi_channel_init_set(int n)
646{ 658{
647 snd_midi_channel_t *chan; 659 struct snd_midi_channel *chan;
648 int i; 660 int i;
649 661
650 chan = kmalloc(n * sizeof(snd_midi_channel_t), GFP_KERNEL); 662 chan = kmalloc(n * sizeof(struct snd_midi_channel), GFP_KERNEL);
651 if (chan) { 663 if (chan) {
652 for (i = 0; i < n; i++) 664 for (i = 0; i < n; i++)
653 snd_midi_channel_init(chan+i, i); 665 snd_midi_channel_init(chan+i, i);
@@ -660,11 +672,11 @@ static snd_midi_channel_t *snd_midi_channel_init_set(int n)
660 * reset all midi channels 672 * reset all midi channels
661 */ 673 */
662static void 674static void
663reset_all_channels(snd_midi_channel_set_t *chset) 675reset_all_channels(struct snd_midi_channel_set *chset)
664{ 676{
665 int ch; 677 int ch;
666 for (ch = 0; ch < chset->max_channels; ch++) { 678 for (ch = 0; ch < chset->max_channels; ch++) {
667 snd_midi_channel_t *chan = chset->channels + ch; 679 struct snd_midi_channel *chan = chset->channels + ch;
668 snd_midi_reset_controllers(chan); 680 snd_midi_reset_controllers(chan);
669 chan->gm_rpn_pitch_bend_range = 256; /* 2 semitones */ 681 chan->gm_rpn_pitch_bend_range = 256; /* 2 semitones */
670 chan->gm_rpn_fine_tuning = 0; 682 chan->gm_rpn_fine_tuning = 0;
@@ -681,9 +693,9 @@ reset_all_channels(snd_midi_channel_set_t *chset)
681/* 693/*
682 * Allocate and initialise a midi channel set. 694 * Allocate and initialise a midi channel set.
683 */ 695 */
684snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n) 696struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n)
685{ 697{
686 snd_midi_channel_set_t *chset; 698 struct snd_midi_channel_set *chset;
687 699
688 chset = kmalloc(sizeof(*chset), GFP_KERNEL); 700 chset = kmalloc(sizeof(*chset), GFP_KERNEL);
689 if (chset) { 701 if (chset) {
@@ -697,7 +709,7 @@ snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n)
697/* 709/*
698 * Reset the midi controllers on a particular channel to default values. 710 * Reset the midi controllers on a particular channel to default values.
699 */ 711 */
700static void snd_midi_reset_controllers(snd_midi_channel_t *chan) 712static void snd_midi_reset_controllers(struct snd_midi_channel *chan)
701{ 713{
702 memset(chan->control, 0, sizeof(chan->control)); 714 memset(chan->control, 0, sizeof(chan->control));
703 chan->gm_volume = 127; 715 chan->gm_volume = 127;
@@ -709,7 +721,7 @@ static void snd_midi_reset_controllers(snd_midi_channel_t *chan)
709/* 721/*
710 * Free a midi channel set. 722 * Free a midi channel set.
711 */ 723 */
712void snd_midi_channel_free_set(snd_midi_channel_set_t *chset) 724void snd_midi_channel_free_set(struct snd_midi_channel_set *chset)
713{ 725{
714 if (chset == NULL) 726 if (chset == NULL)
715 return; 727 return;
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
index 2dc1aecfb426..5ff80b776906 100644
--- a/sound/core/seq/seq_midi_event.c
+++ b/sound/core/seq/seq_midi_event.c
@@ -41,33 +41,29 @@ MODULE_LICENSE("GPL");
41/* from 8 to 15 are events for 0xf0-0xf7 */ 41/* from 8 to 15 are events for 0xf0-0xf7 */
42 42
43 43
44/* status event types */
45typedef void (*event_encode_t)(snd_midi_event_t *dev, snd_seq_event_t *ev);
46typedef void (*event_decode_t)(snd_seq_event_t *ev, unsigned char *buf);
47
48/* 44/*
49 * prototypes 45 * prototypes
50 */ 46 */
51static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev); 47static void note_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
52static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev); 48static void one_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
53static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev); 49static void pitchbend_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
54static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev); 50static void two_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
55static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev); 51static void one_param_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
56static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev); 52static void songpos_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
57static void note_decode(snd_seq_event_t *ev, unsigned char *buf); 53static void note_decode(struct snd_seq_event *ev, unsigned char *buf);
58static void one_param_decode(snd_seq_event_t *ev, unsigned char *buf); 54static void one_param_decode(struct snd_seq_event *ev, unsigned char *buf);
59static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf); 55static void pitchbend_decode(struct snd_seq_event *ev, unsigned char *buf);
60static void two_param_decode(snd_seq_event_t *ev, unsigned char *buf); 56static void two_param_decode(struct snd_seq_event *ev, unsigned char *buf);
61static void songpos_decode(snd_seq_event_t *ev, unsigned char *buf); 57static void songpos_decode(struct snd_seq_event *ev, unsigned char *buf);
62 58
63/* 59/*
64 * event list 60 * event list
65 */ 61 */
66static struct status_event_list_t { 62static struct status_event_list {
67 int event; 63 int event;
68 int qlen; 64 int qlen;
69 event_encode_t encode; 65 void (*encode)(struct snd_midi_event *dev, struct snd_seq_event *ev);
70 event_decode_t decode; 66 void (*decode)(struct snd_seq_event *ev, unsigned char *buf);
71} status_event[] = { 67} status_event[] = {
72 /* 0x80 - 0xf0 */ 68 /* 0x80 - 0xf0 */
73 {SNDRV_SEQ_EVENT_NOTEOFF, 2, note_event, note_decode}, 69 {SNDRV_SEQ_EVENT_NOTEOFF, 2, note_event, note_decode},
@@ -97,12 +93,15 @@ static struct status_event_list_t {
97 {SNDRV_SEQ_EVENT_RESET, 0, NULL, NULL}, /* 0xff */ 93 {SNDRV_SEQ_EVENT_RESET, 0, NULL, NULL}, /* 0xff */
98}; 94};
99 95
100static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int len, snd_seq_event_t *ev); 96static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf, int len,
101static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, snd_seq_event_t *ev); 97 struct snd_seq_event *ev);
98static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf, int count,
99 struct snd_seq_event *ev);
102 100
103static struct extra_event_list_t { 101static struct extra_event_list {
104 int event; 102 int event;
105 int (*decode)(snd_midi_event_t *dev, unsigned char *buf, int len, snd_seq_event_t *ev); 103 int (*decode)(struct snd_midi_event *dev, unsigned char *buf, int len,
104 struct snd_seq_event *ev);
106} extra_event[] = { 105} extra_event[] = {
107 {SNDRV_SEQ_EVENT_CONTROL14, extra_decode_ctrl14}, 106 {SNDRV_SEQ_EVENT_CONTROL14, extra_decode_ctrl14},
108 {SNDRV_SEQ_EVENT_NONREGPARAM, extra_decode_xrpn}, 107 {SNDRV_SEQ_EVENT_NONREGPARAM, extra_decode_xrpn},
@@ -113,9 +112,9 @@ static struct extra_event_list_t {
113 * new/delete record 112 * new/delete record
114 */ 113 */
115 114
116int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev) 115int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev)
117{ 116{
118 snd_midi_event_t *dev; 117 struct snd_midi_event *dev;
119 118
120 *rdev = NULL; 119 *rdev = NULL;
121 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 120 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -135,7 +134,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev)
135 return 0; 134 return 0;
136} 135}
137 136
138void snd_midi_event_free(snd_midi_event_t *dev) 137void snd_midi_event_free(struct snd_midi_event *dev)
139{ 138{
140 if (dev != NULL) { 139 if (dev != NULL) {
141 kfree(dev->buf); 140 kfree(dev->buf);
@@ -146,14 +145,14 @@ void snd_midi_event_free(snd_midi_event_t *dev)
146/* 145/*
147 * initialize record 146 * initialize record
148 */ 147 */
149static inline void reset_encode(snd_midi_event_t *dev) 148static inline void reset_encode(struct snd_midi_event *dev)
150{ 149{
151 dev->read = 0; 150 dev->read = 0;
152 dev->qlen = 0; 151 dev->qlen = 0;
153 dev->type = 0; 152 dev->type = 0;
154} 153}
155 154
156void snd_midi_event_reset_encode(snd_midi_event_t *dev) 155void snd_midi_event_reset_encode(struct snd_midi_event *dev)
157{ 156{
158 unsigned long flags; 157 unsigned long flags;
159 158
@@ -162,7 +161,7 @@ void snd_midi_event_reset_encode(snd_midi_event_t *dev)
162 spin_unlock_irqrestore(&dev->lock, flags); 161 spin_unlock_irqrestore(&dev->lock, flags);
163} 162}
164 163
165void snd_midi_event_reset_decode(snd_midi_event_t *dev) 164void snd_midi_event_reset_decode(struct snd_midi_event *dev)
166{ 165{
167 unsigned long flags; 166 unsigned long flags;
168 167
@@ -172,14 +171,14 @@ void snd_midi_event_reset_decode(snd_midi_event_t *dev)
172} 171}
173 172
174#if 0 173#if 0
175void snd_midi_event_init(snd_midi_event_t *dev) 174void snd_midi_event_init(struct snd_midi_event *dev)
176{ 175{
177 snd_midi_event_reset_encode(dev); 176 snd_midi_event_reset_encode(dev);
178 snd_midi_event_reset_decode(dev); 177 snd_midi_event_reset_decode(dev);
179} 178}
180#endif /* 0 */ 179#endif /* 0 */
181 180
182void snd_midi_event_no_status(snd_midi_event_t *dev, int on) 181void snd_midi_event_no_status(struct snd_midi_event *dev, int on)
183{ 182{
184 dev->nostat = on ? 1 : 0; 183 dev->nostat = on ? 1 : 0;
185} 184}
@@ -188,7 +187,7 @@ void snd_midi_event_no_status(snd_midi_event_t *dev, int on)
188 * resize buffer 187 * resize buffer
189 */ 188 */
190#if 0 189#if 0
191int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize) 190int snd_midi_event_resize_buffer(struct snd_midi_event *dev, int bufsize)
192{ 191{
193 unsigned char *new_buf, *old_buf; 192 unsigned char *new_buf, *old_buf;
194 unsigned long flags; 193 unsigned long flags;
@@ -213,7 +212,8 @@ int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize)
213 * read bytes and encode to sequencer event if finished 212 * read bytes and encode to sequencer event if finished
214 * return the size of encoded bytes 213 * return the size of encoded bytes
215 */ 214 */
216long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev) 215long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
216 struct snd_seq_event *ev)
217{ 217{
218 long result = 0; 218 long result = 0;
219 int rc; 219 int rc;
@@ -238,7 +238,8 @@ long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count
238 * 0 data is not finished 238 * 0 data is not finished
239 * negative for error 239 * negative for error
240 */ 240 */
241int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev) 241int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c,
242 struct snd_seq_event *ev)
242{ 243{
243 int rc = 0; 244 int rc = 0;
244 unsigned long flags; 245 unsigned long flags;
@@ -303,7 +304,7 @@ int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev
303} 304}
304 305
305/* encode note event */ 306/* encode note event */
306static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev) 307static void note_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
307{ 308{
308 ev->data.note.channel = dev->buf[0] & 0x0f; 309 ev->data.note.channel = dev->buf[0] & 0x0f;
309 ev->data.note.note = dev->buf[1]; 310 ev->data.note.note = dev->buf[1];
@@ -311,21 +312,21 @@ static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
311} 312}
312 313
313/* encode one parameter controls */ 314/* encode one parameter controls */
314static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev) 315static void one_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
315{ 316{
316 ev->data.control.channel = dev->buf[0] & 0x0f; 317 ev->data.control.channel = dev->buf[0] & 0x0f;
317 ev->data.control.value = dev->buf[1]; 318 ev->data.control.value = dev->buf[1];
318} 319}
319 320
320/* encode pitch wheel change */ 321/* encode pitch wheel change */
321static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev) 322static void pitchbend_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
322{ 323{
323 ev->data.control.channel = dev->buf[0] & 0x0f; 324 ev->data.control.channel = dev->buf[0] & 0x0f;
324 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192; 325 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192;
325} 326}
326 327
327/* encode midi control change */ 328/* encode midi control change */
328static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev) 329static void two_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
329{ 330{
330 ev->data.control.channel = dev->buf[0] & 0x0f; 331 ev->data.control.channel = dev->buf[0] & 0x0f;
331 ev->data.control.param = dev->buf[1]; 332 ev->data.control.param = dev->buf[1];
@@ -333,13 +334,13 @@ static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
333} 334}
334 335
335/* encode one parameter value*/ 336/* encode one parameter value*/
336static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev) 337static void one_param_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
337{ 338{
338 ev->data.control.value = dev->buf[1]; 339 ev->data.control.value = dev->buf[1];
339} 340}
340 341
341/* encode song position */ 342/* encode song position */
342static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev) 343static void songpos_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
343{ 344{
344 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1]; 345 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1];
345} 346}
@@ -348,7 +349,8 @@ static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
348 * decode from a sequencer event to midi bytes 349 * decode from a sequencer event to midi bytes
349 * return the size of decoded midi events 350 * return the size of decoded midi events
350 */ 351 */
351long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev) 352long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
353 struct snd_seq_event *ev)
352{ 354{
353 unsigned int cmd, type; 355 unsigned int cmd, type;
354 356
@@ -404,20 +406,20 @@ long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count
404 406
405 407
406/* decode note event */ 408/* decode note event */
407static void note_decode(snd_seq_event_t *ev, unsigned char *buf) 409static void note_decode(struct snd_seq_event *ev, unsigned char *buf)
408{ 410{
409 buf[0] = ev->data.note.note & 0x7f; 411 buf[0] = ev->data.note.note & 0x7f;
410 buf[1] = ev->data.note.velocity & 0x7f; 412 buf[1] = ev->data.note.velocity & 0x7f;
411} 413}
412 414
413/* decode one parameter controls */ 415/* decode one parameter controls */
414static void one_param_decode(snd_seq_event_t *ev, unsigned char *buf) 416static void one_param_decode(struct snd_seq_event *ev, unsigned char *buf)
415{ 417{
416 buf[0] = ev->data.control.value & 0x7f; 418 buf[0] = ev->data.control.value & 0x7f;
417} 419}
418 420
419/* decode pitch wheel change */ 421/* decode pitch wheel change */
420static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf) 422static void pitchbend_decode(struct snd_seq_event *ev, unsigned char *buf)
421{ 423{
422 int value = ev->data.control.value + 8192; 424 int value = ev->data.control.value + 8192;
423 buf[0] = value & 0x7f; 425 buf[0] = value & 0x7f;
@@ -425,21 +427,22 @@ static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf)
425} 427}
426 428
427/* decode midi control change */ 429/* decode midi control change */
428static void two_param_decode(snd_seq_event_t *ev, unsigned char *buf) 430static void two_param_decode(struct snd_seq_event *ev, unsigned char *buf)
429{ 431{
430 buf[0] = ev->data.control.param & 0x7f; 432 buf[0] = ev->data.control.param & 0x7f;
431 buf[1] = ev->data.control.value & 0x7f; 433 buf[1] = ev->data.control.value & 0x7f;
432} 434}
433 435
434/* decode song position */ 436/* decode song position */
435static void songpos_decode(snd_seq_event_t *ev, unsigned char *buf) 437static void songpos_decode(struct snd_seq_event *ev, unsigned char *buf)
436{ 438{
437 buf[0] = ev->data.control.value & 0x7f; 439 buf[0] = ev->data.control.value & 0x7f;
438 buf[1] = (ev->data.control.value >> 7) & 0x7f; 440 buf[1] = (ev->data.control.value >> 7) & 0x7f;
439} 441}
440 442
441/* decode 14bit control */ 443/* decode 14bit control */
442static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int count, snd_seq_event_t *ev) 444static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf,
445 int count, struct snd_seq_event *ev)
443{ 446{
444 unsigned char cmd; 447 unsigned char cmd;
445 int idx = 0; 448 int idx = 0;
@@ -476,7 +479,8 @@ static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int co
476} 479}
477 480
478/* decode reg/nonreg param */ 481/* decode reg/nonreg param */
479static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, snd_seq_event_t *ev) 482static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
483 int count, struct snd_seq_event *ev)
480{ 484{
481 unsigned char cmd; 485 unsigned char cmd;
482 char *cbytes; 486 char *cbytes;
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index 57ec31df0d15..2b384fd7967f 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -56,16 +56,17 @@ much elements are in array.
56*/ 56*/
57 57
58/* return pointer to port structure - port is locked if found */ 58/* return pointer to port structure - port is locked if found */
59client_port_t *snd_seq_port_use_ptr(client_t *client, int num) 59struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client,
60 int num)
60{ 61{
61 struct list_head *p; 62 struct list_head *p;
62 client_port_t *port; 63 struct snd_seq_client_port *port;
63 64
64 if (client == NULL) 65 if (client == NULL)
65 return NULL; 66 return NULL;
66 read_lock(&client->ports_lock); 67 read_lock(&client->ports_lock);
67 list_for_each(p, &client->ports_list_head) { 68 list_for_each(p, &client->ports_list_head) {
68 port = list_entry(p, client_port_t, list); 69 port = list_entry(p, struct snd_seq_client_port, list);
69 if (port->addr.port == num) { 70 if (port->addr.port == num) {
70 if (port->closing) 71 if (port->closing)
71 break; /* deleting now */ 72 break; /* deleting now */
@@ -80,17 +81,18 @@ client_port_t *snd_seq_port_use_ptr(client_t *client, int num)
80 81
81 82
82/* search for the next port - port is locked if found */ 83/* search for the next port - port is locked if found */
83client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t *pinfo) 84struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *client,
85 struct snd_seq_port_info *pinfo)
84{ 86{
85 int num; 87 int num;
86 struct list_head *p; 88 struct list_head *p;
87 client_port_t *port, *found; 89 struct snd_seq_client_port *port, *found;
88 90
89 num = pinfo->addr.port; 91 num = pinfo->addr.port;
90 found = NULL; 92 found = NULL;
91 read_lock(&client->ports_lock); 93 read_lock(&client->ports_lock);
92 list_for_each(p, &client->ports_list_head) { 94 list_for_each(p, &client->ports_list_head) {
93 port = list_entry(p, client_port_t, list); 95 port = list_entry(p, struct snd_seq_client_port, list);
94 if (port->addr.port < num) 96 if (port->addr.port < num)
95 continue; 97 continue;
96 if (port->addr.port == num) { 98 if (port->addr.port == num) {
@@ -111,8 +113,8 @@ client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t
111} 113}
112 114
113 115
114/* initialize port_subs_info_t */ 116/* initialize snd_seq_port_subs_info */
115static void port_subs_info_init(port_subs_info_t *grp) 117static void port_subs_info_init(struct snd_seq_port_subs_info *grp)
116{ 118{
117 INIT_LIST_HEAD(&grp->list_head); 119 INIT_LIST_HEAD(&grp->list_head);
118 grp->count = 0; 120 grp->count = 0;
@@ -125,10 +127,11 @@ static void port_subs_info_init(port_subs_info_t *grp)
125 127
126 128
127/* create a port, port number is returned (-1 on failure) */ 129/* create a port, port number is returned (-1 on failure) */
128client_port_t *snd_seq_create_port(client_t *client, int port) 130struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
131 int port)
129{ 132{
130 unsigned long flags; 133 unsigned long flags;
131 client_port_t *new_port; 134 struct snd_seq_client_port *new_port;
132 struct list_head *l; 135 struct list_head *l;
133 int num = -1; 136 int num = -1;
134 137
@@ -159,7 +162,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port)
159 down(&client->ports_mutex); 162 down(&client->ports_mutex);
160 write_lock_irqsave(&client->ports_lock, flags); 163 write_lock_irqsave(&client->ports_lock, flags);
161 list_for_each(l, &client->ports_list_head) { 164 list_for_each(l, &client->ports_list_head) {
162 client_port_t *p = list_entry(l, client_port_t, list); 165 struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
163 if (p->addr.port > num) 166 if (p->addr.port > num)
164 break; 167 break;
165 if (port < 0) /* auto-probe mode */ 168 if (port < 0) /* auto-probe mode */
@@ -177,17 +180,24 @@ client_port_t *snd_seq_create_port(client_t *client, int port)
177} 180}
178 181
179/* */ 182/* */
180enum group_type_t { 183enum group_type {
181 SRC_LIST, DEST_LIST 184 SRC_LIST, DEST_LIST
182}; 185};
183 186
184static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_t *grp, snd_seq_port_subscribe_t *info, int send_ack); 187static int subscribe_port(struct snd_seq_client *client,
185static int unsubscribe_port(client_t *client, client_port_t *port, port_subs_info_t *grp, snd_seq_port_subscribe_t *info, int send_ack); 188 struct snd_seq_client_port *port,
189 struct snd_seq_port_subs_info *grp,
190 struct snd_seq_port_subscribe *info, int send_ack);
191static int unsubscribe_port(struct snd_seq_client *client,
192 struct snd_seq_client_port *port,
193 struct snd_seq_port_subs_info *grp,
194 struct snd_seq_port_subscribe *info, int send_ack);
186 195
187 196
188static client_port_t *get_client_port(snd_seq_addr_t *addr, client_t **cp) 197static struct snd_seq_client_port *get_client_port(struct snd_seq_addr *addr,
198 struct snd_seq_client **cp)
189{ 199{
190 client_port_t *p; 200 struct snd_seq_client_port *p;
191 *cp = snd_seq_client_use_ptr(addr->client); 201 *cp = snd_seq_client_use_ptr(addr->client);
192 if (*cp) { 202 if (*cp) {
193 p = snd_seq_port_use_ptr(*cp, addr->port); 203 p = snd_seq_port_use_ptr(*cp, addr->port);
@@ -204,22 +214,24 @@ static client_port_t *get_client_port(snd_seq_addr_t *addr, client_t **cp)
204 * remove all subscribers on the list 214 * remove all subscribers on the list
205 * this is called from port_delete, for each src and dest list. 215 * this is called from port_delete, for each src and dest list.
206 */ 216 */
207static void clear_subscriber_list(client_t *client, client_port_t *port, 217static void clear_subscriber_list(struct snd_seq_client *client,
208 port_subs_info_t *grp, int grptype) 218 struct snd_seq_client_port *port,
219 struct snd_seq_port_subs_info *grp,
220 int grptype)
209{ 221{
210 struct list_head *p, *n; 222 struct list_head *p, *n;
211 223
212 down_write(&grp->list_mutex); 224 down_write(&grp->list_mutex);
213 list_for_each_safe(p, n, &grp->list_head) { 225 list_for_each_safe(p, n, &grp->list_head) {
214 subscribers_t *subs; 226 struct snd_seq_subscribers *subs;
215 client_t *c; 227 struct snd_seq_client *c;
216 client_port_t *aport; 228 struct snd_seq_client_port *aport;
217 229
218 if (grptype == SRC_LIST) { 230 if (grptype == SRC_LIST) {
219 subs = list_entry(p, subscribers_t, src_list); 231 subs = list_entry(p, struct snd_seq_subscribers, src_list);
220 aport = get_client_port(&subs->info.dest, &c); 232 aport = get_client_port(&subs->info.dest, &c);
221 } else { 233 } else {
222 subs = list_entry(p, subscribers_t, dest_list); 234 subs = list_entry(p, struct snd_seq_subscribers, dest_list);
223 aport = get_client_port(&subs->info.sender, &c); 235 aport = get_client_port(&subs->info.sender, &c);
224 } 236 }
225 list_del(p); 237 list_del(p);
@@ -233,7 +245,7 @@ static void clear_subscriber_list(client_t *client, client_port_t *port,
233 kfree(subs); 245 kfree(subs);
234 } else { 246 } else {
235 /* ok we got the connected port */ 247 /* ok we got the connected port */
236 port_subs_info_t *agrp; 248 struct snd_seq_port_subs_info *agrp;
237 agrp = (grptype == SRC_LIST) ? &aport->c_dest : &aport->c_src; 249 agrp = (grptype == SRC_LIST) ? &aport->c_dest : &aport->c_src;
238 down_write(&agrp->list_mutex); 250 down_write(&agrp->list_mutex);
239 if (grptype == SRC_LIST) 251 if (grptype == SRC_LIST)
@@ -251,7 +263,8 @@ static void clear_subscriber_list(client_t *client, client_port_t *port,
251} 263}
252 264
253/* delete port data */ 265/* delete port data */
254static int port_delete(client_t *client, client_port_t *port) 266static int port_delete(struct snd_seq_client *client,
267 struct snd_seq_client_port *port)
255{ 268{
256 /* set closing flag and wait for all port access are gone */ 269 /* set closing flag and wait for all port access are gone */
257 port->closing = 1; 270 port->closing = 1;
@@ -273,16 +286,16 @@ static int port_delete(client_t *client, client_port_t *port)
273 286
274 287
275/* delete a port with the given port id */ 288/* delete a port with the given port id */
276int snd_seq_delete_port(client_t *client, int port) 289int snd_seq_delete_port(struct snd_seq_client *client, int port)
277{ 290{
278 unsigned long flags; 291 unsigned long flags;
279 struct list_head *l; 292 struct list_head *l;
280 client_port_t *found = NULL; 293 struct snd_seq_client_port *found = NULL;
281 294
282 down(&client->ports_mutex); 295 down(&client->ports_mutex);
283 write_lock_irqsave(&client->ports_lock, flags); 296 write_lock_irqsave(&client->ports_lock, flags);
284 list_for_each(l, &client->ports_list_head) { 297 list_for_each(l, &client->ports_list_head) {
285 client_port_t *p = list_entry(l, client_port_t, list); 298 struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
286 if (p->addr.port == port) { 299 if (p->addr.port == port) {
287 /* ok found. delete from the list at first */ 300 /* ok found. delete from the list at first */
288 list_del(l); 301 list_del(l);
@@ -300,7 +313,7 @@ int snd_seq_delete_port(client_t *client, int port)
300} 313}
301 314
302/* delete the all ports belonging to the given client */ 315/* delete the all ports belonging to the given client */
303int snd_seq_delete_all_ports(client_t *client) 316int snd_seq_delete_all_ports(struct snd_seq_client *client)
304{ 317{
305 unsigned long flags; 318 unsigned long flags;
306 struct list_head deleted_list, *p, *n; 319 struct list_head deleted_list, *p, *n;
@@ -323,7 +336,7 @@ int snd_seq_delete_all_ports(client_t *client)
323 336
324 /* remove each port in deleted_list */ 337 /* remove each port in deleted_list */
325 list_for_each_safe(p, n, &deleted_list) { 338 list_for_each_safe(p, n, &deleted_list) {
326 client_port_t *port = list_entry(p, client_port_t, list); 339 struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list);
327 list_del(p); 340 list_del(p);
328 snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port); 341 snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port);
329 port_delete(client, port); 342 port_delete(client, port);
@@ -333,7 +346,8 @@ int snd_seq_delete_all_ports(client_t *client)
333} 346}
334 347
335/* set port info fields */ 348/* set port info fields */
336int snd_seq_set_port_info(client_port_t * port, snd_seq_port_info_t * info) 349int snd_seq_set_port_info(struct snd_seq_client_port * port,
350 struct snd_seq_port_info * info)
337{ 351{
338 snd_assert(port && info, return -EINVAL); 352 snd_assert(port && info, return -EINVAL);
339 353
@@ -361,7 +375,8 @@ int snd_seq_set_port_info(client_port_t * port, snd_seq_port_info_t * info)
361} 375}
362 376
363/* get port info fields */ 377/* get port info fields */
364int snd_seq_get_port_info(client_port_t * port, snd_seq_port_info_t * info) 378int snd_seq_get_port_info(struct snd_seq_client_port * port,
379 struct snd_seq_port_info * info)
365{ 380{
366 snd_assert(port && info, return -EINVAL); 381 snd_assert(port && info, return -EINVAL);
367 382
@@ -410,8 +425,11 @@ int snd_seq_get_port_info(client_port_t * port, snd_seq_port_info_t * info)
410 * at each connnection/disconnection. 425 * at each connnection/disconnection.
411 */ 426 */
412 427
413static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_t *grp, 428static int subscribe_port(struct snd_seq_client *client,
414 snd_seq_port_subscribe_t *info, int send_ack) 429 struct snd_seq_client_port *port,
430 struct snd_seq_port_subs_info *grp,
431 struct snd_seq_port_subscribe *info,
432 int send_ack)
415{ 433{
416 int err = 0; 434 int err = 0;
417 435
@@ -432,9 +450,11 @@ static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_
432 return err; 450 return err;
433} 451}
434 452
435static int unsubscribe_port(client_t *client, client_port_t *port, 453static int unsubscribe_port(struct snd_seq_client *client,
436 port_subs_info_t *grp, 454 struct snd_seq_client_port *port,
437 snd_seq_port_subscribe_t *info, int send_ack) 455 struct snd_seq_port_subs_info *grp,
456 struct snd_seq_port_subscribe *info,
457 int send_ack)
438{ 458{
439 int err = 0; 459 int err = 0;
440 460
@@ -453,15 +473,15 @@ static int unsubscribe_port(client_t *client, client_port_t *port,
453 473
454 474
455/* check if both addresses are identical */ 475/* check if both addresses are identical */
456static inline int addr_match(snd_seq_addr_t *r, snd_seq_addr_t *s) 476static inline int addr_match(struct snd_seq_addr *r, struct snd_seq_addr *s)
457{ 477{
458 return (r->client == s->client) && (r->port == s->port); 478 return (r->client == s->client) && (r->port == s->port);
459} 479}
460 480
461/* check the two subscribe info match */ 481/* check the two subscribe info match */
462/* if flags is zero, checks only sender and destination addresses */ 482/* if flags is zero, checks only sender and destination addresses */
463static int match_subs_info(snd_seq_port_subscribe_t *r, 483static int match_subs_info(struct snd_seq_port_subscribe *r,
464 snd_seq_port_subscribe_t *s) 484 struct snd_seq_port_subscribe *s)
465{ 485{
466 if (addr_match(&r->sender, &s->sender) && 486 if (addr_match(&r->sender, &s->sender) &&
467 addr_match(&r->dest, &s->dest)) { 487 addr_match(&r->dest, &s->dest)) {
@@ -475,14 +495,16 @@ static int match_subs_info(snd_seq_port_subscribe_t *r,
475 495
476 496
477/* connect two ports */ 497/* connect two ports */
478int snd_seq_port_connect(client_t *connector, 498int snd_seq_port_connect(struct snd_seq_client *connector,
479 client_t *src_client, client_port_t *src_port, 499 struct snd_seq_client *src_client,
480 client_t *dest_client, client_port_t *dest_port, 500 struct snd_seq_client_port *src_port,
481 snd_seq_port_subscribe_t *info) 501 struct snd_seq_client *dest_client,
502 struct snd_seq_client_port *dest_port,
503 struct snd_seq_port_subscribe *info)
482{ 504{
483 port_subs_info_t *src = &src_port->c_src; 505 struct snd_seq_port_subs_info *src = &src_port->c_src;
484 port_subs_info_t *dest = &dest_port->c_dest; 506 struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
485 subscribers_t *subs; 507 struct snd_seq_subscribers *subs;
486 struct list_head *p; 508 struct list_head *p;
487 int err, src_called = 0; 509 int err, src_called = 0;
488 unsigned long flags; 510 unsigned long flags;
@@ -508,12 +530,12 @@ int snd_seq_port_connect(client_t *connector,
508 goto __error; 530 goto __error;
509 /* check whether already exists */ 531 /* check whether already exists */
510 list_for_each(p, &src->list_head) { 532 list_for_each(p, &src->list_head) {
511 subscribers_t *s = list_entry(p, subscribers_t, src_list); 533 struct snd_seq_subscribers *s = list_entry(p, struct snd_seq_subscribers, src_list);
512 if (match_subs_info(info, &s->info)) 534 if (match_subs_info(info, &s->info))
513 goto __error; 535 goto __error;
514 } 536 }
515 list_for_each(p, &dest->list_head) { 537 list_for_each(p, &dest->list_head) {
516 subscribers_t *s = list_entry(p, subscribers_t, dest_list); 538 struct snd_seq_subscribers *s = list_entry(p, struct snd_seq_subscribers, dest_list);
517 if (match_subs_info(info, &s->info)) 539 if (match_subs_info(info, &s->info))
518 goto __error; 540 goto __error;
519 } 541 }
@@ -554,14 +576,16 @@ int snd_seq_port_connect(client_t *connector,
554 576
555 577
556/* remove the connection */ 578/* remove the connection */
557int snd_seq_port_disconnect(client_t *connector, 579int snd_seq_port_disconnect(struct snd_seq_client *connector,
558 client_t *src_client, client_port_t *src_port, 580 struct snd_seq_client *src_client,
559 client_t *dest_client, client_port_t *dest_port, 581 struct snd_seq_client_port *src_port,
560 snd_seq_port_subscribe_t *info) 582 struct snd_seq_client *dest_client,
583 struct snd_seq_client_port *dest_port,
584 struct snd_seq_port_subscribe *info)
561{ 585{
562 port_subs_info_t *src = &src_port->c_src; 586 struct snd_seq_port_subs_info *src = &src_port->c_src;
563 port_subs_info_t *dest = &dest_port->c_dest; 587 struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
564 subscribers_t *subs; 588 struct snd_seq_subscribers *subs;
565 struct list_head *p; 589 struct list_head *p;
566 int err = -ENOENT; 590 int err = -ENOENT;
567 unsigned long flags; 591 unsigned long flags;
@@ -571,7 +595,7 @@ int snd_seq_port_disconnect(client_t *connector,
571 595
572 /* look for the connection */ 596 /* look for the connection */
573 list_for_each(p, &src->list_head) { 597 list_for_each(p, &src->list_head) {
574 subs = list_entry(p, subscribers_t, src_list); 598 subs = list_entry(p, struct snd_seq_subscribers, src_list);
575 if (match_subs_info(info, &subs->info)) { 599 if (match_subs_info(info, &subs->info)) {
576 write_lock_irqsave(&src->list_lock, flags); 600 write_lock_irqsave(&src->list_lock, flags);
577 // write_lock(&dest->list_lock); // no lock yet 601 // write_lock(&dest->list_lock); // no lock yet
@@ -597,15 +621,15 @@ int snd_seq_port_disconnect(client_t *connector,
597 621
598 622
599/* get matched subscriber */ 623/* get matched subscriber */
600subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp, 624struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp,
601 snd_seq_addr_t *dest_addr) 625 struct snd_seq_addr *dest_addr)
602{ 626{
603 struct list_head *p; 627 struct list_head *p;
604 subscribers_t *s, *found = NULL; 628 struct snd_seq_subscribers *s, *found = NULL;
605 629
606 down_read(&src_grp->list_mutex); 630 down_read(&src_grp->list_mutex);
607 list_for_each(p, &src_grp->list_head) { 631 list_for_each(p, &src_grp->list_head) {
608 s = list_entry(p, subscribers_t, src_list); 632 s = list_entry(p, struct snd_seq_subscribers, src_list);
609 if (addr_match(dest_addr, &s->info.dest)) { 633 if (addr_match(dest_addr, &s->info.dest)) {
610 found = s; 634 found = s;
611 break; 635 break;
@@ -623,11 +647,11 @@ subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp,
623 */ 647 */
624/* exported */ 648/* exported */
625int snd_seq_event_port_attach(int client, 649int snd_seq_event_port_attach(int client,
626 snd_seq_port_callback_t *pcbp, 650 struct snd_seq_port_callback *pcbp,
627 int cap, int type, int midi_channels, 651 int cap, int type, int midi_channels,
628 int midi_voices, char *portname) 652 int midi_voices, char *portname)
629{ 653{
630 snd_seq_port_info_t portinfo; 654 struct snd_seq_port_info portinfo;
631 int ret; 655 int ret;
632 656
633 /* Set up the port */ 657 /* Set up the port */
@@ -660,7 +684,7 @@ int snd_seq_event_port_attach(int client,
660/* exported */ 684/* exported */
661int snd_seq_event_port_detach(int client, int port) 685int snd_seq_event_port_detach(int client, int port)
662{ 686{
663 snd_seq_port_info_t portinfo; 687 struct snd_seq_port_info portinfo;
664 int err; 688 int err;
665 689
666 memset(&portinfo, 0, sizeof(portinfo)); 690 memset(&portinfo, 0, sizeof(portinfo));
diff --git a/sound/core/seq/seq_ports.h b/sound/core/seq/seq_ports.h
index 89fd4416f6fa..9d7117118ba4 100644
--- a/sound/core/seq/seq_ports.h
+++ b/sound/core/seq/seq_ports.h
@@ -40,37 +40,38 @@
40 40
41*/ 41*/
42 42
43typedef struct subscribers_t { 43struct snd_seq_subscribers {
44 snd_seq_port_subscribe_t info; /* additional info */ 44 struct snd_seq_port_subscribe info; /* additional info */
45 struct list_head src_list; /* link of sources */ 45 struct list_head src_list; /* link of sources */
46 struct list_head dest_list; /* link of destinations */ 46 struct list_head dest_list; /* link of destinations */
47 atomic_t ref_count; 47 atomic_t ref_count;
48} subscribers_t; 48};
49 49
50typedef struct port_subs_info_t { 50struct snd_seq_port_subs_info {
51 struct list_head list_head; /* list of subscribed ports */ 51 struct list_head list_head; /* list of subscribed ports */
52 unsigned int count; /* count of subscribers */ 52 unsigned int count; /* count of subscribers */
53 unsigned int exclusive: 1; /* exclusive mode */ 53 unsigned int exclusive: 1; /* exclusive mode */
54 struct rw_semaphore list_mutex; 54 struct rw_semaphore list_mutex;
55 rwlock_t list_lock; 55 rwlock_t list_lock;
56 snd_seq_kernel_port_open_t *open; 56 int (*open)(void *private_data, struct snd_seq_port_subscribe *info);
57 snd_seq_kernel_port_close_t *close; 57 int (*close)(void *private_data, struct snd_seq_port_subscribe *info);
58} port_subs_info_t; 58};
59 59
60typedef struct client_port_t { 60struct snd_seq_client_port {
61 61
62 snd_seq_addr_t addr; /* client/port number */ 62 struct snd_seq_addr addr; /* client/port number */
63 struct module *owner; /* owner of this port */ 63 struct module *owner; /* owner of this port */
64 char name[64]; /* port name */ 64 char name[64]; /* port name */
65 struct list_head list; /* port list */ 65 struct list_head list; /* port list */
66 snd_use_lock_t use_lock; 66 snd_use_lock_t use_lock;
67 67
68 /* subscribers */ 68 /* subscribers */
69 port_subs_info_t c_src; /* read (sender) list */ 69 struct snd_seq_port_subs_info c_src; /* read (sender) list */
70 port_subs_info_t c_dest; /* write (dest) list */ 70 struct snd_seq_port_subs_info c_dest; /* write (dest) list */
71 71
72 snd_seq_kernel_port_input_t *event_input; 72 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data,
73 snd_seq_kernel_port_private_free_t *private_free; 73 int atomic, int hop);
74 void (*private_free)(void *private_data);
74 void *private_data; 75 void *private_data;
75 unsigned int callback_all : 1; 76 unsigned int callback_all : 1;
76 unsigned int closing : 1; 77 unsigned int closing : 1;
@@ -87,42 +88,55 @@ typedef struct client_port_t {
87 int midi_voices; 88 int midi_voices;
88 int synth_voices; 89 int synth_voices;
89 90
90} client_port_t; 91};
92
93struct snd_seq_client;
91 94
92/* return pointer to port structure and lock port */ 95/* return pointer to port structure and lock port */
93client_port_t *snd_seq_port_use_ptr(client_t *client, int num); 96struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client, int num);
94 97
95/* search for next port - port is locked if found */ 98/* search for next port - port is locked if found */
96client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t *pinfo); 99struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *client,
100 struct snd_seq_port_info *pinfo);
97 101
98/* unlock the port */ 102/* unlock the port */
99#define snd_seq_port_unlock(port) snd_use_lock_free(&(port)->use_lock) 103#define snd_seq_port_unlock(port) snd_use_lock_free(&(port)->use_lock)
100 104
101/* create a port, port number is returned (-1 on failure) */ 105/* create a port, port number is returned (-1 on failure) */
102client_port_t *snd_seq_create_port(client_t *client, int port_index); 106struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, int port_index);
103 107
104/* delete a port */ 108/* delete a port */
105int snd_seq_delete_port(client_t *client, int port); 109int snd_seq_delete_port(struct snd_seq_client *client, int port);
106 110
107/* delete all ports */ 111/* delete all ports */
108int snd_seq_delete_all_ports(client_t *client); 112int snd_seq_delete_all_ports(struct snd_seq_client *client);
109 113
110/* set port info fields */ 114/* set port info fields */
111int snd_seq_set_port_info(client_port_t *port, snd_seq_port_info_t *info); 115int snd_seq_set_port_info(struct snd_seq_client_port *port,
116 struct snd_seq_port_info *info);
112 117
113/* get port info fields */ 118/* get port info fields */
114int snd_seq_get_port_info(client_port_t *port, snd_seq_port_info_t *info); 119int snd_seq_get_port_info(struct snd_seq_client_port *port,
120 struct snd_seq_port_info *info);
115 121
116/* add subscriber to subscription list */ 122/* add subscriber to subscription list */
117int snd_seq_port_connect(client_t *caller, client_t *s, client_port_t *sp, client_t *d, client_port_t *dp, snd_seq_port_subscribe_t *info); 123int snd_seq_port_connect(struct snd_seq_client *caller,
124 struct snd_seq_client *s, struct snd_seq_client_port *sp,
125 struct snd_seq_client *d, struct snd_seq_client_port *dp,
126 struct snd_seq_port_subscribe *info);
118 127
119/* remove subscriber from subscription list */ 128/* remove subscriber from subscription list */
120int snd_seq_port_disconnect(client_t *caller, client_t *s, client_port_t *sp, client_t *d, client_port_t *dp, snd_seq_port_subscribe_t *info); 129int snd_seq_port_disconnect(struct snd_seq_client *caller,
130 struct snd_seq_client *s, struct snd_seq_client_port *sp,
131 struct snd_seq_client *d, struct snd_seq_client_port *dp,
132 struct snd_seq_port_subscribe *info);
121 133
122/* subscribe port */ 134/* subscribe port */
123int snd_seq_port_subscribe(client_port_t *port, snd_seq_port_subscribe_t *info); 135int snd_seq_port_subscribe(struct snd_seq_client_port *port,
136 struct snd_seq_port_subscribe *info);
124 137
125/* get matched subscriber */ 138/* get matched subscriber */
126subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp, snd_seq_addr_t *dest_addr); 139struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp,
140 struct snd_seq_addr *dest_addr);
127 141
128#endif 142#endif
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c
index cd641bca9945..074418617ee9 100644
--- a/sound/core/seq/seq_prioq.c
+++ b/sound/core/seq/seq_prioq.c
@@ -55,9 +55,9 @@
55 55
56 56
57/* create new prioq (constructor) */ 57/* create new prioq (constructor) */
58prioq_t *snd_seq_prioq_new(void) 58struct snd_seq_prioq *snd_seq_prioq_new(void)
59{ 59{
60 prioq_t *f; 60 struct snd_seq_prioq *f;
61 61
62 f = kzalloc(sizeof(*f), GFP_KERNEL); 62 f = kzalloc(sizeof(*f), GFP_KERNEL);
63 if (f == NULL) { 63 if (f == NULL) {
@@ -74,9 +74,9 @@ prioq_t *snd_seq_prioq_new(void)
74} 74}
75 75
76/* delete prioq (destructor) */ 76/* delete prioq (destructor) */
77void snd_seq_prioq_delete(prioq_t **fifo) 77void snd_seq_prioq_delete(struct snd_seq_prioq **fifo)
78{ 78{
79 prioq_t *f = *fifo; 79 struct snd_seq_prioq *f = *fifo;
80 *fifo = NULL; 80 *fifo = NULL;
81 81
82 if (f == NULL) { 82 if (f == NULL) {
@@ -101,7 +101,8 @@ void snd_seq_prioq_delete(prioq_t **fifo)
101 101
102/* compare timestamp between events */ 102/* compare timestamp between events */
103/* return 1 if a >= b; 0 */ 103/* return 1 if a >= b; 0 */
104static inline int compare_timestamp(snd_seq_event_t * a, snd_seq_event_t * b) 104static inline int compare_timestamp(struct snd_seq_event *a,
105 struct snd_seq_event *b)
105{ 106{
106 if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) { 107 if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) {
107 /* compare ticks */ 108 /* compare ticks */
@@ -117,7 +118,8 @@ static inline int compare_timestamp(snd_seq_event_t * a, snd_seq_event_t * b)
117 * zero if a = b; 118 * zero if a = b;
118 * positive if a > b; 119 * positive if a > b;
119 */ 120 */
120static inline int compare_timestamp_rel(snd_seq_event_t *a, snd_seq_event_t *b) 121static inline int compare_timestamp_rel(struct snd_seq_event *a,
122 struct snd_seq_event *b)
121{ 123{
122 if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) { 124 if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) {
123 /* compare ticks */ 125 /* compare ticks */
@@ -144,9 +146,10 @@ static inline int compare_timestamp_rel(snd_seq_event_t *a, snd_seq_event_t *b)
144} 146}
145 147
146/* enqueue cell to prioq */ 148/* enqueue cell to prioq */
147int snd_seq_prioq_cell_in(prioq_t * f, snd_seq_event_cell_t * cell) 149int snd_seq_prioq_cell_in(struct snd_seq_prioq * f,
150 struct snd_seq_event_cell * cell)
148{ 151{
149 snd_seq_event_cell_t *cur, *prev; 152 struct snd_seq_event_cell *cur, *prev;
150 unsigned long flags; 153 unsigned long flags;
151 int count; 154 int count;
152 int prior; 155 int prior;
@@ -215,9 +218,9 @@ int snd_seq_prioq_cell_in(prioq_t * f, snd_seq_event_cell_t * cell)
215} 218}
216 219
217/* dequeue cell from prioq */ 220/* dequeue cell from prioq */
218snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t * f) 221struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f)
219{ 222{
220 snd_seq_event_cell_t *cell; 223 struct snd_seq_event_cell *cell;
221 unsigned long flags; 224 unsigned long flags;
222 225
223 if (f == NULL) { 226 if (f == NULL) {
@@ -243,7 +246,7 @@ snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t * f)
243} 246}
244 247
245/* return number of events available in prioq */ 248/* return number of events available in prioq */
246int snd_seq_prioq_avail(prioq_t * f) 249int snd_seq_prioq_avail(struct snd_seq_prioq * f)
247{ 250{
248 if (f == NULL) { 251 if (f == NULL) {
249 snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); 252 snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n");
@@ -254,7 +257,7 @@ int snd_seq_prioq_avail(prioq_t * f)
254 257
255 258
256/* peek at cell at the head of the prioq */ 259/* peek at cell at the head of the prioq */
257snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t * f) 260struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq * f)
258{ 261{
259 if (f == NULL) { 262 if (f == NULL) {
260 snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); 263 snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n");
@@ -264,7 +267,8 @@ snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t * f)
264} 267}
265 268
266 269
267static inline int prioq_match(snd_seq_event_cell_t *cell, int client, int timestamp) 270static inline int prioq_match(struct snd_seq_event_cell *cell,
271 int client, int timestamp)
268{ 272{
269 if (cell->event.source.client == client || 273 if (cell->event.source.client == client ||
270 cell->event.dest.client == client) 274 cell->event.dest.client == client)
@@ -286,12 +290,12 @@ static inline int prioq_match(snd_seq_event_cell_t *cell, int client, int timest
286} 290}
287 291
288/* remove cells for left client */ 292/* remove cells for left client */
289void snd_seq_prioq_leave(prioq_t * f, int client, int timestamp) 293void snd_seq_prioq_leave(struct snd_seq_prioq * f, int client, int timestamp)
290{ 294{
291 register snd_seq_event_cell_t *cell, *next; 295 register struct snd_seq_event_cell *cell, *next;
292 unsigned long flags; 296 unsigned long flags;
293 snd_seq_event_cell_t *prev = NULL; 297 struct snd_seq_event_cell *prev = NULL;
294 snd_seq_event_cell_t *freefirst = NULL, *freeprev = NULL, *freenext; 298 struct snd_seq_event_cell *freefirst = NULL, *freeprev = NULL, *freenext;
295 299
296 /* collect all removed cells */ 300 /* collect all removed cells */
297 spin_lock_irqsave(&f->lock, flags); 301 spin_lock_irqsave(&f->lock, flags);
@@ -338,8 +342,8 @@ void snd_seq_prioq_leave(prioq_t * f, int client, int timestamp)
338 } 342 }
339} 343}
340 344
341static int prioq_remove_match(snd_seq_remove_events_t *info, 345static int prioq_remove_match(struct snd_seq_remove_events *info,
342 snd_seq_event_t *ev) 346 struct snd_seq_event *ev)
343{ 347{
344 int res; 348 int res;
345 349
@@ -394,13 +398,13 @@ static int prioq_remove_match(snd_seq_remove_events_t *info,
394} 398}
395 399
396/* remove cells matching remove criteria */ 400/* remove cells matching remove criteria */
397void snd_seq_prioq_remove_events(prioq_t * f, int client, 401void snd_seq_prioq_remove_events(struct snd_seq_prioq * f, int client,
398 snd_seq_remove_events_t *info) 402 struct snd_seq_remove_events *info)
399{ 403{
400 register snd_seq_event_cell_t *cell, *next; 404 struct snd_seq_event_cell *cell, *next;
401 unsigned long flags; 405 unsigned long flags;
402 snd_seq_event_cell_t *prev = NULL; 406 struct snd_seq_event_cell *prev = NULL;
403 snd_seq_event_cell_t *freefirst = NULL, *freeprev = NULL, *freenext; 407 struct snd_seq_event_cell *freefirst = NULL, *freeprev = NULL, *freenext;
404 408
405 /* collect all removed cells */ 409 /* collect all removed cells */
406 spin_lock_irqsave(&f->lock, flags); 410 spin_lock_irqsave(&f->lock, flags);
diff --git a/sound/core/seq/seq_prioq.h b/sound/core/seq/seq_prioq.h
index f12af79308b8..d38bb78d9345 100644
--- a/sound/core/seq/seq_prioq.h
+++ b/sound/core/seq/seq_prioq.h
@@ -26,37 +26,37 @@
26 26
27/* === PRIOQ === */ 27/* === PRIOQ === */
28 28
29typedef struct { 29struct snd_seq_prioq {
30 snd_seq_event_cell_t* head; /* pointer to head of prioq */ 30 struct snd_seq_event_cell *head; /* pointer to head of prioq */
31 snd_seq_event_cell_t* tail; /* pointer to tail of prioq */ 31 struct snd_seq_event_cell *tail; /* pointer to tail of prioq */
32 int cells; 32 int cells;
33 spinlock_t lock; 33 spinlock_t lock;
34} prioq_t; 34};
35 35
36 36
37/* create new prioq (constructor) */ 37/* create new prioq (constructor) */
38extern prioq_t *snd_seq_prioq_new(void); 38struct snd_seq_prioq *snd_seq_prioq_new(void);
39 39
40/* delete prioq (destructor) */ 40/* delete prioq (destructor) */
41extern void snd_seq_prioq_delete(prioq_t **fifo); 41void snd_seq_prioq_delete(struct snd_seq_prioq **fifo);
42 42
43/* enqueue cell to prioq */ 43/* enqueue cell to prioq */
44extern int snd_seq_prioq_cell_in(prioq_t *f, snd_seq_event_cell_t *cell); 44int snd_seq_prioq_cell_in(struct snd_seq_prioq *f, struct snd_seq_event_cell *cell);
45 45
46/* dequeue cell from prioq */ 46/* dequeue cell from prioq */
47extern snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t *f); 47struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f);
48 48
49/* return number of events available in prioq */ 49/* return number of events available in prioq */
50extern int snd_seq_prioq_avail(prioq_t *f); 50int snd_seq_prioq_avail(struct snd_seq_prioq *f);
51 51
52/* peek at cell at the head of the prioq */ 52/* peek at cell at the head of the prioq */
53extern snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t *f); 53struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq *f);
54 54
55/* client left queue */ 55/* client left queue */
56extern void snd_seq_prioq_leave(prioq_t *f, int client, int timestamp); 56void snd_seq_prioq_leave(struct snd_seq_prioq *f, int client, int timestamp);
57 57
58/* Remove events */ 58/* Remove events */
59void snd_seq_prioq_remove_events(prioq_t * f, int client, 59void snd_seq_prioq_remove_events(struct snd_seq_prioq *f, int client,
60 snd_seq_remove_events_t *info); 60 struct snd_seq_remove_events *info);
61 61
62#endif 62#endif
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 5f5c3cb37cbf..b537a71e1e19 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -29,7 +29,7 @@
29 * Aug. 30, 2000 Takashi Iwai 29 * Aug. 30, 2000 Takashi Iwai
30 * - Queues are managed in static array again, but with better way. 30 * - Queues are managed in static array again, but with better way.
31 * The API itself is identical. 31 * The API itself is identical.
32 * - The queue is locked when queue_t pinter is returned via 32 * - The queue is locked when struct snd_seq_queue pointer is returned via
33 * queueptr(). This pointer *MUST* be released afterward by 33 * queueptr(). This pointer *MUST* be released afterward by
34 * queuefree(ptr). 34 * queuefree(ptr).
35 * - Addition of experimental sync support. 35 * - Addition of experimental sync support.
@@ -48,7 +48,7 @@
48#include "seq_info.h" 48#include "seq_info.h"
49 49
50/* list of allocated queues */ 50/* list of allocated queues */
51static queue_t *queue_list[SNDRV_SEQ_MAX_QUEUES]; 51static struct snd_seq_queue *queue_list[SNDRV_SEQ_MAX_QUEUES];
52static DEFINE_SPINLOCK(queue_list_lock); 52static DEFINE_SPINLOCK(queue_list_lock);
53/* number of queues allocated */ 53/* number of queues allocated */
54static int num_queues; 54static int num_queues;
@@ -61,7 +61,7 @@ int snd_seq_queue_get_cur_queues(void)
61/*----------------------------------------------------------------*/ 61/*----------------------------------------------------------------*/
62 62
63/* assign queue id and insert to list */ 63/* assign queue id and insert to list */
64static int queue_list_add(queue_t *q) 64static int queue_list_add(struct snd_seq_queue *q)
65{ 65{
66 int i; 66 int i;
67 unsigned long flags; 67 unsigned long flags;
@@ -80,9 +80,9 @@ static int queue_list_add(queue_t *q)
80 return -1; 80 return -1;
81} 81}
82 82
83static queue_t *queue_list_remove(int id, int client) 83static struct snd_seq_queue *queue_list_remove(int id, int client)
84{ 84{
85 queue_t *q; 85 struct snd_seq_queue *q;
86 unsigned long flags; 86 unsigned long flags;
87 87
88 spin_lock_irqsave(&queue_list_lock, flags); 88 spin_lock_irqsave(&queue_list_lock, flags);
@@ -107,9 +107,9 @@ static queue_t *queue_list_remove(int id, int client)
107/*----------------------------------------------------------------*/ 107/*----------------------------------------------------------------*/
108 108
109/* create new queue (constructor) */ 109/* create new queue (constructor) */
110static queue_t *queue_new(int owner, int locked) 110static struct snd_seq_queue *queue_new(int owner, int locked)
111{ 111{
112 queue_t *q; 112 struct snd_seq_queue *q;
113 113
114 q = kzalloc(sizeof(*q), GFP_KERNEL); 114 q = kzalloc(sizeof(*q), GFP_KERNEL);
115 if (q == NULL) { 115 if (q == NULL) {
@@ -142,7 +142,7 @@ static queue_t *queue_new(int owner, int locked)
142} 142}
143 143
144/* delete queue (destructor) */ 144/* delete queue (destructor) */
145static void queue_delete(queue_t *q) 145static void queue_delete(struct snd_seq_queue *q)
146{ 146{
147 /* stop and release the timer */ 147 /* stop and release the timer */
148 snd_seq_timer_stop(q->timer); 148 snd_seq_timer_stop(q->timer);
@@ -187,7 +187,7 @@ void __exit snd_seq_queues_delete(void)
187 */ 187 */
188int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) 188int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
189{ 189{
190 queue_t *q; 190 struct snd_seq_queue *q;
191 191
192 q = queue_new(client, locked); 192 q = queue_new(client, locked);
193 if (q == NULL) 193 if (q == NULL)
@@ -204,7 +204,7 @@ int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
204/* delete a queue - queue must be owned by the client */ 204/* delete a queue - queue must be owned by the client */
205int snd_seq_queue_delete(int client, int queueid) 205int snd_seq_queue_delete(int client, int queueid)
206{ 206{
207 queue_t *q; 207 struct snd_seq_queue *q;
208 208
209 if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES) 209 if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES)
210 return -EINVAL; 210 return -EINVAL;
@@ -218,9 +218,9 @@ int snd_seq_queue_delete(int client, int queueid)
218 218
219 219
220/* return pointer to queue structure for specified id */ 220/* return pointer to queue structure for specified id */
221queue_t *queueptr(int queueid) 221struct snd_seq_queue *queueptr(int queueid)
222{ 222{
223 queue_t *q; 223 struct snd_seq_queue *q;
224 unsigned long flags; 224 unsigned long flags;
225 225
226 if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES) 226 if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES)
@@ -234,10 +234,10 @@ queue_t *queueptr(int queueid)
234} 234}
235 235
236/* return the (first) queue matching with the specified name */ 236/* return the (first) queue matching with the specified name */
237queue_t *snd_seq_queue_find_name(char *name) 237struct snd_seq_queue *snd_seq_queue_find_name(char *name)
238{ 238{
239 int i; 239 int i;
240 queue_t *q; 240 struct snd_seq_queue *q;
241 241
242 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { 242 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
243 if ((q = queueptr(i)) != NULL) { 243 if ((q = queueptr(i)) != NULL) {
@@ -252,10 +252,10 @@ queue_t *snd_seq_queue_find_name(char *name)
252 252
253/* -------------------------------------------------------- */ 253/* -------------------------------------------------------- */
254 254
255void snd_seq_check_queue(queue_t *q, int atomic, int hop) 255void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
256{ 256{
257 unsigned long flags; 257 unsigned long flags;
258 snd_seq_event_cell_t *cell; 258 struct snd_seq_event_cell *cell;
259 259
260 if (q == NULL) 260 if (q == NULL)
261 return; 261 return;
@@ -273,7 +273,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
273 __again: 273 __again:
274 /* Process tick queue... */ 274 /* Process tick queue... */
275 while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) { 275 while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) {
276 if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick, &cell->event.time.tick)) { 276 if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick,
277 &cell->event.time.tick)) {
277 cell = snd_seq_prioq_cell_out(q->tickq); 278 cell = snd_seq_prioq_cell_out(q->tickq);
278 if (cell) 279 if (cell)
279 snd_seq_dispatch_event(cell, atomic, hop); 280 snd_seq_dispatch_event(cell, atomic, hop);
@@ -286,7 +287,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
286 287
287 /* Process time queue... */ 288 /* Process time queue... */
288 while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) { 289 while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) {
289 if (snd_seq_compare_real_time(&q->timer->cur_time, &cell->event.time.time)) { 290 if (snd_seq_compare_real_time(&q->timer->cur_time,
291 &cell->event.time.time)) {
290 cell = snd_seq_prioq_cell_out(q->timeq); 292 cell = snd_seq_prioq_cell_out(q->timeq);
291 if (cell) 293 if (cell)
292 snd_seq_dispatch_event(cell, atomic, hop); 294 snd_seq_dispatch_event(cell, atomic, hop);
@@ -309,10 +311,10 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
309 311
310 312
311/* enqueue a event to singe queue */ 313/* enqueue a event to singe queue */
312int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop) 314int snd_seq_enqueue_event(struct snd_seq_event_cell *cell, int atomic, int hop)
313{ 315{
314 int dest, err; 316 int dest, err;
315 queue_t *q; 317 struct snd_seq_queue *q;
316 318
317 snd_assert(cell != NULL, return -EINVAL); 319 snd_assert(cell != NULL, return -EINVAL);
318 dest = cell->event.queue; /* destination queue */ 320 dest = cell->event.queue; /* destination queue */
@@ -327,7 +329,8 @@ int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop)
327 break; 329 break;
328 330
329 case SNDRV_SEQ_TIME_STAMP_REAL: 331 case SNDRV_SEQ_TIME_STAMP_REAL:
330 snd_seq_inc_real_time(&cell->event.time.time, &q->timer->cur_time); 332 snd_seq_inc_real_time(&cell->event.time.time,
333 &q->timer->cur_time);
331 break; 334 break;
332 } 335 }
333 cell->event.flags &= ~SNDRV_SEQ_TIME_MODE_MASK; 336 cell->event.flags &= ~SNDRV_SEQ_TIME_MODE_MASK;
@@ -361,7 +364,7 @@ int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop)
361 364
362/*----------------------------------------------------------------*/ 365/*----------------------------------------------------------------*/
363 366
364static inline int check_access(queue_t *q, int client) 367static inline int check_access(struct snd_seq_queue *q, int client)
365{ 368{
366 return (q->owner == client) || (!q->locked && !q->klocked); 369 return (q->owner == client) || (!q->locked && !q->klocked);
367} 370}
@@ -369,7 +372,7 @@ static inline int check_access(queue_t *q, int client)
369/* check if the client has permission to modify queue parameters. 372/* check if the client has permission to modify queue parameters.
370 * if it does, lock the queue 373 * if it does, lock the queue
371 */ 374 */
372static int queue_access_lock(queue_t *q, int client) 375static int queue_access_lock(struct snd_seq_queue *q, int client)
373{ 376{
374 unsigned long flags; 377 unsigned long flags;
375 int access_ok; 378 int access_ok;
@@ -383,7 +386,7 @@ static int queue_access_lock(queue_t *q, int client)
383} 386}
384 387
385/* unlock the queue */ 388/* unlock the queue */
386static inline void queue_access_unlock(queue_t *q) 389static inline void queue_access_unlock(struct snd_seq_queue *q)
387{ 390{
388 unsigned long flags; 391 unsigned long flags;
389 392
@@ -395,7 +398,7 @@ static inline void queue_access_unlock(queue_t *q)
395/* exported - only checking permission */ 398/* exported - only checking permission */
396int snd_seq_queue_check_access(int queueid, int client) 399int snd_seq_queue_check_access(int queueid, int client)
397{ 400{
398 queue_t *q = queueptr(queueid); 401 struct snd_seq_queue *q = queueptr(queueid);
399 int access_ok; 402 int access_ok;
400 unsigned long flags; 403 unsigned long flags;
401 404
@@ -415,7 +418,7 @@ int snd_seq_queue_check_access(int queueid, int client)
415 */ 418 */
416int snd_seq_queue_set_owner(int queueid, int client, int locked) 419int snd_seq_queue_set_owner(int queueid, int client, int locked)
417{ 420{
418 queue_t *q = queueptr(queueid); 421 struct snd_seq_queue *q = queueptr(queueid);
419 422
420 if (q == NULL) 423 if (q == NULL)
421 return -EINVAL; 424 return -EINVAL;
@@ -443,8 +446,8 @@ int snd_seq_queue_set_owner(int queueid, int client, int locked)
443int snd_seq_queue_timer_open(int queueid) 446int snd_seq_queue_timer_open(int queueid)
444{ 447{
445 int result = 0; 448 int result = 0;
446 queue_t *queue; 449 struct snd_seq_queue *queue;
447 seq_timer_t *tmr; 450 struct snd_seq_timer *tmr;
448 451
449 queue = queueptr(queueid); 452 queue = queueptr(queueid);
450 if (queue == NULL) 453 if (queue == NULL)
@@ -463,8 +466,8 @@ int snd_seq_queue_timer_open(int queueid)
463 */ 466 */
464int snd_seq_queue_timer_close(int queueid) 467int snd_seq_queue_timer_close(int queueid)
465{ 468{
466 queue_t *queue; 469 struct snd_seq_queue *queue;
467 seq_timer_t *tmr; 470 struct snd_seq_timer *tmr;
468 int result = 0; 471 int result = 0;
469 472
470 queue = queueptr(queueid); 473 queue = queueptr(queueid);
@@ -477,9 +480,10 @@ int snd_seq_queue_timer_close(int queueid)
477} 480}
478 481
479/* change queue tempo and ppq */ 482/* change queue tempo and ppq */
480int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t *info) 483int snd_seq_queue_timer_set_tempo(int queueid, int client,
484 struct snd_seq_queue_tempo *info)
481{ 485{
482 queue_t *q = queueptr(queueid); 486 struct snd_seq_queue *q = queueptr(queueid);
483 int result; 487 int result;
484 488
485 if (q == NULL) 489 if (q == NULL)
@@ -493,7 +497,8 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t
493 if (result >= 0) 497 if (result >= 0)
494 result = snd_seq_timer_set_ppq(q->timer, info->ppq); 498 result = snd_seq_timer_set_ppq(q->timer, info->ppq);
495 if (result >= 0 && info->skew_base > 0) 499 if (result >= 0 && info->skew_base > 0)
496 result = snd_seq_timer_set_skew(q->timer, info->skew_value, info->skew_base); 500 result = snd_seq_timer_set_skew(q->timer, info->skew_value,
501 info->skew_base);
497 queue_access_unlock(q); 502 queue_access_unlock(q);
498 queuefree(q); 503 queuefree(q);
499 return result; 504 return result;
@@ -506,7 +511,7 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t
506 */ 511 */
507int snd_seq_queue_use(int queueid, int client, int use) 512int snd_seq_queue_use(int queueid, int client, int use)
508{ 513{
509 queue_t *queue; 514 struct snd_seq_queue *queue;
510 515
511 queue = queueptr(queueid); 516 queue = queueptr(queueid);
512 if (queue == NULL) 517 if (queue == NULL)
@@ -538,7 +543,7 @@ int snd_seq_queue_use(int queueid, int client, int use)
538 */ 543 */
539int snd_seq_queue_is_used(int queueid, int client) 544int snd_seq_queue_is_used(int queueid, int client)
540{ 545{
541 queue_t *q; 546 struct snd_seq_queue *q;
542 int result; 547 int result;
543 548
544 q = queueptr(queueid); 549 q = queueptr(queueid);
@@ -559,7 +564,7 @@ void snd_seq_queue_client_termination(int client)
559{ 564{
560 unsigned long flags; 565 unsigned long flags;
561 int i; 566 int i;
562 queue_t *q; 567 struct snd_seq_queue *q;
563 568
564 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { 569 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
565 if ((q = queueptr(i)) == NULL) 570 if ((q = queueptr(i)) == NULL)
@@ -584,7 +589,7 @@ void snd_seq_queue_client_termination(int client)
584void snd_seq_queue_client_leave(int client) 589void snd_seq_queue_client_leave(int client)
585{ 590{
586 int i; 591 int i;
587 queue_t *q; 592 struct snd_seq_queue *q;
588 593
589 /* delete own queues from queue list */ 594 /* delete own queues from queue list */
590 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { 595 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
@@ -615,7 +620,7 @@ void snd_seq_queue_client_leave(int client)
615void snd_seq_queue_client_leave_cells(int client) 620void snd_seq_queue_client_leave_cells(int client)
616{ 621{
617 int i; 622 int i;
618 queue_t *q; 623 struct snd_seq_queue *q;
619 624
620 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { 625 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
621 if ((q = queueptr(i)) == NULL) 626 if ((q = queueptr(i)) == NULL)
@@ -627,10 +632,10 @@ void snd_seq_queue_client_leave_cells(int client)
627} 632}
628 633
629/* remove cells based on flush criteria */ 634/* remove cells based on flush criteria */
630void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info) 635void snd_seq_queue_remove_cells(int client, struct snd_seq_remove_events *info)
631{ 636{
632 int i; 637 int i;
633 queue_t *q; 638 struct snd_seq_queue *q;
634 639
635 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { 640 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
636 if ((q = queueptr(i)) == NULL) 641 if ((q = queueptr(i)) == NULL)
@@ -650,9 +655,10 @@ void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info)
650/* 655/*
651 * send events to all subscribed ports 656 * send events to all subscribed ports
652 */ 657 */
653static void queue_broadcast_event(queue_t *q, snd_seq_event_t *ev, int atomic, int hop) 658static void queue_broadcast_event(struct snd_seq_queue *q, struct snd_seq_event *ev,
659 int atomic, int hop)
654{ 660{
655 snd_seq_event_t sev; 661 struct snd_seq_event sev;
656 662
657 sev = *ev; 663 sev = *ev;
658 664
@@ -672,7 +678,8 @@ static void queue_broadcast_event(queue_t *q, snd_seq_event_t *ev, int atomic, i
672 * process a received queue-control event. 678 * process a received queue-control event.
673 * this function is exported for seq_sync.c. 679 * this function is exported for seq_sync.c.
674 */ 680 */
675static void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev, 681static void snd_seq_queue_process_event(struct snd_seq_queue *q,
682 struct snd_seq_event *ev,
676 int atomic, int hop) 683 int atomic, int hop)
677{ 684{
678 switch (ev->type) { 685 switch (ev->type) {
@@ -724,9 +731,9 @@ static void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev,
724 * Queue control via timer control port: 731 * Queue control via timer control port:
725 * this function is exported as a callback of timer port. 732 * this function is exported as a callback of timer port.
726 */ 733 */
727int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop) 734int snd_seq_control_queue(struct snd_seq_event *ev, int atomic, int hop)
728{ 735{
729 queue_t *q; 736 struct snd_seq_queue *q;
730 737
731 snd_assert(ev != NULL, return -EINVAL); 738 snd_assert(ev != NULL, return -EINVAL);
732 q = queueptr(ev->data.queue.queue); 739 q = queueptr(ev->data.queue.queue);
@@ -750,12 +757,12 @@ int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop)
750/*----------------------------------------------------------------*/ 757/*----------------------------------------------------------------*/
751 758
752/* exported to seq_info.c */ 759/* exported to seq_info.c */
753void snd_seq_info_queues_read(snd_info_entry_t *entry, 760void snd_seq_info_queues_read(struct snd_info_entry *entry,
754 snd_info_buffer_t * buffer) 761 struct snd_info_buffer *buffer)
755{ 762{
756 int i, bpm; 763 int i, bpm;
757 queue_t *q; 764 struct snd_seq_queue *q;
758 seq_timer_t *tmr; 765 struct snd_seq_timer *tmr;
759 766
760 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { 767 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
761 if ((q = queueptr(i)) == NULL) 768 if ((q = queueptr(i)) == NULL)
diff --git a/sound/core/seq/seq_queue.h b/sound/core/seq/seq_queue.h
index ea3c54216ea8..888438599387 100644
--- a/sound/core/seq/seq_queue.h
+++ b/sound/core/seq/seq_queue.h
@@ -30,15 +30,15 @@
30 30
31#define SEQ_QUEUE_NO_OWNER (-1) 31#define SEQ_QUEUE_NO_OWNER (-1)
32 32
33struct _snd_seq_queue { 33struct snd_seq_queue {
34 int queue; /* queue number */ 34 int queue; /* queue number */
35 35
36 char name[64]; /* name of this queue */ 36 char name[64]; /* name of this queue */
37 37
38 prioq_t *tickq; /* midi tick event queue */ 38 struct snd_seq_prioq *tickq; /* midi tick event queue */
39 prioq_t *timeq; /* real-time event queue */ 39 struct snd_seq_prioq *timeq; /* real-time event queue */
40 40
41 seq_timer_t *timer; /* time keeper for this queue */ 41 struct snd_seq_timer *timer; /* time keeper for this queue */
42 int owner; /* client that 'owns' the timer */ 42 int owner; /* client that 'owns' the timer */
43 unsigned int locked:1, /* timer is only accesibble by owner if set */ 43 unsigned int locked:1, /* timer is only accesibble by owner if set */
44 klocked:1, /* kernel lock (after START) */ 44 klocked:1, /* kernel lock (after START) */
@@ -83,26 +83,26 @@ void snd_seq_queue_client_termination(int client);
83void snd_seq_queue_client_leave(int client); 83void snd_seq_queue_client_leave(int client);
84 84
85/* enqueue a event received from one the clients */ 85/* enqueue a event received from one the clients */
86int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop); 86int snd_seq_enqueue_event(struct snd_seq_event_cell *cell, int atomic, int hop);
87 87
88/* Remove events */ 88/* Remove events */
89void snd_seq_queue_client_leave_cells(int client); 89void snd_seq_queue_client_leave_cells(int client);
90void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info); 90void snd_seq_queue_remove_cells(int client, struct snd_seq_remove_events *info);
91 91
92/* return pointer to queue structure for specified id */ 92/* return pointer to queue structure for specified id */
93queue_t *queueptr(int queueid); 93struct snd_seq_queue *queueptr(int queueid);
94/* unlock */ 94/* unlock */
95#define queuefree(q) snd_use_lock_free(&(q)->use_lock) 95#define queuefree(q) snd_use_lock_free(&(q)->use_lock)
96 96
97/* return the (first) queue matching with the specified name */ 97/* return the (first) queue matching with the specified name */
98queue_t *snd_seq_queue_find_name(char *name); 98struct snd_seq_queue *snd_seq_queue_find_name(char *name);
99 99
100/* check single queue and dispatch events */ 100/* check single queue and dispatch events */
101void snd_seq_check_queue(queue_t *q, int atomic, int hop); 101void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop);
102 102
103/* access to queue's parameters */ 103/* access to queue's parameters */
104int snd_seq_queue_check_access(int queueid, int client); 104int snd_seq_queue_check_access(int queueid, int client);
105int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t *info); 105int snd_seq_queue_timer_set_tempo(int queueid, int client, struct snd_seq_queue_tempo *info);
106int snd_seq_queue_set_owner(int queueid, int client, int locked); 106int snd_seq_queue_set_owner(int queueid, int client, int locked);
107int snd_seq_queue_set_locked(int queueid, int client, int locked); 107int snd_seq_queue_set_locked(int queueid, int client, int locked);
108int snd_seq_queue_timer_open(int queueid); 108int snd_seq_queue_timer_open(int queueid);
@@ -110,7 +110,7 @@ int snd_seq_queue_timer_close(int queueid);
110int snd_seq_queue_use(int queueid, int client, int use); 110int snd_seq_queue_use(int queueid, int client, int use);
111int snd_seq_queue_is_used(int queueid, int client); 111int snd_seq_queue_is_used(int queueid, int client);
112 112
113int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop); 113int snd_seq_control_queue(struct snd_seq_event *ev, int atomic, int hop);
114 114
115/* 115/*
116 * 64bit division - for sync stuff.. 116 * 64bit division - for sync stuff..
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
index 0d9eff85ab88..86b1cba33c08 100644
--- a/sound/core/seq/seq_system.c
+++ b/sound/core/seq/seq_system.c
@@ -66,12 +66,12 @@ static int announce_port = -1;
66 66
67 67
68/* fill standard header data, source port & channel are filled in */ 68/* fill standard header data, source port & channel are filled in */
69static int setheader(snd_seq_event_t * ev, int client, int port) 69static int setheader(struct snd_seq_event * ev, int client, int port)
70{ 70{
71 if (announce_port < 0) 71 if (announce_port < 0)
72 return -ENODEV; 72 return -ENODEV;
73 73
74 memset(ev, 0, sizeof(snd_seq_event_t)); 74 memset(ev, 0, sizeof(struct snd_seq_event));
75 75
76 ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; 76 ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
77 ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED; 77 ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED;
@@ -92,7 +92,7 @@ static int setheader(snd_seq_event_t * ev, int client, int port)
92/* entry points for broadcasting system events */ 92/* entry points for broadcasting system events */
93void snd_seq_system_broadcast(int client, int port, int type) 93void snd_seq_system_broadcast(int client, int port, int type)
94{ 94{
95 snd_seq_event_t ev; 95 struct snd_seq_event ev;
96 96
97 if (setheader(&ev, client, port) < 0) 97 if (setheader(&ev, client, port) < 0)
98 return; 98 return;
@@ -101,7 +101,7 @@ void snd_seq_system_broadcast(int client, int port, int type)
101} 101}
102 102
103/* entry points for broadcasting system events */ 103/* entry points for broadcasting system events */
104int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev) 104int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev)
105{ 105{
106 ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED; 106 ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED;
107 ev->source.client = sysclient; 107 ev->source.client = sysclient;
@@ -112,7 +112,7 @@ int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev)
112} 112}
113 113
114/* call-back handler for timer events */ 114/* call-back handler for timer events */
115static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop) 115static int event_input_timer(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop)
116{ 116{
117 return snd_seq_control_queue(ev, atomic, hop); 117 return snd_seq_control_queue(ev, atomic, hop);
118} 118}
@@ -121,10 +121,10 @@ static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_dat
121int __init snd_seq_system_client_init(void) 121int __init snd_seq_system_client_init(void)
122{ 122{
123 123
124 snd_seq_client_callback_t callbacks; 124 struct snd_seq_client_callback callbacks;
125 snd_seq_port_callback_t pcallbacks; 125 struct snd_seq_port_callback pcallbacks;
126 snd_seq_client_info_t *inf; 126 struct snd_seq_client_info *inf;
127 snd_seq_port_info_t *port; 127 struct snd_seq_port_info *port;
128 128
129 inf = kzalloc(sizeof(*inf), GFP_KERNEL); 129 inf = kzalloc(sizeof(*inf), GFP_KERNEL);
130 port = kzalloc(sizeof(*port), GFP_KERNEL); 130 port = kzalloc(sizeof(*port), GFP_KERNEL);
diff --git a/sound/core/seq/seq_system.h b/sound/core/seq/seq_system.h
index 900007255bb4..cf2cfa23430e 100644
--- a/sound/core/seq/seq_system.h
+++ b/sound/core/seq/seq_system.h
@@ -34,7 +34,7 @@ void snd_seq_system_broadcast(int client, int port, int type);
34#define snd_seq_system_client_ev_port_exit(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_EXIT) 34#define snd_seq_system_client_ev_port_exit(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
35#define snd_seq_system_client_ev_port_change(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE) 35#define snd_seq_system_client_ev_port_change(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
36 36
37int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev); 37int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev);
38 38
39/* register our internal client */ 39/* register our internal client */
40int snd_seq_system_client_init(void); 40int snd_seq_system_client_init(void);
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index 65b64a7c456d..a1d8bfd60ae9 100644
--- a/sound/core/seq/seq_timer.c
+++ b/sound/core/seq/seq_timer.c
@@ -41,7 +41,7 @@ extern int seq_default_timer_resolution;
41 41
42#define SKEW_BASE 0x10000 /* 16bit shift */ 42#define SKEW_BASE 0x10000 /* 16bit shift */
43 43
44static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick, 44static void snd_seq_timer_set_tick_resolution(struct snd_seq_timer_tick *tick,
45 int tempo, int ppq) 45 int tempo, int ppq)
46{ 46{
47 if (tempo < 1000000) 47 if (tempo < 1000000)
@@ -60,9 +60,9 @@ static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick,
60} 60}
61 61
62/* create new timer (constructor) */ 62/* create new timer (constructor) */
63seq_timer_t *snd_seq_timer_new(void) 63struct snd_seq_timer *snd_seq_timer_new(void)
64{ 64{
65 seq_timer_t *tmr; 65 struct snd_seq_timer *tmr;
66 66
67 tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); 67 tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
68 if (tmr == NULL) { 68 if (tmr == NULL) {
@@ -81,9 +81,9 @@ seq_timer_t *snd_seq_timer_new(void)
81} 81}
82 82
83/* delete timer (destructor) */ 83/* delete timer (destructor) */
84void snd_seq_timer_delete(seq_timer_t **tmr) 84void snd_seq_timer_delete(struct snd_seq_timer **tmr)
85{ 85{
86 seq_timer_t *t = *tmr; 86 struct snd_seq_timer *t = *tmr;
87 *tmr = NULL; 87 *tmr = NULL;
88 88
89 if (t == NULL) { 89 if (t == NULL) {
@@ -99,7 +99,7 @@ void snd_seq_timer_delete(seq_timer_t **tmr)
99 kfree(t); 99 kfree(t);
100} 100}
101 101
102void snd_seq_timer_defaults(seq_timer_t * tmr) 102void snd_seq_timer_defaults(struct snd_seq_timer * tmr)
103{ 103{
104 /* setup defaults */ 104 /* setup defaults */
105 tmr->ppq = 96; /* 96 PPQ */ 105 tmr->ppq = 96; /* 96 PPQ */
@@ -118,7 +118,7 @@ void snd_seq_timer_defaults(seq_timer_t * tmr)
118 tmr->skew = tmr->skew_base = SKEW_BASE; 118 tmr->skew = tmr->skew_base = SKEW_BASE;
119} 119}
120 120
121void snd_seq_timer_reset(seq_timer_t * tmr) 121void snd_seq_timer_reset(struct snd_seq_timer * tmr)
122{ 122{
123 unsigned long flags; 123 unsigned long flags;
124 124
@@ -136,13 +136,13 @@ void snd_seq_timer_reset(seq_timer_t * tmr)
136 136
137 137
138/* called by timer interrupt routine. the period time since previous invocation is passed */ 138/* called by timer interrupt routine. the period time since previous invocation is passed */
139static void snd_seq_timer_interrupt(snd_timer_instance_t *timeri, 139static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri,
140 unsigned long resolution, 140 unsigned long resolution,
141 unsigned long ticks) 141 unsigned long ticks)
142{ 142{
143 unsigned long flags; 143 unsigned long flags;
144 queue_t *q = (queue_t *)timeri->callback_data; 144 struct snd_seq_queue *q = timeri->callback_data;
145 seq_timer_t *tmr; 145 struct snd_seq_timer *tmr;
146 146
147 if (q == NULL) 147 if (q == NULL)
148 return; 148 return;
@@ -177,7 +177,7 @@ static void snd_seq_timer_interrupt(snd_timer_instance_t *timeri,
177} 177}
178 178
179/* set current tempo */ 179/* set current tempo */
180int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo) 180int snd_seq_timer_set_tempo(struct snd_seq_timer * tmr, int tempo)
181{ 181{
182 unsigned long flags; 182 unsigned long flags;
183 183
@@ -194,7 +194,7 @@ int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo)
194} 194}
195 195
196/* set current ppq */ 196/* set current ppq */
197int snd_seq_timer_set_ppq(seq_timer_t * tmr, int ppq) 197int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq)
198{ 198{
199 unsigned long flags; 199 unsigned long flags;
200 200
@@ -217,7 +217,8 @@ int snd_seq_timer_set_ppq(seq_timer_t * tmr, int ppq)
217} 217}
218 218
219/* set current tick position */ 219/* set current tick position */
220int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t position) 220int snd_seq_timer_set_position_tick(struct snd_seq_timer *tmr,
221 snd_seq_tick_time_t position)
221{ 222{
222 unsigned long flags; 223 unsigned long flags;
223 224
@@ -231,7 +232,8 @@ int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t positi
231} 232}
232 233
233/* set current real-time position */ 234/* set current real-time position */
234int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t position) 235int snd_seq_timer_set_position_time(struct snd_seq_timer *tmr,
236 snd_seq_real_time_t position)
235{ 237{
236 unsigned long flags; 238 unsigned long flags;
237 239
@@ -245,7 +247,8 @@ int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t positi
245} 247}
246 248
247/* set timer skew */ 249/* set timer skew */
248int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int base) 250int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew,
251 unsigned int base)
249{ 252{
250 unsigned long flags; 253 unsigned long flags;
251 254
@@ -262,10 +265,10 @@ int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int bas
262 return 0; 265 return 0;
263} 266}
264 267
265int snd_seq_timer_open(queue_t *q) 268int snd_seq_timer_open(struct snd_seq_queue *q)
266{ 269{
267 snd_timer_instance_t *t; 270 struct snd_timer_instance *t;
268 seq_timer_t *tmr; 271 struct snd_seq_timer *tmr;
269 char str[32]; 272 char str[32];
270 int err; 273 int err;
271 274
@@ -282,7 +285,7 @@ int snd_seq_timer_open(queue_t *q)
282 if (err < 0 && tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_SLAVE) { 285 if (err < 0 && tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_SLAVE) {
283 if (tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_GLOBAL || 286 if (tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_GLOBAL ||
284 tmr->alsa_id.device != SNDRV_TIMER_GLOBAL_SYSTEM) { 287 tmr->alsa_id.device != SNDRV_TIMER_GLOBAL_SYSTEM) {
285 snd_timer_id_t tid; 288 struct snd_timer_id tid;
286 memset(&tid, 0, sizeof(tid)); 289 memset(&tid, 0, sizeof(tid));
287 tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL; 290 tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL;
288 tid.dev_sclass = SNDRV_TIMER_SCLASS_SEQUENCER; 291 tid.dev_sclass = SNDRV_TIMER_SCLASS_SEQUENCER;
@@ -302,9 +305,9 @@ int snd_seq_timer_open(queue_t *q)
302 return 0; 305 return 0;
303} 306}
304 307
305int snd_seq_timer_close(queue_t *q) 308int snd_seq_timer_close(struct snd_seq_queue *q)
306{ 309{
307 seq_timer_t *tmr; 310 struct snd_seq_timer *tmr;
308 311
309 tmr = q->timer; 312 tmr = q->timer;
310 snd_assert(tmr != NULL, return -EINVAL); 313 snd_assert(tmr != NULL, return -EINVAL);
@@ -316,7 +319,7 @@ int snd_seq_timer_close(queue_t *q)
316 return 0; 319 return 0;
317} 320}
318 321
319int snd_seq_timer_stop(seq_timer_t * tmr) 322int snd_seq_timer_stop(struct snd_seq_timer * tmr)
320{ 323{
321 if (! tmr->timeri) 324 if (! tmr->timeri)
322 return -EINVAL; 325 return -EINVAL;
@@ -327,9 +330,9 @@ int snd_seq_timer_stop(seq_timer_t * tmr)
327 return 0; 330 return 0;
328} 331}
329 332
330static int initialize_timer(seq_timer_t *tmr) 333static int initialize_timer(struct snd_seq_timer *tmr)
331{ 334{
332 snd_timer_t *t; 335 struct snd_timer *t;
333 unsigned long freq; 336 unsigned long freq;
334 337
335 t = tmr->timeri->timer; 338 t = tmr->timeri->timer;
@@ -358,7 +361,7 @@ static int initialize_timer(seq_timer_t *tmr)
358 return 0; 361 return 0;
359} 362}
360 363
361int snd_seq_timer_start(seq_timer_t * tmr) 364int snd_seq_timer_start(struct snd_seq_timer * tmr)
362{ 365{
363 if (! tmr->timeri) 366 if (! tmr->timeri)
364 return -EINVAL; 367 return -EINVAL;
@@ -373,7 +376,7 @@ int snd_seq_timer_start(seq_timer_t * tmr)
373 return 0; 376 return 0;
374} 377}
375 378
376int snd_seq_timer_continue(seq_timer_t * tmr) 379int snd_seq_timer_continue(struct snd_seq_timer * tmr)
377{ 380{
378 if (! tmr->timeri) 381 if (! tmr->timeri)
379 return -EINVAL; 382 return -EINVAL;
@@ -391,7 +394,7 @@ int snd_seq_timer_continue(seq_timer_t * tmr)
391} 394}
392 395
393/* return current 'real' time. use timeofday() to get better granularity. */ 396/* return current 'real' time. use timeofday() to get better granularity. */
394snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr) 397snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr)
395{ 398{
396 snd_seq_real_time_t cur_time; 399 snd_seq_real_time_t cur_time;
397 400
@@ -416,19 +419,20 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr)
416 419
417/* TODO: use interpolation on tick queue (will only be useful for very 420/* TODO: use interpolation on tick queue (will only be useful for very
418 high PPQ values) */ 421 high PPQ values) */
419snd_seq_tick_time_t snd_seq_timer_get_cur_tick(seq_timer_t *tmr) 422snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr)
420{ 423{
421 return tmr->tick.cur_tick; 424 return tmr->tick.cur_tick;
422} 425}
423 426
424 427
425/* exported to seq_info.c */ 428/* exported to seq_info.c */
426void snd_seq_info_timer_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 429void snd_seq_info_timer_read(struct snd_info_entry *entry,
430 struct snd_info_buffer *buffer)
427{ 431{
428 int idx; 432 int idx;
429 queue_t *q; 433 struct snd_seq_queue *q;
430 seq_timer_t *tmr; 434 struct snd_seq_timer *tmr;
431 snd_timer_instance_t *ti; 435 struct snd_timer_instance *ti;
432 unsigned long resolution; 436 unsigned long resolution;
433 437
434 for (idx = 0; idx < SNDRV_SEQ_MAX_QUEUES; idx++) { 438 for (idx = 0; idx < SNDRV_SEQ_MAX_QUEUES; idx++) {
diff --git a/sound/core/seq/seq_timer.h b/sound/core/seq/seq_timer.h
index 287ed68591de..e9ee1543c924 100644
--- a/sound/core/seq/seq_timer.h
+++ b/sound/core/seq/seq_timer.h
@@ -24,13 +24,13 @@
24#include <sound/timer.h> 24#include <sound/timer.h>
25#include <sound/seq_kernel.h> 25#include <sound/seq_kernel.h>
26 26
27typedef struct { 27struct snd_seq_timer_tick {
28 snd_seq_tick_time_t cur_tick; /* current tick */ 28 snd_seq_tick_time_t cur_tick; /* current tick */
29 unsigned long resolution; /* time per tick in nsec */ 29 unsigned long resolution; /* time per tick in nsec */
30 unsigned long fraction; /* current time per tick in nsec */ 30 unsigned long fraction; /* current time per tick in nsec */
31} seq_timer_tick_t; 31};
32 32
33typedef struct { 33struct snd_seq_timer {
34 /* ... tempo / offset / running state */ 34 /* ... tempo / offset / running state */
35 35
36 unsigned int running:1, /* running state of queue */ 36 unsigned int running:1, /* running state of queue */
@@ -40,12 +40,12 @@ typedef struct {
40 int ppq; /* time resolution, ticks/quarter */ 40 int ppq; /* time resolution, ticks/quarter */
41 41
42 snd_seq_real_time_t cur_time; /* current time */ 42 snd_seq_real_time_t cur_time; /* current time */
43 seq_timer_tick_t tick; /* current tick */ 43 struct snd_seq_timer_tick tick; /* current tick */
44 int tick_updated; 44 int tick_updated;
45 45
46 int type; /* timer type */ 46 int type; /* timer type */
47 snd_timer_id_t alsa_id; /* ALSA's timer ID */ 47 struct snd_timer_id alsa_id; /* ALSA's timer ID */
48 snd_timer_instance_t *timeri; /* timer instance */ 48 struct snd_timer_instance *timeri; /* timer instance */
49 unsigned int ticks; 49 unsigned int ticks;
50 unsigned long preferred_resolution; /* timer resolution, ticks/sec */ 50 unsigned long preferred_resolution; /* timer resolution, ticks/sec */
51 51
@@ -55,17 +55,18 @@ typedef struct {
55 struct timeval last_update; /* time of last clock update, used for interpolation */ 55 struct timeval last_update; /* time of last clock update, used for interpolation */
56 56
57 spinlock_t lock; 57 spinlock_t lock;
58} seq_timer_t; 58};
59 59
60 60
61/* create new timer (constructor) */ 61/* create new timer (constructor) */
62extern seq_timer_t *snd_seq_timer_new(void); 62struct snd_seq_timer *snd_seq_timer_new(void);
63 63
64/* delete timer (destructor) */ 64/* delete timer (destructor) */
65extern void snd_seq_timer_delete(seq_timer_t **tmr); 65void snd_seq_timer_delete(struct snd_seq_timer **tmr);
66 66
67/* */ 67/* */
68static inline void snd_seq_timer_update_tick(seq_timer_tick_t *tick, unsigned long resolution) 68static inline void snd_seq_timer_update_tick(struct snd_seq_timer_tick *tick,
69 unsigned long resolution)
69{ 70{
70 if (tick->resolution > 0) { 71 if (tick->resolution > 0) {
71 tick->fraction += resolution; 72 tick->fraction += resolution;
@@ -119,21 +120,22 @@ static inline void snd_seq_inc_time_nsec(snd_seq_real_time_t *tm, unsigned long
119} 120}
120 121
121/* called by timer isr */ 122/* called by timer isr */
122int snd_seq_timer_open(queue_t *q); 123struct snd_seq_queue;
123int snd_seq_timer_close(queue_t *q); 124int snd_seq_timer_open(struct snd_seq_queue *q);
124int snd_seq_timer_midi_open(queue_t *q); 125int snd_seq_timer_close(struct snd_seq_queue *q);
125int snd_seq_timer_midi_close(queue_t *q); 126int snd_seq_timer_midi_open(struct snd_seq_queue *q);
126void snd_seq_timer_defaults(seq_timer_t *tmr); 127int snd_seq_timer_midi_close(struct snd_seq_queue *q);
127void snd_seq_timer_reset(seq_timer_t *tmr); 128void snd_seq_timer_defaults(struct snd_seq_timer *tmr);
128int snd_seq_timer_stop(seq_timer_t *tmr); 129void snd_seq_timer_reset(struct snd_seq_timer *tmr);
129int snd_seq_timer_start(seq_timer_t *tmr); 130int snd_seq_timer_stop(struct snd_seq_timer *tmr);
130int snd_seq_timer_continue(seq_timer_t *tmr); 131int snd_seq_timer_start(struct snd_seq_timer *tmr);
131int snd_seq_timer_set_tempo(seq_timer_t *tmr, int tempo); 132int snd_seq_timer_continue(struct snd_seq_timer *tmr);
132int snd_seq_timer_set_ppq(seq_timer_t *tmr, int ppq); 133int snd_seq_timer_set_tempo(struct snd_seq_timer *tmr, int tempo);
133int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t position); 134int snd_seq_timer_set_ppq(struct snd_seq_timer *tmr, int ppq);
134int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t position); 135int snd_seq_timer_set_position_tick(struct snd_seq_timer *tmr, snd_seq_tick_time_t position);
135int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int base); 136int snd_seq_timer_set_position_time(struct snd_seq_timer *tmr, snd_seq_real_time_t position);
136snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr); 137int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew, unsigned int base);
137snd_seq_tick_time_t snd_seq_timer_get_cur_tick(seq_timer_t *tmr); 138snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr);
139snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr);
138 140
139#endif 141#endif
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index e4f512aa7426..ea2113968fe7 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -56,7 +56,8 @@ MODULE_LICENSE("GPL");
56/* 56/*
57 * initialize an event record 57 * initialize an event record
58 */ 58 */
59static void snd_virmidi_init_event(snd_virmidi_t *vmidi, snd_seq_event_t *ev) 59static void snd_virmidi_init_event(struct snd_virmidi *vmidi,
60 struct snd_seq_event *ev)
60{ 61{
61 memset(ev, 0, sizeof(*ev)); 62 memset(ev, 0, sizeof(*ev));
62 ev->source.port = vmidi->port; 63 ev->source.port = vmidi->port;
@@ -76,16 +77,17 @@ static void snd_virmidi_init_event(snd_virmidi_t *vmidi, snd_seq_event_t *ev)
76/* 77/*
77 * decode input event and put to read buffer of each opened file 78 * decode input event and put to read buffer of each opened file
78 */ 79 */
79static int snd_virmidi_dev_receive_event(snd_virmidi_dev_t *rdev, snd_seq_event_t *ev) 80static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,
81 struct snd_seq_event *ev)
80{ 82{
81 snd_virmidi_t *vmidi; 83 struct snd_virmidi *vmidi;
82 struct list_head *list; 84 struct list_head *list;
83 unsigned char msg[4]; 85 unsigned char msg[4];
84 int len; 86 int len;
85 87
86 read_lock(&rdev->filelist_lock); 88 read_lock(&rdev->filelist_lock);
87 list_for_each(list, &rdev->filelist) { 89 list_for_each(list, &rdev->filelist) {
88 vmidi = list_entry(list, snd_virmidi_t, list); 90 vmidi = list_entry(list, struct snd_virmidi, list);
89 if (!vmidi->trigger) 91 if (!vmidi->trigger)
90 continue; 92 continue;
91 if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { 93 if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
@@ -111,9 +113,9 @@ static int snd_virmidi_dev_receive_event(snd_virmidi_dev_t *rdev, snd_seq_event_
111 * SNDRV_VIRMIDI_SEQ_ATTACH. 113 * SNDRV_VIRMIDI_SEQ_ATTACH.
112 */ 114 */
113#if 0 115#if 0
114int snd_virmidi_receive(snd_rawmidi_t *rmidi, snd_seq_event_t *ev) 116int snd_virmidi_receive(struct snd_rawmidi *rmidi, struct snd_seq_event *ev)
115{ 117{
116 snd_virmidi_dev_t *rdev; 118 struct snd_virmidi_dev *rdev;
117 119
118 rdev = rmidi->private_data; 120 rdev = rmidi->private_data;
119 return snd_virmidi_dev_receive_event(rdev, ev); 121 return snd_virmidi_dev_receive_event(rdev, ev);
@@ -123,10 +125,10 @@ int snd_virmidi_receive(snd_rawmidi_t *rmidi, snd_seq_event_t *ev)
123/* 125/*
124 * event handler of virmidi port 126 * event handler of virmidi port
125 */ 127 */
126static int snd_virmidi_event_input(snd_seq_event_t *ev, int direct, 128static int snd_virmidi_event_input(struct snd_seq_event *ev, int direct,
127 void *private_data, int atomic, int hop) 129 void *private_data, int atomic, int hop)
128{ 130{
129 snd_virmidi_dev_t *rdev; 131 struct snd_virmidi_dev *rdev;
130 132
131 rdev = private_data; 133 rdev = private_data;
132 if (!(rdev->flags & SNDRV_VIRMIDI_USE)) 134 if (!(rdev->flags & SNDRV_VIRMIDI_USE))
@@ -137,9 +139,9 @@ static int snd_virmidi_event_input(snd_seq_event_t *ev, int direct,
137/* 139/*
138 * trigger rawmidi stream for input 140 * trigger rawmidi stream for input
139 */ 141 */
140static void snd_virmidi_input_trigger(snd_rawmidi_substream_t * substream, int up) 142static void snd_virmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
141{ 143{
142 snd_virmidi_t *vmidi = substream->runtime->private_data; 144 struct snd_virmidi *vmidi = substream->runtime->private_data;
143 145
144 if (up) { 146 if (up) {
145 vmidi->trigger = 1; 147 vmidi->trigger = 1;
@@ -151,9 +153,9 @@ static void snd_virmidi_input_trigger(snd_rawmidi_substream_t * substream, int u
151/* 153/*
152 * trigger rawmidi stream for output 154 * trigger rawmidi stream for output
153 */ 155 */
154static void snd_virmidi_output_trigger(snd_rawmidi_substream_t * substream, int up) 156static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream, int up)
155{ 157{
156 snd_virmidi_t *vmidi = substream->runtime->private_data; 158 struct snd_virmidi *vmidi = substream->runtime->private_data;
157 int count, res; 159 int count, res;
158 unsigned char buf[32], *pbuf; 160 unsigned char buf[32], *pbuf;
159 161
@@ -198,11 +200,11 @@ static void snd_virmidi_output_trigger(snd_rawmidi_substream_t * substream, int
198/* 200/*
199 * open rawmidi handle for input 201 * open rawmidi handle for input
200 */ 202 */
201static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream) 203static int snd_virmidi_input_open(struct snd_rawmidi_substream *substream)
202{ 204{
203 snd_virmidi_dev_t *rdev = substream->rmidi->private_data; 205 struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
204 snd_rawmidi_runtime_t *runtime = substream->runtime; 206 struct snd_rawmidi_runtime *runtime = substream->runtime;
205 snd_virmidi_t *vmidi; 207 struct snd_virmidi *vmidi;
206 unsigned long flags; 208 unsigned long flags;
207 209
208 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); 210 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
@@ -227,11 +229,11 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream)
227/* 229/*
228 * open rawmidi handle for output 230 * open rawmidi handle for output
229 */ 231 */
230static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream) 232static int snd_virmidi_output_open(struct snd_rawmidi_substream *substream)
231{ 233{
232 snd_virmidi_dev_t *rdev = substream->rmidi->private_data; 234 struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
233 snd_rawmidi_runtime_t *runtime = substream->runtime; 235 struct snd_rawmidi_runtime *runtime = substream->runtime;
234 snd_virmidi_t *vmidi; 236 struct snd_virmidi *vmidi;
235 237
236 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); 238 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
237 if (vmidi == NULL) 239 if (vmidi == NULL)
@@ -253,9 +255,9 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream)
253/* 255/*
254 * close rawmidi handle for input 256 * close rawmidi handle for input
255 */ 257 */
256static int snd_virmidi_input_close(snd_rawmidi_substream_t * substream) 258static int snd_virmidi_input_close(struct snd_rawmidi_substream *substream)
257{ 259{
258 snd_virmidi_t *vmidi = substream->runtime->private_data; 260 struct snd_virmidi *vmidi = substream->runtime->private_data;
259 snd_midi_event_free(vmidi->parser); 261 snd_midi_event_free(vmidi->parser);
260 list_del(&vmidi->list); 262 list_del(&vmidi->list);
261 substream->runtime->private_data = NULL; 263 substream->runtime->private_data = NULL;
@@ -266,9 +268,9 @@ static int snd_virmidi_input_close(snd_rawmidi_substream_t * substream)
266/* 268/*
267 * close rawmidi handle for output 269 * close rawmidi handle for output
268 */ 270 */
269static int snd_virmidi_output_close(snd_rawmidi_substream_t * substream) 271static int snd_virmidi_output_close(struct snd_rawmidi_substream *substream)
270{ 272{
271 snd_virmidi_t *vmidi = substream->runtime->private_data; 273 struct snd_virmidi *vmidi = substream->runtime->private_data;
272 snd_midi_event_free(vmidi->parser); 274 snd_midi_event_free(vmidi->parser);
273 substream->runtime->private_data = NULL; 275 substream->runtime->private_data = NULL;
274 kfree(vmidi); 276 kfree(vmidi);
@@ -278,9 +280,10 @@ static int snd_virmidi_output_close(snd_rawmidi_substream_t * substream)
278/* 280/*
279 * subscribe callback - allow output to rawmidi device 281 * subscribe callback - allow output to rawmidi device
280 */ 282 */
281static int snd_virmidi_subscribe(void *private_data, snd_seq_port_subscribe_t *info) 283static int snd_virmidi_subscribe(void *private_data,
284 struct snd_seq_port_subscribe *info)
282{ 285{
283 snd_virmidi_dev_t *rdev; 286 struct snd_virmidi_dev *rdev;
284 287
285 rdev = private_data; 288 rdev = private_data;
286 if (!try_module_get(rdev->card->module)) 289 if (!try_module_get(rdev->card->module))
@@ -292,9 +295,10 @@ static int snd_virmidi_subscribe(void *private_data, snd_seq_port_subscribe_t *i
292/* 295/*
293 * unsubscribe callback - disallow output to rawmidi device 296 * unsubscribe callback - disallow output to rawmidi device
294 */ 297 */
295static int snd_virmidi_unsubscribe(void *private_data, snd_seq_port_subscribe_t *info) 298static int snd_virmidi_unsubscribe(void *private_data,
299 struct snd_seq_port_subscribe *info)
296{ 300{
297 snd_virmidi_dev_t *rdev; 301 struct snd_virmidi_dev *rdev;
298 302
299 rdev = private_data; 303 rdev = private_data;
300 rdev->flags &= ~SNDRV_VIRMIDI_SUBSCRIBE; 304 rdev->flags &= ~SNDRV_VIRMIDI_SUBSCRIBE;
@@ -306,9 +310,10 @@ static int snd_virmidi_unsubscribe(void *private_data, snd_seq_port_subscribe_t
306/* 310/*
307 * use callback - allow input to rawmidi device 311 * use callback - allow input to rawmidi device
308 */ 312 */
309static int snd_virmidi_use(void *private_data, snd_seq_port_subscribe_t *info) 313static int snd_virmidi_use(void *private_data,
314 struct snd_seq_port_subscribe *info)
310{ 315{
311 snd_virmidi_dev_t *rdev; 316 struct snd_virmidi_dev *rdev;
312 317
313 rdev = private_data; 318 rdev = private_data;
314 if (!try_module_get(rdev->card->module)) 319 if (!try_module_get(rdev->card->module))
@@ -320,9 +325,10 @@ static int snd_virmidi_use(void *private_data, snd_seq_port_subscribe_t *info)
320/* 325/*
321 * unuse callback - disallow input to rawmidi device 326 * unuse callback - disallow input to rawmidi device
322 */ 327 */
323static int snd_virmidi_unuse(void *private_data, snd_seq_port_subscribe_t *info) 328static int snd_virmidi_unuse(void *private_data,
329 struct snd_seq_port_subscribe *info)
324{ 330{
325 snd_virmidi_dev_t *rdev; 331 struct snd_virmidi_dev *rdev;
326 332
327 rdev = private_data; 333 rdev = private_data;
328 rdev->flags &= ~SNDRV_VIRMIDI_USE; 334 rdev->flags &= ~SNDRV_VIRMIDI_USE;
@@ -335,13 +341,13 @@ static int snd_virmidi_unuse(void *private_data, snd_seq_port_subscribe_t *info)
335 * Register functions 341 * Register functions
336 */ 342 */
337 343
338static snd_rawmidi_ops_t snd_virmidi_input_ops = { 344static struct snd_rawmidi_ops snd_virmidi_input_ops = {
339 .open = snd_virmidi_input_open, 345 .open = snd_virmidi_input_open,
340 .close = snd_virmidi_input_close, 346 .close = snd_virmidi_input_close,
341 .trigger = snd_virmidi_input_trigger, 347 .trigger = snd_virmidi_input_trigger,
342}; 348};
343 349
344static snd_rawmidi_ops_t snd_virmidi_output_ops = { 350static struct snd_rawmidi_ops snd_virmidi_output_ops = {
345 .open = snd_virmidi_output_open, 351 .open = snd_virmidi_output_open,
346 .close = snd_virmidi_output_close, 352 .close = snd_virmidi_output_close,
347 .trigger = snd_virmidi_output_trigger, 353 .trigger = snd_virmidi_output_trigger,
@@ -350,13 +356,13 @@ static snd_rawmidi_ops_t snd_virmidi_output_ops = {
350/* 356/*
351 * create a sequencer client and a port 357 * create a sequencer client and a port
352 */ 358 */
353static int snd_virmidi_dev_attach_seq(snd_virmidi_dev_t *rdev) 359static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
354{ 360{
355 int client; 361 int client;
356 snd_seq_client_callback_t callbacks; 362 struct snd_seq_client_callback callbacks;
357 snd_seq_port_callback_t pcallbacks; 363 struct snd_seq_port_callback pcallbacks;
358 snd_seq_client_info_t *info; 364 struct snd_seq_client_info *info;
359 snd_seq_port_info_t *pinfo; 365 struct snd_seq_port_info *pinfo;
360 int err; 366 int err;
361 367
362 if (rdev->client >= 0) 368 if (rdev->client >= 0)
@@ -426,7 +432,7 @@ static int snd_virmidi_dev_attach_seq(snd_virmidi_dev_t *rdev)
426/* 432/*
427 * release the sequencer client 433 * release the sequencer client
428 */ 434 */
429static void snd_virmidi_dev_detach_seq(snd_virmidi_dev_t *rdev) 435static void snd_virmidi_dev_detach_seq(struct snd_virmidi_dev *rdev)
430{ 436{
431 if (rdev->client >= 0) { 437 if (rdev->client >= 0) {
432 snd_seq_delete_kernel_client(rdev->client); 438 snd_seq_delete_kernel_client(rdev->client);
@@ -437,9 +443,9 @@ static void snd_virmidi_dev_detach_seq(snd_virmidi_dev_t *rdev)
437/* 443/*
438 * register the device 444 * register the device
439 */ 445 */
440static int snd_virmidi_dev_register(snd_rawmidi_t *rmidi) 446static int snd_virmidi_dev_register(struct snd_rawmidi *rmidi)
441{ 447{
442 snd_virmidi_dev_t *rdev = rmidi->private_data; 448 struct snd_virmidi_dev *rdev = rmidi->private_data;
443 int err; 449 int err;
444 450
445 switch (rdev->seq_mode) { 451 switch (rdev->seq_mode) {
@@ -464,9 +470,9 @@ static int snd_virmidi_dev_register(snd_rawmidi_t *rmidi)
464/* 470/*
465 * unregister the device 471 * unregister the device
466 */ 472 */
467static int snd_virmidi_dev_unregister(snd_rawmidi_t *rmidi) 473static int snd_virmidi_dev_unregister(struct snd_rawmidi *rmidi)
468{ 474{
469 snd_virmidi_dev_t *rdev = rmidi->private_data; 475 struct snd_virmidi_dev *rdev = rmidi->private_data;
470 476
471 if (rdev->seq_mode == SNDRV_VIRMIDI_SEQ_DISPATCH) 477 if (rdev->seq_mode == SNDRV_VIRMIDI_SEQ_DISPATCH)
472 snd_virmidi_dev_detach_seq(rdev); 478 snd_virmidi_dev_detach_seq(rdev);
@@ -476,7 +482,7 @@ static int snd_virmidi_dev_unregister(snd_rawmidi_t *rmidi)
476/* 482/*
477 * 483 *
478 */ 484 */
479static snd_rawmidi_global_ops_t snd_virmidi_global_ops = { 485static struct snd_rawmidi_global_ops snd_virmidi_global_ops = {
480 .dev_register = snd_virmidi_dev_register, 486 .dev_register = snd_virmidi_dev_register,
481 .dev_unregister = snd_virmidi_dev_unregister, 487 .dev_unregister = snd_virmidi_dev_unregister,
482}; 488};
@@ -484,9 +490,9 @@ static snd_rawmidi_global_ops_t snd_virmidi_global_ops = {
484/* 490/*
485 * free device 491 * free device
486 */ 492 */
487static void snd_virmidi_free(snd_rawmidi_t *rmidi) 493static void snd_virmidi_free(struct snd_rawmidi *rmidi)
488{ 494{
489 snd_virmidi_dev_t *rdev = rmidi->private_data; 495 struct snd_virmidi_dev *rdev = rmidi->private_data;
490 kfree(rdev); 496 kfree(rdev);
491} 497}
492 498
@@ -495,10 +501,10 @@ static void snd_virmidi_free(snd_rawmidi_t *rmidi)
495 * 501 *
496 */ 502 */
497/* exported */ 503/* exported */
498int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi) 504int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi)
499{ 505{
500 snd_rawmidi_t *rmidi; 506 struct snd_rawmidi *rmidi;
501 snd_virmidi_dev_t *rdev; 507 struct snd_virmidi_dev *rdev;
502 int err; 508 int err;
503 509
504 *rrmidi = NULL; 510 *rrmidi = NULL;