Commit c7e0b5bf authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: Sequencer

Modules: ALSA sequencer

Remove xxx_t typedefs from the core sequencer codes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6ac77bc1
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
*/ */
/** system messages /** system messages
* event data type = #sndrv_seq_result_t * event data type = #snd_seq_result
*/ */
#define SNDRV_SEQ_EVENT_SYSTEM 0 #define SNDRV_SEQ_EVENT_SYSTEM 0
#define SNDRV_SEQ_EVENT_RESULT 1 #define SNDRV_SEQ_EVENT_RESULT 1
/** note messages (channel specific) /** note messages (channel specific)
* event data type = #sndrv_seq_ev_note * event data type = #snd_seq_ev_note
*/ */
#define SNDRV_SEQ_EVENT_NOTE 5 #define SNDRV_SEQ_EVENT_NOTE 5
#define SNDRV_SEQ_EVENT_NOTEON 6 #define SNDRV_SEQ_EVENT_NOTEON 6
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#define SNDRV_SEQ_EVENT_KEYPRESS 8 #define SNDRV_SEQ_EVENT_KEYPRESS 8
/** control messages (channel specific) /** control messages (channel specific)
* event data type = #sndrv_seq_ev_ctrl * event data type = #snd_seq_ev_ctrl
*/ */
#define SNDRV_SEQ_EVENT_CONTROLLER 10 #define SNDRV_SEQ_EVENT_CONTROLLER 10
#define SNDRV_SEQ_EVENT_PGMCHANGE 11 #define SNDRV_SEQ_EVENT_PGMCHANGE 11
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
/** synchronisation messages /** synchronisation messages
* event data type = #sndrv_seq_ev_ctrl * event data type = #snd_seq_ev_ctrl
*/ */
#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
/** timer messages /** timer messages
* event data type = sndrv_seq_ev_queue_control_t * event data type = snd_seq_ev_queue_control
*/ */
#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
/** system status messages (broadcast for subscribers) /** system status messages (broadcast for subscribers)
* event data type = sndrv_seq_addr_t * event data type = snd_seq_addr
*/ */
#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
...@@ -105,13 +105,13 @@ ...@@ -105,13 +105,13 @@
#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
/** port connection changes /** port connection changes
* event data type = sndrv_seq_connect_t * event data type = snd_seq_connect
*/ */
#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
/** synthesizer events /** synthesizer events
* event data type = sndrv_seq_eve_sample_control_t * event data type = snd_seq_eve_sample_control
*/ */
#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ #define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ #define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
/* 119-129: reserved */ /* 119-129: reserved */
/* 130-139: variable length events /* 130-139: variable length events
* event data type = sndrv_seq_ev_ext * event data type = snd_seq_ev_ext
* (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
*/ */
#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
...@@ -186,18 +186,18 @@ ...@@ -186,18 +186,18 @@
#define SNDRV_SEQ_EVENT_NONE 255 #define SNDRV_SEQ_EVENT_NONE 255
typedef unsigned char sndrv_seq_event_type_t; typedef unsigned char snd_seq_event_type_t;
/** event address */ /** event address */
struct sndrv_seq_addr { struct snd_seq_addr {
unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
}; };
/** port connection */ /** port connection */
struct sndrv_seq_connect { struct snd_seq_connect {
struct sndrv_seq_addr sender; struct snd_seq_addr sender;
struct sndrv_seq_addr dest; struct snd_seq_addr dest;
}; };
...@@ -226,7 +226,7 @@ struct sndrv_seq_connect { ...@@ -226,7 +226,7 @@ struct sndrv_seq_connect {
/* note event */ /* note event */
struct sndrv_seq_ev_note { struct snd_seq_ev_note {
unsigned char channel; unsigned char channel;
unsigned char note; unsigned char note;
unsigned char velocity; unsigned char velocity;
...@@ -235,7 +235,7 @@ struct sndrv_seq_ev_note { ...@@ -235,7 +235,7 @@ struct sndrv_seq_ev_note {
}; };
/* controller event */ /* controller event */
struct sndrv_seq_ev_ctrl { struct snd_seq_ev_ctrl {
unsigned char channel; unsigned char channel;
unsigned char unused1, unused2, unused3; /* pad */ unsigned char unused1, unused2, unused3; /* pad */
unsigned int param; unsigned int param;
...@@ -243,59 +243,59 @@ struct sndrv_seq_ev_ctrl { ...@@ -243,59 +243,59 @@ struct sndrv_seq_ev_ctrl {
}; };
/* generic set of bytes (12x8 bit) */ /* generic set of bytes (12x8 bit) */
struct sndrv_seq_ev_raw8 { struct snd_seq_ev_raw8 {
unsigned char d[12]; /* 8 bit value */ unsigned char d[12]; /* 8 bit value */
}; };
/* generic set of integers (3x32 bit) */ /* generic set of integers (3x32 bit) */
struct sndrv_seq_ev_raw32 { struct snd_seq_ev_raw32 {
unsigned int d[3]; /* 32 bit value */ unsigned int d[3]; /* 32 bit value */
}; };
/* external stored data */ /* external stored data */
struct sndrv_seq_ev_ext { struct snd_seq_ev_ext {
unsigned int len; /* length of data */ unsigned int len; /* length of data */
void *ptr; /* pointer to data (note: maybe 64-bit) */ void *ptr; /* pointer to data (note: maybe 64-bit) */
} __attribute__((packed)); } __attribute__((packed));
/* Instrument cluster type */ /* Instrument cluster type */
typedef unsigned int sndrv_seq_instr_cluster_t; typedef unsigned int snd_seq_instr_cluster_t;
/* Instrument type */ /* Instrument type */
struct sndrv_seq_instr { struct snd_seq_instr {
sndrv_seq_instr_cluster_t cluster; snd_seq_instr_cluster_t cluster;
unsigned int std; /* the upper byte means a private instrument (owner - client #) */ unsigned int std; /* the upper byte means a private instrument (owner - client #) */
unsigned short bank; unsigned short bank;
unsigned short prg; unsigned short prg;
}; };
/* sample number */ /* sample number */
struct sndrv_seq_ev_sample { struct snd_seq_ev_sample {
unsigned int std; unsigned int std;
unsigned short bank; unsigned short bank;
unsigned short prg; unsigned short prg;
}; };
/* sample cluster */ /* sample cluster */
struct sndrv_seq_ev_cluster { struct snd_seq_ev_cluster {
sndrv_seq_instr_cluster_t cluster; snd_seq_instr_cluster_t cluster;
}; };
/* sample position */ /* sample position */
typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */ typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
/* sample stop mode */ /* sample stop mode */
enum sndrv_seq_stop_mode { enum {
SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
}; };
/* sample frequency */ /* sample frequency */
typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */ typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
/* sample volume control; if any value is set to -1 == do not change */ /* sample volume control; if any value is set to -1 == do not change */
struct sndrv_seq_ev_volume { struct snd_seq_ev_volume {
signed short volume; /* range: 0-16383 */ signed short volume; /* range: 0-16383 */
signed short lr; /* left-right balance; range: 0-16383 */ signed short lr; /* left-right balance; range: 0-16383 */
signed short fr; /* front-rear balance; range: 0-16383 */ signed short fr; /* front-rear balance; range: 0-16383 */
...@@ -303,22 +303,22 @@ struct sndrv_seq_ev_volume { ...@@ -303,22 +303,22 @@ struct sndrv_seq_ev_volume {
}; };
/* simple loop redefinition */ /* simple loop redefinition */
struct sndrv_seq_ev_loop { struct snd_seq_ev_loop {
unsigned int start; /* loop start (in samples) * 16 */ unsigned int start; /* loop start (in samples) * 16 */
unsigned int end; /* loop end (in samples) * 16 */ unsigned int end; /* loop end (in samples) * 16 */
}; };
struct sndrv_seq_ev_sample_control { struct snd_seq_ev_sample_control {
unsigned char channel; unsigned char channel;
unsigned char unused1, unused2, unused3; /* pad */ unsigned char unused1, unused2, unused3; /* pad */
union { union {
struct sndrv_seq_ev_sample sample; struct snd_seq_ev_sample sample;
struct sndrv_seq_ev_cluster cluster; struct snd_seq_ev_cluster cluster;
sndrv_seq_position_t position; snd_seq_position_t position;
enum sndrv_seq_stop_mode stop_mode; int stop_mode;
sndrv_seq_frequency_t frequency; snd_seq_frequency_t frequency;
struct sndrv_seq_ev_volume volume; struct snd_seq_ev_volume volume;
struct sndrv_seq_ev_loop loop; struct snd_seq_ev_loop loop;
unsigned char raw8[8]; unsigned char raw8[8];
} param; } param;
}; };
...@@ -326,82 +326,82 @@ struct sndrv_seq_ev_sample_control { ...@@ -326,82 +326,82 @@ struct sndrv_seq_ev_sample_control {
/* INSTR_BEGIN event */ /* INSTR_BEGIN event */
struct sndrv_seq_ev_instr_begin { struct snd_seq_ev_instr_begin {
int timeout; /* zero = forever, otherwise timeout in ms */ int timeout; /* zero = forever, otherwise timeout in ms */
}; };
struct sndrv_seq_result { struct snd_seq_result {
int event; /* processed event type */ int event; /* processed event type */
int result; int result;
}; };
struct sndrv_seq_real_time { struct snd_seq_real_time {
unsigned int tv_sec; /* seconds */ unsigned int tv_sec; /* seconds */
unsigned int tv_nsec; /* nanoseconds */ unsigned int tv_nsec; /* nanoseconds */
}; };
typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */ typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
union sndrv_seq_timestamp { union snd_seq_timestamp {
sndrv_seq_tick_time_t tick; snd_seq_tick_time_t tick;
struct sndrv_seq_real_time time; struct snd_seq_real_time time;
}; };
struct sndrv_seq_queue_skew { struct snd_seq_queue_skew {
unsigned int value; unsigned int value;
unsigned int base; unsigned int base;
}; };
/* queue timer control */ /* queue timer control */
struct sndrv_seq_ev_queue_control { struct snd_seq_ev_queue_control {
unsigned char queue; /* affected queue */ unsigned char queue; /* affected queue */
unsigned char pad[3]; /* reserved */ unsigned char pad[3]; /* reserved */
union { union {
signed int value; /* affected value (e.g. tempo) */ signed int value; /* affected value (e.g. tempo) */
union sndrv_seq_timestamp time; /* time */ union snd_seq_timestamp time; /* time */
unsigned int position; /* sync position */ unsigned int position; /* sync position */
struct sndrv_seq_queue_skew skew; struct snd_seq_queue_skew skew;
unsigned int d32[2]; unsigned int d32[2];
unsigned char d8[8]; unsigned char d8[8];
} param; } param;
}; };
/* quoted event - inside the kernel only */ /* quoted event - inside the kernel only */
struct sndrv_seq_ev_quote { struct snd_seq_ev_quote {
struct sndrv_seq_addr origin; /* original sender */ struct snd_seq_addr origin; /* original sender */
unsigned short value; /* optional data */ unsigned short value; /* optional data */
struct sndrv_seq_event *event; /* quoted event */ struct snd_seq_event *event; /* quoted event */
} __attribute__((packed)); } __attribute__((packed));
/* sequencer event */ /* sequencer event */
struct sndrv_seq_event { struct snd_seq_event {
sndrv_seq_event_type_t type; /* event type */ snd_seq_event_type_t type; /* event type */
unsigned char flags; /* event flags */ unsigned char flags; /* event flags */
char tag; char tag;
unsigned char queue; /* schedule queue */ unsigned char queue; /* schedule queue */
union sndrv_seq_timestamp time; /* schedule time */ union snd_seq_timestamp time; /* schedule time */
struct sndrv_seq_addr source; /* source address */ struct snd_seq_addr source; /* source address */
struct sndrv_seq_addr dest; /* destination address */ struct snd_seq_addr dest; /* destination address */
union { /* event data... */ union { /* event data... */
struct sndrv_seq_ev_note note; struct snd_seq_ev_note note;
struct sndrv_seq_ev_ctrl control; struct snd_seq_ev_ctrl control;
struct sndrv_seq_ev_raw8 raw8; struct snd_seq_ev_raw8 raw8;
struct sndrv_seq_ev_raw32 raw32; struct snd_seq_ev_raw32 raw32;
struct sndrv_seq_ev_ext ext; struct snd_seq_ev_ext ext;
struct sndrv_seq_ev_queue_control queue; struct snd_seq_ev_queue_control queue;
union sndrv_seq_timestamp time; union snd_seq_timestamp time;
struct sndrv_seq_addr addr; struct snd_seq_addr addr;
struct sndrv_seq_connect connect; struct snd_seq_connect connect;
struct sndrv_seq_result result; struct snd_seq_result result;
struct sndrv_seq_ev_instr_begin instr_begin; struct snd_seq_ev_instr_begin instr_begin;
struct sndrv_seq_ev_sample_control sample; struct snd_seq_ev_sample_control sample;
struct sndrv_seq_ev_quote quote; struct snd_seq_ev_quote quote;
} data; } data;
}; };
...@@ -409,72 +409,77 @@ struct sndrv_seq_event { ...@@ -409,72 +409,77 @@ struct sndrv_seq_event {
/* /*
* bounce event - stored as variable size data * bounce event - stored as variable size data
*/ */
struct sndrv_seq_event_bounce { struct snd_seq_event_bounce {
int err; int err;
struct sndrv_seq_event event; struct snd_seq_event event;
/* external data follows here. */ /* external data follows here. */
}; };
#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t))) #ifdef __KERNEL__
/* helper macro */
#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
/* /*
* type check macros * type check macros
*/ */
/* result events: 0-4 */ /* result events: 0-4 */
#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5) #define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
/* channel specific events: 5-19 */ /* channel specific events: 5-19 */
#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) #define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
/* note events: 5-9 */ /* note events: 5-9 */
#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) #define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
/* control events: 10-19 */ /* control events: 10-19 */
#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) #define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
/* queue control events: 30-39 */ /* queue control events: 30-39 */
#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) #define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
/* system status messages */ /* system status messages */
#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) #define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
/* sample messages */ /* sample messages */
#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) #define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
/* user-defined messages */ /* user-defined messages */
#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) #define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
/* fixed length events: 0-99 */ /* fixed length events: 0-99 */
#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100) #define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
/* instrument layer events: 100-129 */ /* instrument layer events: 100-129 */
#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) #define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
/* variable length events: 130-139 */ /* variable length events: 130-139 */
#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) #define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
/* reserved for kernel */ /* reserved for kernel */
#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150) #define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
/* direct dispatched events */ /* direct dispatched events */
#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) #define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
/* /*
* macros to check event flags * macros to check event flags
*/ */
/* prior events */ /* prior events */
#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) #define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
/* event length type */ /* event length type */
#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) #define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) #define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) #define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) #define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
/* time-stamp type */ /* time-stamp type */
#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) #define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) #define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) #define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
/* time-mode type */ /* time-mode type */
#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) #define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) #define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) #define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
/* queue sync port */ /* queue sync port */
#define sndrv_seq_queue_sync_port(q) ((q) + 16) #define snd_seq_queue_sync_port(q) ((q) + 16)
#endif /* __KERNEL__ */
/* system information */ /* system information */
struct sndrv_seq_system_info { struct snd_seq_system_info {
int queues; /* maximum queues count */ int queues; /* maximum queues count */
int clients; /* maximum clients count */ int clients; /* maximum clients count */
int ports; /* maximum ports per client */ int ports; /* maximum ports per client */
...@@ -486,7 +491,7 @@ struct sndrv_seq_system_info { ...@@ -486,7 +491,7 @@ struct sndrv_seq_system_info {
/* system running information */ /* system running information */
struct sndrv_seq_running_info { struct snd_seq_running_info {
unsigned char client; /* client id */ unsigned char client; /* client id */
unsigned char big_endian; /* 1 = big-endian */ unsigned char big_endian; /* 1 = big-endian */
unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
...@@ -502,11 +507,10 @@ struct sndrv_seq_running_info { ...@@ -502,11 +507,10 @@ struct sndrv_seq_running_info {
/* client types */ /* client types */
enum sndrv_seq_client_type { typedef int __bitwise snd_seq_client_type_t;
NO_CLIENT = 0, #define NO_CLIENT ((__force snd_seq_client_type_t) 0)
USER_CLIENT = 1, #define USER_CLIENT ((__force snd_seq_client_type_t) 1)
KERNEL_CLIENT = 2 #define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
};
/* event filter flags */ /* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ #define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
...@@ -514,9 +518,9 @@ enum sndrv_seq_client_type { ...@@ -514,9 +518,9 @@ enum sndrv_seq_client_type {
#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ #define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ #define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
struct sndrv_seq_client_info { struct snd_seq_client_info {
int client; /* client number to inquire */ int client; /* client number to inquire */
enum sndrv_seq_client_type type; /* client type */ snd_seq_client_type_t type; /* client type */
char name[64]; /* client name */ char name[64]; /* client name */
unsigned int filter; /* filter flags */ unsigned int filter; /* filter flags */
unsigned char multicast_filter[8]; /* multicast filter bitmap */ unsigned char multicast_filter[8]; /* multicast filter bitmap */
...@@ -528,7 +532,7 @@ struct sndrv_seq_client_info { ...@@ -528,7 +532,7 @@ struct sndrv_seq_client_info {
/* client pool size */ /* client pool size */
struct sndrv_seq_client_pool { struct snd_seq_client_pool {
int client; /* client number to inquire */ int client; /* client number to inquire */
int output_pool; /* outgoing (write) pool size */ int output_pool; /* outgoing (write) pool size */
int input_pool; /* incoming (read) pool size */ int input_pool; /* incoming (read) pool size */
...@@ -552,13 +556,13 @@ struct sndrv_seq_client_pool { ...@@ -552,13 +556,13 @@ struct sndrv_seq_client_pool {
#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
struct sndrv_seq_remove_events { struct snd_seq_remove_events {
unsigned int remove_mode; /* Flags that determine what gets removed */ unsigned int remove_mode; /* Flags that determine what gets removed */
union sndrv_seq_timestamp time; union snd_seq_timestamp time;
unsigned char queue; /* Queue for REMOVE_DEST */ unsigned char queue; /* Queue for REMOVE_DEST */
struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */ struct snd_seq_addr dest; /* Address for REMOVE_DEST */
unsigned char channel; /* Channel for REMOVE_DEST */ unsigned char channel; /* Channel for REMOVE_DEST */
int type; /* For REMOVE_EVENT_TYPE */ int type; /* For REMOVE_EVENT_TYPE */
...@@ -607,8 +611,8 @@ struct sndrv_seq_remove_events { ...@@ -607,8 +611,8 @@ struct sndrv_seq_remove_events {
#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
struct sndrv_seq_port_info { struct snd_seq_port_info {
struct sndrv_seq_addr addr; /* client/port numbers */ struct snd_seq_addr addr; /* client/port numbers */
char name[64]; /* port name */ char name[64]; /* port name */
unsigned int capability; /* port capability bits */ unsigned int capability; /* port capability bits */
...@@ -631,7 +635,7 @@ struct sndrv_seq_port_info { ...@@ -631,7 +635,7 @@ struct sndrv_seq_port_info {
#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
/* queue information */ /* queue information */
struct sndrv_seq_queue_info { struct snd_seq_queue_info {
int queue; /* queue id */ int queue; /* queue id */
/* /*
...@@ -647,11 +651,11 @@ struct sndrv_seq_queue_info { ...@@ -647,11 +651,11 @@ struct sndrv_seq_queue_info {
}; };
/* queue info/status */ /* queue info/status */
struct sndrv_seq_queue_status { struct snd_seq_queue_status {
int queue; /* queue id */ int queue; /* queue id */
int events; /* read-only - queue size */ int events; /* read-only - queue size */
sndrv_seq_tick_time_t tick; /* current tick */ snd_seq_tick_time_t tick; /* current tick */
struct sndrv_seq_real_time time; /* current time */ struct snd_seq_real_time time; /* current time */
int running; /* running state of queue */ int running; /* running state of queue */
int flags; /* various flags */ int flags; /* various flags */
char reserved[64]; /* for the future */ char reserved[64]; /* for the future */
...@@ -659,7 +663,7 @@ struct sndrv_seq_queue_status { ...@@ -659,7 +663,7 @@ struct sndrv_seq_queue_status {
/* queue tempo */ /* queue tempo */
struct sndrv_seq_queue_tempo { struct snd_seq_queue_tempo {
int queue; /* sequencer queue */ int queue; /* sequencer queue */
unsigned int tempo; /* current tempo, us/tick */ unsigned int tempo; /* current tempo, us/tick */
int ppq; /* time resolution, ticks/quarter */ int ppq; /* time resolution, ticks/quarter */
...@@ -675,12 +679,12 @@ struct sndrv_seq_queue_tempo { ...@@ -675,12 +679,12 @@ struct sndrv_seq_queue_tempo {
#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
/* queue timer info */ /* queue timer info */
struct sndrv_seq_queue_timer { struct snd_seq_queue_timer {
int queue; /* sequencer queue */ int queue; /* sequencer queue */
int type; /* source timer type */ int type; /* source timer type */
union { union {
struct { struct {
struct sndrv_timer_id id; /* ALSA's timer ID */ struct snd_timer_id id; /* ALSA's timer ID */
unsigned int resolution; /* resolution in Hz */ unsigned int resolution; /* resolution in Hz */
} alsa; } alsa;
} u; } u;
...@@ -688,7 +692,7 @@ struct sndrv_seq_queue_timer { ...@@ -688,7 +692,7 @@ struct sndrv_seq_queue_timer {
}; };
struct sndrv_seq_queue_client { struct snd_seq_queue_client {
int queue; /* sequencer queue */ int queue; /* sequencer queue */
int client; /* sequencer client */ int client; /* sequencer client */
int used; /* queue is used with this client int used; /* queue is used with this client
...@@ -702,9 +706,9 @@ struct sndrv_seq_queue_client { ...@@ -702,9 +706,9 @@ struct sndrv_seq_queue_client {
#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
struct sndrv_seq_port_subscribe { struct snd_seq_port_subscribe {
struct sndrv_seq_addr sender; /* sender address */ struct snd_seq_addr sender; /* sender address */
struct sndrv_seq_addr dest; /* destination address */ struct snd_seq_addr dest; /* destination address */
unsigned int voices; /* number of voices to be allocated (0 = don't care) */ unsigned int voices; /* number of voices to be allocated (0 = don't care) */
unsigned int flags; /* modes */ unsigned int flags; /* modes */
unsigned char queue; /* input time-stamp queue (optional) */ unsigned char queue; /* input time-stamp queue (optional) */
...@@ -716,12 +720,12 @@ struct sndrv_seq_port_subscribe { ...@@ -716,12 +720,12 @@ struct sndrv_seq_port_subscribe {
#define SNDRV_SEQ_QUERY_SUBS_READ 0 #define SNDRV_SEQ_QUERY_SUBS_READ 0
#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 #define SNDRV_SEQ_QUERY_SUBS_WRITE 1
struct sndrv_seq_query_subs { struct snd_seq_query_subs {
struct sndrv_seq_addr root; /* client/port id to be searched */ struct snd_seq_addr root; /* client/port id to be searched */
int type; /* READ or WRITE */ int type; /* READ or WRITE */
int index; /* 0..N-1 */ int index; /* 0..N-1 */
int num_subs; /* R/O: number of subscriptions on this port */ int num_subs; /* R/O: number of subscriptions on this port */
struct sndrv_seq_addr addr; /* R/O: result */ struct snd_seq_addr addr; /* R/O: result */
unsigned char queue; /* R/O: result */ unsigned char queue; /* R/O: result */
unsigned int flags; /* R/O: result */ unsigned int flags; /* R/O: result */
char reserved[64]; /* for future use */ char reserved[64]; /* for future use */
...@@ -778,72 +782,72 @@ struct sndrv_seq_query_subs { ...@@ -778,72 +782,72 @@ struct sndrv_seq_query_subs {
#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 #define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
/* size of ROM/RAM */ /* size of ROM/RAM */
typedef unsigned int sndrv_seq_instr_size_t; typedef unsigned int snd_seq_instr_size_t;
/* INSTR_INFO */ /* INSTR_INFO */
struct sndrv_seq_instr_info { struct snd_seq_instr_info {
int result; /* operation result */ int result; /* operation result */
unsigned int formats[8]; /* bitmap of supported formats */ unsigned int formats[8]; /* bitmap of supported formats */
int ram_count; /* count of RAM banks */ int ram_count; /* count of RAM banks */
sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
int rom_count; /* count of ROM banks */ int rom_count; /* count of ROM banks */
sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
char reserved[128]; char reserved[128];
}; };
/* INSTR_STATUS */ /* INSTR_STATUS */
struct sndrv_seq_instr_status { struct snd_seq_instr_status {
int result; /* operation result */ int result; /* operation result */
sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */ snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
int instrument_count; /* count of downloaded instruments */ int instrument_count; /* count of downloaded instruments */
char reserved[128]; char reserved[128];
}; };
/* INSTR_FORMAT_INFO */ /* INSTR_FORMAT_INFO */
struct sndrv_seq_instr_format_info { struct snd_seq_instr_format_info {
char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
unsigned int len; /* max data length (without this structure) */ unsigned int len; /* max data length (without this structure) */
}; };
struct sndrv_seq_instr_format_info_result { struct snd_seq_instr_format_info_result {
int result; /* operation result */ int result; /* operation result */
char format[16]; /* format identifier */ char format[16]; /* format identifier */
unsigned int len; /* filled data length (without this structure) */ unsigned int len; /* filled data length (without this structure) */
}; };
/* instrument data */ /* instrument data */
struct sndrv_seq_instr_data { struct snd_seq_instr_data {
char name[32]; /* instrument name */ char name[32]; /* instrument name */
char reserved[16]; /* for the future use */ char reserved[16]; /* for the future use */
int type; /* instrument type */ int type; /* instrument type */
union { union {
char format[16]; /* format identifier */ char format[16]; /* format identifier */
struct sndrv_seq_instr alias; struct snd_seq_instr alias;
} data; } data;
}; };
/* INSTR_PUT/GET, data are stored in one block (extended), header + data */ /* INSTR_PUT/GET, data are stored in one block (extended), header + data */
struct sndrv_seq_instr_header { struct snd_seq_instr_header {
union { union {
struct sndrv_seq_instr instr; struct snd_seq_instr instr;
sndrv_seq_instr_cluster_t cluster; snd_seq_instr_cluster_t cluster;
} id; /* instrument identifier */ } id; /* instrument identifier */
unsigned int cmd; /* get/put/free command */ unsigned int cmd; /* get/put/free command */
unsigned int flags; /* query flags (only for get) */ unsigned int flags; /* query flags (only for get) */
unsigned int len; /* real instrument data length (without header) */ unsigned int len; /* real instrument data length (without header) */
int result; /* operation result */ int result; /* operation result */
char reserved[16]; /* for the future */ char reserved[16]; /* for the future */
struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */ struct snd_seq_instr_data data; /* instrument data (for put/get result) */
}; };
/* INSTR_CLUSTER_SET */ /* INSTR_CLUSTER_SET */
struct sndrv_seq_instr_cluster_set { struct snd_seq_instr_cluster_set {
sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ snd_seq_instr_cluster_t cluster; /* cluster identifier */
char name[32]; /* cluster name */ char name[32]; /* cluster name */
int priority; /* cluster priority */ int priority; /* cluster priority */
char reserved[64]; /* for the future use */ char reserved[64]; /* for the future use */
...@@ -851,8 +855,8 @@ struct sndrv_seq_instr_cluster_set { ...@@ -851,8 +855,8 @@ struct sndrv_seq_instr_cluster_set {
/* INSTR_CLUSTER_GET */ /* INSTR_CLUSTER_GET */
struct sndrv_seq_instr_cluster_get { struct snd_seq_instr_cluster_get {
sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ snd_seq_instr_cluster_t cluster; /* cluster identifier */
char name[32]; /* cluster name */ char name[32]; /* cluster name */
int priority; /* cluster priority */ int priority; /* cluster priority */
char reserved[64]; /* for the future use */ char reserved[64]; /* for the future use */
...@@ -864,44 +868,44 @@ struct sndrv_seq_instr_cluster_get { ...@@ -864,44 +868,44 @@ struct sndrv_seq_instr_cluster_get {
#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) #define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info) #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info) #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info) #define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info) #define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info) #define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info) #define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info) #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status) #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo) #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo) #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner) #define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner) #define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer) #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer) #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
/* XXX /* XXX
#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync) #define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync) #define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
*/ */
#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client) #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client) #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool) #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool) #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events) #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs) #define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info) #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info) #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
#endif /* __SOUND_ASEQUENCER_H */ #endif /* __SOUND_ASEQUENCER_H */
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
* *
*/ */
typedef struct snd_seq_device snd_seq_device_t;
typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
/* /*
* registered device information * registered device information
*/ */
...@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t; ...@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
struct snd_seq_device { struct snd_seq_device {
/* device info */ /* device info */
snd_card_t *card; /* sound card */ struct snd_card *card; /* sound card */
int device; /* device number */ int device; /* device number */
char id[ID_LEN]; /* driver id */ char id[ID_LEN]; /* driver id */
char name[80]; /* device name */ char name[80]; /* device name */
...@@ -44,7 +41,7 @@ struct snd_seq_device { ...@@ -44,7 +41,7 @@ struct snd_seq_device {
void *driver_data; /* private data for driver */ void *driver_data; /* private data for driver */
int status; /* flag - read only */ int status; /* flag - read only */
void *private_data; /* private data for the caller */ void *private_data; /* private data for the caller */
void (*private_free)(snd_seq_device_t *device); void (*private_free)(struct snd_seq_device *device);
struct list_head list; /* link to next device */ struct list_head list; /* link to next device */
}; };
...@@ -63,19 +60,19 @@ struct snd_seq_device { ...@@ -63,19 +60,19 @@ struct snd_seq_device {
* Typically, call snd_device_free(dev->card, dev->driver_data) * Typically, call snd_device_free(dev->card, dev->driver_data)
*/ */
struct snd_seq_dev_ops { struct snd_seq_dev_ops {
int (*init_device)(snd_seq_device_t *dev); int (*init_device)(struct snd_seq_device *dev);
int (*free_device)(snd_seq_device_t *dev); int (*free_device)(struct snd_seq_device *dev);
}; };
/* /*
* prototypes * prototypes
*/ */
void snd_seq_device_load_drivers(void); void snd_seq_device_load_drivers(void);
int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
int snd_seq_device_unregister_driver(char *id); int snd_seq_device_unregister_driver(char *id);
#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
/* /*
...@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id); ...@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id);
#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
#endif /* __SOUND_SEQ_DEVICE_H */ #endif /* __SOUND_SEQ_DEVICE_H */
...@@ -24,29 +24,27 @@ ...@@ -24,29 +24,27 @@
#include "seq_kernel.h" #include "seq_kernel.h"
/* Instrument cluster */ /* Instrument cluster */
typedef struct _snd_seq_kcluster { struct snd_seq_kcluster {
snd_seq_instr_cluster_t cluster; snd_seq_instr_cluster_t cluster;
char name[32]; char name[32];
int priority; int priority;
struct _snd_seq_kcluster *next; struct snd_seq_kcluster *next;
} snd_seq_kcluster_t; };
/* return pointer to private data */ /* return pointer to private data */
#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) #define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
/* Instrument structure */ /* Instrument structure */
typedef struct _snd_seq_kinstr { struct snd_seq_kinstr {
snd_seq_instr_t instr; struct snd_seq_instr instr;
char name[32]; char name[32];
int type; /* instrument type */ int type; /* instrument type */
int use; /* use count */ int use; /* use count */
int busy; /* not useable */ int busy; /* not useable */
int add_len; /* additional length */ int add_len; /* additional length */
snd_seq_kinstr_ops_t *ops; /* operations */ struct snd_seq_kinstr_ops *ops; /* operations */
struct _snd_seq_kinstr *next; struct snd_seq_kinstr *next;
} snd_seq_kinstr_t; };
#define SNDRV_SEQ_INSTR_HASH_SIZE 32 #define SNDRV_SEQ_INSTR_HASH_SIZE 32
...@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr { ...@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr {
#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ #define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
/* List of all instruments */ /* List of all instruments */
typedef struct { struct snd_seq_kinstr_list {
snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
int count; /* count of all instruments */ int count; /* count of all instruments */
snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
int ccount; /* count of all clusters */ int ccount; /* count of all clusters */
int owner; /* current owner of the instrument list */ int owner; /* current owner of the instrument list */
...@@ -68,7 +66,7 @@ typedef struct { ...@@ -68,7 +66,7 @@ typedef struct {
spinlock_t ops_lock; spinlock_t ops_lock;
struct semaphore ops_mutex; struct semaphore ops_mutex;
unsigned long ops_flags; unsigned long ops_flags;
} snd_seq_kinstr_list_t; };
#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 #define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 #define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
...@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops { ...@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops {
long add_len; /* additional length */ long add_len; /* additional length */
char *instr_type; char *instr_type;
int (*info)(void *private_data, char *info_data, long len); int (*info)(void *private_data, char *info_data, long len);
int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
char __user *instr_data, long len, int atomic, int cmd); char __user *instr_data, long len, int atomic, int cmd);
int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
char __user *instr_data, long len, int atomic, int cmd); char __user *instr_data, long len, int atomic, int cmd);
int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
struct snd_seq_kinstr_ops *next; struct snd_seq_kinstr_ops *next;
}; };
/* instrument operations */ /* instrument operations */
snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
snd_seq_instr_header_t *ifree, struct snd_seq_instr_header *ifree,
int client, int client,
int atomic); int atomic);
snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
snd_seq_instr_t *instr, struct snd_seq_instr *instr,
int exact, int exact,
int follow_alias); int follow_alias);
void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
snd_seq_kinstr_t *instr); struct snd_seq_kinstr *instr);
int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int client, int client,
int atomic, int atomic,
int hop); int hop);
......
...@@ -24,62 +24,8 @@ ...@@ -24,62 +24,8 @@
#include <linux/time.h> #include <linux/time.h>
#include "asequencer.h" #include "asequencer.h"
typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; typedef struct snd_seq_real_time snd_seq_real_time_t;
typedef sndrv_seq_position_t snd_seq_position_t; typedef union snd_seq_timestamp snd_seq_timestamp_t;
typedef sndrv_seq_frequency_t snd_seq_frequency_t;
typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
typedef enum sndrv_seq_client_type snd_seq_client_type_t;
typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
typedef struct sndrv_seq_port_info snd_seq_port_info_t;
typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
typedef struct sndrv_seq_event snd_seq_event_t;
typedef struct sndrv_seq_addr snd_seq_addr_t;
typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
typedef struct sndrv_seq_real_time snd_seq_real_time_t;
typedef struct sndrv_seq_system_info snd_seq_system_info_t;
typedef struct sndrv_seq_client_info snd_seq_client_info_t;
typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
typedef struct sndrv_seq_instr snd_seq_instr_t;
typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
#define snd_seq_ev_length_type sndrv_seq_ev_length_type
#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
#define snd_seq_ev_is_real sndrv_seq_ev_is_real
#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
#define snd_seq_queue_owner sndrv_seq_queue_owner
/* maximum number of events dequeued per schedule interval */ /* maximum number of events dequeued per schedule interval */
#define SNDRV_SEQ_MAX_DEQUEUE 50 #define SNDRV_SEQ_MAX_DEQUEUE 50
...@@ -114,69 +60,56 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t; ...@@ -114,69 +60,56 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
/* max size of event size */ /* max size of event size */
#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
/* typedefs */
struct _snd_seq_user_client;
struct _snd_seq_kernel_client;
struct _snd_seq_client;
struct _snd_seq_queue;
typedef struct _snd_seq_user_client user_client_t;
typedef struct _snd_seq_kernel_client kernel_client_t;
typedef struct _snd_seq_client client_t;
typedef struct _snd_seq_queue queue_t;
/* call-backs for kernel client */ /* call-backs for kernel client */
typedef struct { struct snd_seq_client_callback {
void *private_data; void *private_data;
unsigned allow_input: 1, unsigned allow_input: 1,
allow_output: 1; allow_output: 1;
/*...*/ /*...*/
} snd_seq_client_callback_t; };
/* call-backs for kernel port */ /* call-backs for kernel port */
typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); struct snd_seq_port_callback {
typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
typedef struct {
struct module *owner; struct module *owner;
void *private_data; void *private_data;
snd_seq_kernel_port_open_t *subscribe; int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_close_t *unsubscribe; int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_open_t *use; int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_close_t *unuse; int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_input_t *event_input; int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
snd_seq_kernel_port_private_free_t *private_free; void (*private_free)(void *private_data);
unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
/*...*/ /*...*/
} snd_seq_port_callback_t; };
/* interface for kernel client */ /* interface for kernel client */
extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
extern int snd_seq_delete_kernel_client(int client); struct snd_seq_client_callback *callback);
extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); int snd_seq_delete_kernel_client(int client);
extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
#define SNDRV_SEQ_EXT_MASK 0xc0000000 #define SNDRV_SEQ_EXT_MASK 0xc0000000
#define SNDRV_SEQ_EXT_USRPTR 0x80000000 #define SNDRV_SEQ_EXT_USRPTR 0x80000000
#define SNDRV_SEQ_EXT_CHAINED 0x40000000 #define SNDRV_SEQ_EXT_CHAINED 0x40000000
typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); int in_kernel, int size_aligned);
int snd_seq_dump_var_event(const struct snd_seq_event *event,
snd_seq_dump_func_t func, void *private_data);
/* interface for OSS emulation */ /* interface for OSS emulation */
int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
/* port callback routines */ /* port callback routines */
void snd_port_init_callback(snd_seq_port_callback_t *p); void snd_port_init_callback(struct snd_seq_port_callback *p);
snd_seq_port_callback_t *snd_port_alloc_callback(void); struct snd_seq_port_callback *snd_port_alloc_callback(void);
/* port attach/detach */ /* port attach/detach */
int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
int cap, int type, int midi_channels, int midi_voices, char *portname); int cap, int type, int midi_channels, int midi_voices, char *portname);
int snd_seq_event_port_detach(int client, int port); int snd_seq_event_port_detach(int client, int port);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* channel. All drivers for hardware that does not understand midi * channel. All drivers for hardware that does not understand midi
* directly will probably need to use this structure. * directly will probably need to use this structure.
*/ */
typedef struct snd_midi_channel { struct snd_midi_channel {
void *private; /* A back pointer to driver data */ void *private; /* A back pointer to driver data */
int number; /* The channel number */ int number; /* The channel number */
int client; /* The client associated with this channel */ int client; /* The client associated with this channel */
...@@ -53,41 +53,43 @@ typedef struct snd_midi_channel { ...@@ -53,41 +53,43 @@ typedef struct snd_midi_channel {
short gm_rpn_fine_tuning; /* Master fine tuning */ short gm_rpn_fine_tuning; /* Master fine tuning */
short gm_rpn_coarse_tuning; /* Master coarse tuning */ short gm_rpn_coarse_tuning; /* Master coarse tuning */
} snd_midi_channel_t; };
/* /*
* A structure that represets a set of channels bound to a port. There * A structure that represets a set of channels bound to a port. There
* would usually be 16 channels per port. But fewer could be used for * would usually be 16 channels per port. But fewer could be used for
* particular cases. * particular cases.
* The channel set consists of information describing the client and * The channel set consists of information describing the client and
* port for this midi synth and an array of snd_midi_channel_t structures. * port for this midi synth and an array of snd_midi_channel structures.
* A driver that had no need for snd_midi_channel_t could still use the * A driver that had no need for snd_midi_channel could still use the
* channel set type if it wished with the channel array null. * channel set type if it wished with the channel array null.
*/ */
typedef struct snd_midi_channel_set { struct snd_midi_channel_set {
void *private_data; /* Driver data */ void *private_data; /* Driver data */
int client; /* Client for this port */ int client; /* Client for this port */
int port; /* The port number */ int port; /* The port number */
int max_channels; /* Size of the channels array */ int max_channels; /* Size of the channels array */
snd_midi_channel_t *channels; struct snd_midi_channel *channels;
unsigned char midi_mode; /* MIDI operating mode */ unsigned char midi_mode; /* MIDI operating mode */
unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
unsigned char gs_chorus_mode; unsigned char gs_chorus_mode;
unsigned char gs_reverb_mode; unsigned char gs_reverb_mode;
} snd_midi_channel_set_t; };
typedef struct snd_seq_midi_op { struct snd_midi_op {
void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
void (*control)(void *private_data, int type, snd_midi_channel_t *chan); void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); struct snd_midi_channel_set *chset);
} snd_midi_op_t; void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
struct snd_midi_channel_set *chset);
};
/* /*
* These defines are used so that pitchbend, aftertouch etc, can be * These defines are used so that pitchbend, aftertouch etc, can be
...@@ -186,10 +188,10 @@ enum { ...@@ -186,10 +188,10 @@ enum {
}; };
/* Prototypes for midi_process.c */ /* Prototypes for midi_process.c */
void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev,
snd_midi_channel_set_t *chanset); struct snd_midi_channel_set *chanset);
void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);
#endif /* __SOUND_SEQ_MIDI_EMUL_H */ #endif /* __SOUND_SEQ_MIDI_EMUL_H */
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
#define MAX_MIDI_EVENT_BUF 256 #define MAX_MIDI_EVENT_BUF 256
typedef struct snd_midi_event_t snd_midi_event_t;
/* midi status */ /* midi status */
struct snd_midi_event_t { struct snd_midi_event {
int qlen; /* queue length */ int qlen; /* queue length */
int read; /* chars read */ int read; /* chars read */
int type; /* current event type */ int type; /* current event type */
...@@ -40,15 +38,17 @@ struct snd_midi_event_t { ...@@ -40,15 +38,17 @@ struct snd_midi_event_t {
spinlock_t lock; spinlock_t lock;
}; };
int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
void snd_midi_event_free(snd_midi_event_t *dev); void snd_midi_event_free(struct snd_midi_event *dev);
void snd_midi_event_reset_encode(snd_midi_event_t *dev); void snd_midi_event_reset_encode(struct snd_midi_event *dev);
void snd_midi_event_reset_decode(snd_midi_event_t *dev); void snd_midi_event_reset_decode(struct snd_midi_event *dev);
void snd_midi_event_no_status(snd_midi_event_t *dev, int on); void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
/* encode from byte stream - return number of written bytes if success */ /* encode from byte stream - return number of written bytes if success */
long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); struct snd_seq_event *ev);
int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
/* decode from event to bytes - return number of written bytes if success */ /* decode from event to bytes - return number of written bytes if success */
long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
struct snd_seq_event *ev);
#endif /* __SOUND_SEQ_MIDI_EVENT_H */ #endif /* __SOUND_SEQ_MIDI_EVENT_H */
...@@ -25,25 +25,23 @@ ...@@ -25,25 +25,23 @@
#include "rawmidi.h" #include "rawmidi.h"
#include "seq_midi_event.h" #include "seq_midi_event.h"
typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
/* /*
* device file instance: * device file instance:
* This instance is created at each time the midi device file is * This instance is created at each time the midi device file is
* opened. Each instance has its own input buffer and MIDI parser * opened. Each instance has its own input buffer and MIDI parser
* (buffer), and is associated with the device instance. * (buffer), and is associated with the device instance.
*/ */
typedef struct _snd_virmidi { struct snd_virmidi {
struct list_head list; struct list_head list;
int seq_mode; int seq_mode;
int client; int client;
int port; int port;
unsigned int trigger: 1; unsigned int trigger: 1;
snd_midi_event_t *parser; struct snd_midi_event *parser;
snd_seq_event_t event; struct snd_seq_event event;
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
} snd_virmidi_t; };
#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
#define SNDRV_VIRMIDI_USE (1<<1) #define SNDRV_VIRMIDI_USE (1<<1)
...@@ -53,9 +51,9 @@ typedef struct _snd_virmidi { ...@@ -53,9 +51,9 @@ typedef struct _snd_virmidi {
* Each virtual midi device has one device instance. It contains * Each virtual midi device has one device instance. It contains
* common information and the linked-list of opened files, * common information and the linked-list of opened files,
*/ */
struct _snd_virmidi_dev { struct snd_virmidi_dev {
snd_card_t *card; /* associated card */ struct snd_card *card; /* associated card */
snd_rawmidi_t *rmidi; /* rawmidi device */ struct snd_rawmidi *rmidi; /* rawmidi device */
int seq_mode; /* SNDRV_VIRMIDI_XXX */ int seq_mode; /* SNDRV_VIRMIDI_XXX */
int device; /* sequencer device */ int device; /* sequencer device */
int client; /* created/attached client */ int client; /* created/attached client */
...@@ -78,6 +76,6 @@ struct _snd_virmidi_dev { ...@@ -78,6 +76,6 @@ struct _snd_virmidi_dev {
#define SNDRV_VIRMIDI_SEQ_ATTACH 1 #define SNDRV_VIRMIDI_SEQ_ATTACH 1
#define SNDRV_VIRMIDI_SEQ_DISPATCH 2 #define SNDRV_VIRMIDI_SEQ_DISPATCH 2
int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
#endif /* __SOUND_SEQ_VIRMIDI */ #endif /* __SOUND_SEQ_VIRMIDI */
...@@ -58,14 +58,18 @@ static DECLARE_MUTEX(register_mutex); ...@@ -58,14 +58,18 @@ static DECLARE_MUTEX(register_mutex);
* client table * client table
*/ */
static char clienttablock[SNDRV_SEQ_MAX_CLIENTS]; static char clienttablock[SNDRV_SEQ_MAX_CLIENTS];
static client_t *clienttab[SNDRV_SEQ_MAX_CLIENTS]; static struct snd_seq_client *clienttab[SNDRV_SEQ_MAX_CLIENTS];
static usage_t client_usage; static struct snd_seq_usage client_usage;
/* /*
* prototypes * prototypes
*/ */
static int bounce_error_event(client_t *client, snd_seq_event_t *event, int err, int atomic, int hop); static int bounce_error_event(struct snd_seq_client *client,
static int snd_seq_deliver_single_event(client_t *client, snd_seq_event_t *event, int filter, int atomic, int hop); struct snd_seq_event *event,
int err, int atomic, int hop);
static int snd_seq_deliver_single_event(struct snd_seq_client *client,
struct snd_seq_event *event,
int filter, int atomic, int hop);
/* /*
*/ */
...@@ -96,16 +100,17 @@ static inline unsigned short snd_seq_file_flags(struct file *file) ...@@ -96,16 +100,17 @@ static inline unsigned short snd_seq_file_flags(struct file *file)
} }
} }
static inline int snd_seq_write_pool_allocated(client_t *client) static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client)
{ {
return snd_seq_total_cells(client->pool) > 0; return snd_seq_total_cells(client->pool) > 0;
} }
/* return pointer to client structure for specified id */ /* return pointer to client structure for specified id */
static client_t *clientptr(int clientid) static struct snd_seq_client *clientptr(int clientid)
{ {
if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) {
snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); snd_printd("Seq: oops. Trying to get pointer to client %d\n",
clientid);
return NULL; return NULL;
} }
return clienttab[clientid]; return clienttab[clientid];
...@@ -113,13 +118,14 @@ static client_t *clientptr(int clientid) ...@@ -113,13 +118,14 @@ static client_t *clientptr(int clientid)
extern int seq_client_load[]; extern int seq_client_load[];
client_t *snd_seq_client_use_ptr(int clientid) struct snd_seq_client *snd_seq_client_use_ptr(int clientid)
{ {
unsigned long flags; unsigned long flags;
client_t *client; struct snd_seq_client *client;
if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) {
snd_printd("Seq: oops. Trying to get pointer to client %d\n", clientid); snd_printd("Seq: oops. Trying to get pointer to client %d\n",
clientid);
return NULL; return NULL;
} }
spin_lock_irqsave(&clients_lock, flags); spin_lock_irqsave(&clients_lock, flags);
...@@ -144,7 +150,8 @@ client_t *snd_seq_client_use_ptr(int clientid) ...@@ -144,7 +150,8 @@ client_t *snd_seq_client_use_ptr(int clientid)
if (seq_client_load[idx] < 0) if (seq_client_load[idx] < 0)
break; break;
if (seq_client_load[idx] == clientid) { if (seq_client_load[idx] == clientid) {
request_module("snd-seq-client-%i", clientid); request_module("snd-seq-client-%i",
clientid);
break; break;
} }
} }
...@@ -174,14 +181,14 @@ client_t *snd_seq_client_use_ptr(int clientid) ...@@ -174,14 +181,14 @@ client_t *snd_seq_client_use_ptr(int clientid)
return client; return client;
} }
static void usage_alloc(usage_t * res, int num) static void usage_alloc(struct snd_seq_usage *res, int num)
{ {
res->cur += num; res->cur += num;
if (res->cur > res->peak) if (res->cur > res->peak)
res->peak = res->cur; res->peak = res->cur;
} }
static void usage_free(usage_t * res, int num) static void usage_free(struct snd_seq_usage *res, int num)
{ {
res->cur -= num; res->cur -= num;
} }
...@@ -196,11 +203,11 @@ int __init client_init_data(void) ...@@ -196,11 +203,11 @@ int __init client_init_data(void)
} }
static client_t *seq_create_client1(int client_index, int poolsize) static struct snd_seq_client *seq_create_client1(int client_index, int poolsize)
{ {
unsigned long flags; unsigned long flags;
int c; int c;
client_t *client; struct snd_seq_client *client;
/* init client data */ /* init client data */
client = kzalloc(sizeof(*client), GFP_KERNEL); client = kzalloc(sizeof(*client), GFP_KERNEL);
...@@ -241,7 +248,7 @@ static client_t *seq_create_client1(int client_index, int poolsize) ...@@ -241,7 +248,7 @@ static client_t *seq_create_client1(int client_index, int poolsize)
} }
static int seq_free_client1(client_t *client) static int seq_free_client1(struct snd_seq_client *client)
{ {
unsigned long flags; unsigned long flags;
...@@ -263,12 +270,13 @@ static int seq_free_client1(client_t *client) ...@@ -263,12 +270,13 @@ static int seq_free_client1(client_t *client)
} }
static void seq_free_client(client_t * client) static void seq_free_client(struct snd_seq_client * client)
{ {
down(&register_mutex); down(&register_mutex);
switch (client->type) { switch (client->type) {
case NO_CLIENT: case NO_CLIENT:
snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", client->number); snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n",
client->number);
break; break;
case USER_CLIENT: case USER_CLIENT:
case KERNEL_CLIENT: case KERNEL_CLIENT:
...@@ -277,7 +285,8 @@ static void seq_free_client(client_t * client) ...@@ -277,7 +285,8 @@ static void seq_free_client(client_t * client)
break; break;
default: default:
snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n",
client->number, client->type);
} }
up(&register_mutex); up(&register_mutex);
...@@ -292,8 +301,8 @@ static void seq_free_client(client_t * client) ...@@ -292,8 +301,8 @@ static void seq_free_client(client_t * client)
static int snd_seq_open(struct inode *inode, struct file *file) static int snd_seq_open(struct inode *inode, struct file *file)
{ {
int c, mode; /* client id */ int c, mode; /* client id */
client_t *client; struct snd_seq_client *client;
user_client_t *user; struct snd_seq_user_client *user;
if (down_interruptible(&register_mutex)) if (down_interruptible(&register_mutex))
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -344,7 +353,7 @@ static int snd_seq_open(struct inode *inode, struct file *file) ...@@ -344,7 +353,7 @@ static int snd_seq_open(struct inode *inode, struct file *file)
/* delete a user client */ /* delete a user client */
static int snd_seq_release(struct inode *inode, struct file *file) static int snd_seq_release(struct inode *inode, struct file *file)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
if (client) { if (client) {
seq_free_client(client); seq_free_client(client);
...@@ -364,13 +373,14 @@ static int snd_seq_release(struct inode *inode, struct file *file) ...@@ -364,13 +373,14 @@ static int snd_seq_release(struct inode *inode, struct file *file)
* -EINVAL no enough user-space buffer to write the whole event * -EINVAL no enough user-space buffer to write the whole event
* -EFAULT seg. fault during copy to user space * -EFAULT seg. fault during copy to user space
*/ */
static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, loff_t *offset) static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count,
loff_t *offset)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
fifo_t *fifo; struct snd_seq_fifo *fifo;
int err; int err;
long result = 0; long result = 0;
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT)) if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT))
return -ENXIO; return -ENXIO;
...@@ -396,7 +406,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l ...@@ -396,7 +406,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
snd_seq_fifo_lock(fifo); snd_seq_fifo_lock(fifo);
/* while data available in queue */ /* while data available in queue */
while (count >= sizeof(snd_seq_event_t)) { while (count >= sizeof(struct snd_seq_event)) {
int nonblock; int nonblock;
nonblock = (file->f_flags & O_NONBLOCK) || result > 0; 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,34 +414,34 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
break; break;
} }
if (snd_seq_ev_is_variable(&cell->event)) { if (snd_seq_ev_is_variable(&cell->event)) {
snd_seq_event_t tmpev; struct snd_seq_event tmpev;
tmpev = cell->event; tmpev = cell->event;
tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK; tmpev.data.ext.len &= ~SNDRV_SEQ_EXT_MASK;
if (copy_to_user(buf, &tmpev, sizeof(snd_seq_event_t))) { if (copy_to_user(buf, &tmpev, sizeof(struct snd_seq_event))) {
err = -EFAULT; err = -EFAULT;
break; break;
} }
count -= sizeof(snd_seq_event_t); count -= sizeof(struct snd_seq_event);
buf += sizeof(snd_seq_event_t); buf += sizeof(struct snd_seq_event);
err = snd_seq_expand_var_event(&cell->event, count, err = snd_seq_expand_var_event(&cell->event, count,
(char __force *)buf, 0, (char __force *)buf, 0,
sizeof(snd_seq_event_t)); sizeof(struct snd_seq_event));
if (err < 0) if (err < 0)
break; break;
result += err; result += err;
count -= err; count -= err;
buf += err; buf += err;
} else { } else {
if (copy_to_user(buf, &cell->event, sizeof(snd_seq_event_t))) { if (copy_to_user(buf, &cell->event, sizeof(struct snd_seq_event))) {
err = -EFAULT; err = -EFAULT;
break; break;
} }
count -= sizeof(snd_seq_event_t); count -= sizeof(struct snd_seq_event);
buf += sizeof(snd_seq_event_t); buf += sizeof(struct snd_seq_event);
} }
snd_seq_cell_free(cell); snd_seq_cell_free(cell);
cell = NULL; /* to be sure */ cell = NULL; /* to be sure */
result += sizeof(snd_seq_event_t); result += sizeof(struct snd_seq_event);
} }
if (err < 0) { if (err < 0) {
...@@ -449,7 +459,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l ...@@ -449,7 +459,7 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
/* /*
* check access permission to the port * check access permission to the port
*/ */
static int check_port_perm(client_port_t *port, unsigned int flags) static int check_port_perm(struct snd_seq_client_port *port, unsigned int flags)
{ {
if ((port->capability & flags) != flags) if ((port->capability & flags) != flags)
return 0; return 0;
...@@ -460,9 +470,10 @@ static int check_port_perm(client_port_t *port, unsigned int flags) ...@@ -460,9 +470,10 @@ static int check_port_perm(client_port_t *port, unsigned int flags)
* check if the destination client is available, and return the pointer * check if the destination client is available, and return the pointer
* if filter is non-zero, client filter bitmap is tested. * if filter is non-zero, client filter bitmap is tested.
*/ */
static client_t *get_event_dest_client(snd_seq_event_t *event, int filter) static struct snd_seq_client *get_event_dest_client(struct snd_seq_event *event,
int filter)
{ {
client_t *dest; struct snd_seq_client *dest;
dest = snd_seq_client_use_ptr(event->dest.client); dest = snd_seq_client_use_ptr(event->dest.client);
if (dest == NULL) if (dest == NULL)
...@@ -493,10 +504,11 @@ static client_t *get_event_dest_client(snd_seq_event_t *event, int filter) ...@@ -493,10 +504,11 @@ static client_t *get_event_dest_client(snd_seq_event_t *event, int filter)
* quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra * quoted in SNDRV_SEQ_EVENT_KERNEL_ERROR, since this requires no extra
* kmalloc. * kmalloc.
*/ */
static int bounce_error_event(client_t *client, snd_seq_event_t *event, static int bounce_error_event(struct snd_seq_client *client,
struct snd_seq_event *event,
int err, int atomic, int hop) int err, int atomic, int hop)
{ {
snd_seq_event_t bounce_ev; struct snd_seq_event bounce_ev;
int result; int result;
if (client == NULL || if (client == NULL ||
...@@ -531,9 +543,10 @@ static int bounce_error_event(client_t *client, snd_seq_event_t *event, ...@@ -531,9 +543,10 @@ static int bounce_error_event(client_t *client, snd_seq_event_t *event,
* of the given queue. * of the given queue.
* return non-zero if updated. * return non-zero if updated.
*/ */
static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real_time) static int update_timestamp_of_queue(struct snd_seq_event *event,
int queue, int real_time)
{ {
queue_t *q; struct snd_seq_queue *q;
q = queueptr(queue); q = queueptr(queue);
if (! q) if (! q)
...@@ -559,12 +572,12 @@ static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real ...@@ -559,12 +572,12 @@ static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real
* RETURN VALUE: 0 : if succeeded * RETURN VALUE: 0 : if succeeded
* <0 : error * <0 : error
*/ */
static int snd_seq_deliver_single_event(client_t *client, static int snd_seq_deliver_single_event(struct snd_seq_client *client,
snd_seq_event_t *event, struct snd_seq_event *event,
int filter, int atomic, int hop) int filter, int atomic, int hop)
{ {
client_t *dest = NULL; struct snd_seq_client *dest = NULL;
client_port_t *dest_port = NULL; struct snd_seq_client_port *dest_port = NULL;
int result = -ENOENT; int result = -ENOENT;
int direct; int direct;
...@@ -596,7 +609,9 @@ static int snd_seq_deliver_single_event(client_t *client, ...@@ -596,7 +609,9 @@ static int snd_seq_deliver_single_event(client_t *client,
case KERNEL_CLIENT: case KERNEL_CLIENT:
if (dest_port->event_input == NULL) if (dest_port->event_input == NULL)
break; break;
result = dest_port->event_input(event, direct, dest_port->private_data, atomic, hop); result = dest_port->event_input(event, direct,
dest_port->private_data,
atomic, hop);
break; break;
default: default:
break; break;
...@@ -618,16 +633,16 @@ static int snd_seq_deliver_single_event(client_t *client, ...@@ -618,16 +633,16 @@ static int snd_seq_deliver_single_event(client_t *client,
/* /*
* send the event to all subscribers: * send the event to all subscribers:
*/ */
static int deliver_to_subscribers(client_t *client, static int deliver_to_subscribers(struct snd_seq_client *client,
snd_seq_event_t *event, struct snd_seq_event *event,
int atomic, int hop) int atomic, int hop)
{ {
subscribers_t *subs; struct snd_seq_subscribers *subs;
int err = 0, num_ev = 0; int err = 0, num_ev = 0;
snd_seq_event_t event_saved; struct snd_seq_event event_saved;
client_port_t *src_port; struct snd_seq_client_port *src_port;
struct list_head *p; struct list_head *p;
port_subs_info_t *grp; struct snd_seq_port_subs_info *grp;
src_port = snd_seq_port_use_ptr(client, event->source.port); src_port = snd_seq_port_use_ptr(client, event->source.port);
if (src_port == NULL) if (src_port == NULL)
...@@ -642,7 +657,7 @@ static int deliver_to_subscribers(client_t *client, ...@@ -642,7 +657,7 @@ static int deliver_to_subscribers(client_t *client,
else else
down_read(&grp->list_mutex); down_read(&grp->list_mutex);
list_for_each(p, &grp->list_head) { list_for_each(p, &grp->list_head) {
subs = list_entry(p, subscribers_t, src_list); subs = list_entry(p, struct snd_seq_subscribers, src_list);
event->dest = subs->info.dest; event->dest = subs->info.dest;
if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP)
/* convert time according to flag with subscription */ /* convert time according to flag with subscription */
...@@ -670,12 +685,12 @@ static int deliver_to_subscribers(client_t *client, ...@@ -670,12 +685,12 @@ static int deliver_to_subscribers(client_t *client,
/* /*
* broadcast to all ports: * broadcast to all ports:
*/ */
static int port_broadcast_event(client_t *client, static int port_broadcast_event(struct snd_seq_client *client,
snd_seq_event_t *event, struct snd_seq_event *event,
int atomic, int hop) int atomic, int hop)
{ {
int num_ev = 0, err = 0; int num_ev = 0, err = 0;
client_t *dest_client; struct snd_seq_client *dest_client;
struct list_head *p; struct list_head *p;
dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST); dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST);
...@@ -684,7 +699,7 @@ static int port_broadcast_event(client_t *client, ...@@ -684,7 +699,7 @@ static int port_broadcast_event(client_t *client,
read_lock(&dest_client->ports_lock); read_lock(&dest_client->ports_lock);
list_for_each(p, &dest_client->ports_list_head) { list_for_each(p, &dest_client->ports_list_head) {
client_port_t *port = list_entry(p, client_port_t, list); struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list);
event->dest.port = port->addr.port; event->dest.port = port->addr.port;
/* pass NULL as source client to avoid error bounce */ /* pass NULL as source client to avoid error bounce */
err = snd_seq_deliver_single_event(NULL, event, err = snd_seq_deliver_single_event(NULL, event,
...@@ -704,12 +719,12 @@ static int port_broadcast_event(client_t *client, ...@@ -704,12 +719,12 @@ static int port_broadcast_event(client_t *client,
* send the event to all clients: * send the event to all clients:
* if destination port is also ADDRESS_BROADCAST, deliver to all ports. * if destination port is also ADDRESS_BROADCAST, deliver to all ports.
*/ */
static int broadcast_event(client_t *client, static int broadcast_event(struct snd_seq_client *client,
snd_seq_event_t *event, int atomic, int hop) struct snd_seq_event *event, int atomic, int hop)
{ {
int err = 0, num_ev = 0; int err = 0, num_ev = 0;
int dest; int dest;
snd_seq_addr_t addr; struct snd_seq_addr addr;
addr = event->dest; /* save */ addr = event->dest; /* save */
...@@ -736,7 +751,7 @@ static int broadcast_event(client_t *client, ...@@ -736,7 +751,7 @@ static int broadcast_event(client_t *client,
/* multicast - not supported yet */ /* multicast - not supported yet */
static int multicast_event(client_t *client, snd_seq_event_t *event, static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event,
int atomic, int hop) int atomic, int hop)
{ {
snd_printd("seq: multicast not supported yet.\n"); 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,7 +768,7 @@ static int multicast_event(client_t *client, snd_seq_event_t *event,
* n == 0 : the event was not passed to any client. * n == 0 : the event was not passed to any client.
* n < 0 : error - event was not processed. * n < 0 : error - event was not processed.
*/ */
static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event, static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_event *event,
int atomic, int hop) int atomic, int hop)
{ {
int result; int result;
...@@ -794,9 +809,9 @@ static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event, ...@@ -794,9 +809,9 @@ static int snd_seq_deliver_event(client_t *client, snd_seq_event_t *event,
* n == 0 : the event was not passed to any client. * n == 0 : the event was not passed to any client.
* n < 0 : error - event was not processed. * n < 0 : error - event was not processed.
*/ */
int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop)
{ {
client_t *client; struct snd_seq_client *client;
int result; int result;
snd_assert(cell != NULL, return -EINVAL); 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,7 +827,7 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop)
* the event cell is re-used as a NOTE-OFF event and * the event cell is re-used as a NOTE-OFF event and
* enqueued again. * enqueued again.
*/ */
snd_seq_event_t tmpev, *ev; struct snd_seq_event tmpev, *ev;
/* reserve this event to enqueue note-off later */ /* reserve this event to enqueue note-off later */
tmpev = cell->event; tmpev = cell->event;
...@@ -865,12 +880,12 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop) ...@@ -865,12 +880,12 @@ int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop)
* if pool is empty and blocking is TRUE, sleep until a new cell is * if pool is empty and blocking is TRUE, sleep until a new cell is
* available. * available.
*/ */
static int snd_seq_client_enqueue_event(client_t *client, static int snd_seq_client_enqueue_event(struct snd_seq_client *client,
snd_seq_event_t *event, struct snd_seq_event *event,
struct file *file, int blocking, struct file *file, int blocking,
int atomic, int hop) int atomic, int hop)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
int err; int err;
/* special queue values - force direct passing */ /* special queue values - force direct passing */
...@@ -886,7 +901,7 @@ static int snd_seq_client_enqueue_event(client_t *client, ...@@ -886,7 +901,7 @@ static int snd_seq_client_enqueue_event(client_t *client,
#endif #endif
if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) { if (event->dest.client == SNDRV_SEQ_ADDRESS_SUBSCRIBERS) {
/* check presence of source port */ /* check presence of source port */
client_port_t *src_port = snd_seq_port_use_ptr(client, event->source.port); struct snd_seq_client_port *src_port = snd_seq_port_use_ptr(client, event->source.port);
if (src_port == NULL) if (src_port == NULL)
return -EINVAL; return -EINVAL;
snd_seq_port_unlock(src_port); snd_seq_port_unlock(src_port);
...@@ -924,7 +939,7 @@ static int snd_seq_client_enqueue_event(client_t *client, ...@@ -924,7 +939,7 @@ static int snd_seq_client_enqueue_event(client_t *client,
* check validity of event type and data length. * check validity of event type and data length.
* return non-zero if invalid. * return non-zero if invalid.
*/ */
static int check_event_type_and_length(snd_seq_event_t *ev) static int check_event_type_and_length(struct snd_seq_event *ev)
{ {
switch (snd_seq_ev_length_type(ev)) { switch (snd_seq_ev_length_type(ev)) {
case SNDRV_SEQ_EVENT_LENGTH_FIXED: case SNDRV_SEQ_EVENT_LENGTH_FIXED:
...@@ -957,12 +972,13 @@ static int check_event_type_and_length(snd_seq_event_t *ev) ...@@ -957,12 +972,13 @@ static int check_event_type_and_length(snd_seq_event_t *ev)
* -EMLINK too many hops * -EMLINK too many hops
* others depends on return value from driver callback * others depends on return value from driver callback
*/ */
static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) static ssize_t snd_seq_write(struct file *file, const char __user *buf,
size_t count, loff_t *offset)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
int written = 0, len; int written = 0, len;
int err = -EINVAL; int err = -EINVAL;
snd_seq_event_t event; struct snd_seq_event event;
if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT)) if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
return -ENXIO; return -ENXIO;
...@@ -980,7 +996,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c ...@@ -980,7 +996,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
} }
/* only process whole events */ /* only process whole events */
while (count >= sizeof(snd_seq_event_t)) { while (count >= sizeof(struct snd_seq_event)) {
/* Read in the event header from the user */ /* Read in the event header from the user */
len = sizeof(event); len = sizeof(event);
if (copy_from_user(&event, buf, len)) { 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,7 +1028,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
/* set user space pointer */ /* set user space pointer */
event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
event.data.ext.ptr = (char __force *)buf event.data.ext.ptr = (char __force *)buf
+ sizeof(snd_seq_event_t); + sizeof(struct snd_seq_event);
len += extlen; /* increment data length */ len += extlen; /* increment data length */
} else { } else {
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
...@@ -1046,7 +1062,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c ...@@ -1046,7 +1062,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
*/ */
static unsigned int snd_seq_poll(struct file *file, poll_table * wait) static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
unsigned int mask = 0; unsigned int mask = 0;
/* check client structures are in place */ /* check client structures are in place */
...@@ -1076,9 +1092,9 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait) ...@@ -1076,9 +1092,9 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
/* SYSTEM_INFO ioctl() */ /* SYSTEM_INFO ioctl() */
static int snd_seq_ioctl_system_info(client_t *client, void __user *arg) static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void __user *arg)
{ {
snd_seq_system_info_t info; struct snd_seq_system_info info;
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
/* fill the info fields */ /* fill the info fields */
...@@ -1096,10 +1112,10 @@ static int snd_seq_ioctl_system_info(client_t *client, void __user *arg) ...@@ -1096,10 +1112,10 @@ static int snd_seq_ioctl_system_info(client_t *client, void __user *arg)
/* RUNNING_MODE ioctl() */ /* RUNNING_MODE ioctl() */
static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg) static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void __user *arg)
{ {
struct sndrv_seq_running_info info; struct snd_seq_running_info info;
client_t *cptr; struct snd_seq_client *cptr;
int err = 0; int err = 0;
if (copy_from_user(&info, arg, sizeof(info))) 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,7 +1149,8 @@ static int snd_seq_ioctl_running_mode(client_t *client, void __user *arg)
} }
/* CLIENT_INFO ioctl() */ /* CLIENT_INFO ioctl() */
static void get_client_info(client_t *cptr, snd_seq_client_info_t *info) static void get_client_info(struct snd_seq_client *cptr,
struct snd_seq_client_info *info)
{ {
info->client = cptr->number; info->client = cptr->number;
...@@ -1147,10 +1164,11 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info) ...@@ -1147,10 +1164,11 @@ static void get_client_info(client_t *cptr, snd_seq_client_info_t *info)
memset(info->reserved, 0, sizeof(info->reserved)); memset(info->reserved, 0, sizeof(info->reserved));
} }
static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg) static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client,
void __user *arg)
{ {
client_t *cptr; struct snd_seq_client *cptr;
snd_seq_client_info_t client_info; struct snd_seq_client_info client_info;
if (copy_from_user(&client_info, arg, sizeof(client_info))) if (copy_from_user(&client_info, arg, sizeof(client_info)))
return -EFAULT; return -EFAULT;
...@@ -1170,9 +1188,10 @@ static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg) ...@@ -1170,9 +1188,10 @@ static int snd_seq_ioctl_get_client_info(client_t * client, void __user *arg)
/* CLIENT_INFO ioctl() */ /* CLIENT_INFO ioctl() */
static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg) static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_client_info_t client_info; struct snd_seq_client_info client_info;
if (copy_from_user(&client_info, arg, sizeof(client_info))) if (copy_from_user(&client_info, arg, sizeof(client_info)))
return -EFAULT; return -EFAULT;
...@@ -1199,11 +1218,12 @@ static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg) ...@@ -1199,11 +1218,12 @@ static int snd_seq_ioctl_set_client_info(client_t * client, void __user *arg)
/* /*
* CREATE PORT ioctl() * CREATE PORT ioctl()
*/ */
static int snd_seq_ioctl_create_port(client_t * client, void __user *arg) static int snd_seq_ioctl_create_port(struct snd_seq_client *client,
void __user *arg)
{ {
client_port_t *port; struct snd_seq_client_port *port;
snd_seq_port_info_t info; struct snd_seq_port_info info;
snd_seq_port_callback_t *callback; struct snd_seq_port_callback *callback;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1249,9 +1269,10 @@ static int snd_seq_ioctl_create_port(client_t * client, void __user *arg) ...@@ -1249,9 +1269,10 @@ static int snd_seq_ioctl_create_port(client_t * client, void __user *arg)
/* /*
* DELETE PORT ioctl() * DELETE PORT ioctl()
*/ */
static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg) static int snd_seq_ioctl_delete_port(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_port_info_t info; struct snd_seq_port_info info;
int err; int err;
/* set passed parameters */ /* set passed parameters */
...@@ -1272,11 +1293,12 @@ static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg) ...@@ -1272,11 +1293,12 @@ static int snd_seq_ioctl_delete_port(client_t * client, void __user *arg)
/* /*
* GET_PORT_INFO ioctl() (on any client) * GET_PORT_INFO ioctl() (on any client)
*/ */
static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg) static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client,
void __user *arg)
{ {
client_t *cptr; struct snd_seq_client *cptr;
client_port_t *port; struct snd_seq_client_port *port;
snd_seq_port_info_t info; struct snd_seq_port_info info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1304,10 +1326,11 @@ static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg) ...@@ -1304,10 +1326,11 @@ static int snd_seq_ioctl_get_port_info(client_t *client, void __user *arg)
/* /*
* SET_PORT_INFO ioctl() (only ports on this/own client) * SET_PORT_INFO ioctl() (only ports on this/own client)
*/ */
static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg) static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client,
void __user *arg)
{ {
client_port_t *port; struct snd_seq_client_port *port;
snd_seq_port_info_t info; struct snd_seq_port_info info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1329,9 +1352,10 @@ static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg) ...@@ -1329,9 +1352,10 @@ static int snd_seq_ioctl_set_port_info(client_t * client, void __user *arg)
#define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ) #define PERM_RD (SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ)
#define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE) #define PERM_WR (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE)
static int check_subscription_permission(client_t *client, client_port_t *sport, static int check_subscription_permission(struct snd_seq_client *client,
client_port_t *dport, struct snd_seq_client_port *sport,
snd_seq_port_subscribe_t *subs) struct snd_seq_client_port *dport,
struct snd_seq_port_subscribe *subs)
{ {
if (client->number != subs->sender.client && if (client->number != subs->sender.client &&
client->number != subs->dest.client) { client->number != subs->dest.client) {
...@@ -1363,9 +1387,10 @@ static int check_subscription_permission(client_t *client, client_port_t *sport, ...@@ -1363,9 +1387,10 @@ static int check_subscription_permission(client_t *client, client_port_t *sport,
* client must be user client. * client must be user client.
*/ */
int snd_seq_client_notify_subscription(int client, int port, int snd_seq_client_notify_subscription(int client, int port,
snd_seq_port_subscribe_t *info, int evtype) struct snd_seq_port_subscribe *info,
int evtype)
{ {
snd_seq_event_t event; struct snd_seq_event event;
memset(&event, 0, sizeof(event)); memset(&event, 0, sizeof(event));
event.type = evtype; event.type = evtype;
...@@ -1379,12 +1404,13 @@ int snd_seq_client_notify_subscription(int client, int port, ...@@ -1379,12 +1404,13 @@ int snd_seq_client_notify_subscription(int client, int port,
/* /*
* add to port's subscription list IOCTL interface * add to port's subscription list IOCTL interface
*/ */
static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg) static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client,
void __user *arg)
{ {
int result = -EINVAL; int result = -EINVAL;
client_t *receiver = NULL, *sender = NULL; struct snd_seq_client *receiver = NULL, *sender = NULL;
client_port_t *sport = NULL, *dport = NULL; struct snd_seq_client_port *sport = NULL, *dport = NULL;
snd_seq_port_subscribe_t subs; struct snd_seq_port_subscribe subs;
if (copy_from_user(&subs, arg, sizeof(subs))) if (copy_from_user(&subs, arg, sizeof(subs)))
return -EFAULT; return -EFAULT;
...@@ -1423,12 +1449,13 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg) ...@@ -1423,12 +1449,13 @@ static int snd_seq_ioctl_subscribe_port(client_t * client, void __user *arg)
/* /*
* remove from port's subscription list * remove from port's subscription list
*/ */
static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg) static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client,
void __user *arg)
{ {
int result = -ENXIO; int result = -ENXIO;
client_t *receiver = NULL, *sender = NULL; struct snd_seq_client *receiver = NULL, *sender = NULL;
client_port_t *sport = NULL, *dport = NULL; struct snd_seq_client_port *sport = NULL, *dport = NULL;
snd_seq_port_subscribe_t subs; struct snd_seq_port_subscribe subs;
if (copy_from_user(&subs, arg, sizeof(subs))) if (copy_from_user(&subs, arg, sizeof(subs)))
return -EFAULT; return -EFAULT;
...@@ -1464,11 +1491,12 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg) ...@@ -1464,11 +1491,12 @@ static int snd_seq_ioctl_unsubscribe_port(client_t * client, void __user *arg)
/* CREATE_QUEUE ioctl() */ /* CREATE_QUEUE ioctl() */
static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg) static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_info_t info; struct snd_seq_queue_info info;
int result; int result;
queue_t *q; struct snd_seq_queue *q;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1498,9 +1526,10 @@ static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg) ...@@ -1498,9 +1526,10 @@ static int snd_seq_ioctl_create_queue(client_t *client, void __user *arg)
} }
/* DELETE_QUEUE ioctl() */ /* DELETE_QUEUE ioctl() */
static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg) static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_info_t info; struct snd_seq_queue_info info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1509,10 +1538,11 @@ static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg) ...@@ -1509,10 +1538,11 @@ static int snd_seq_ioctl_delete_queue(client_t *client, void __user *arg)
} }
/* GET_QUEUE_INFO ioctl() */ /* GET_QUEUE_INFO ioctl() */
static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg) static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_info_t info; struct snd_seq_queue_info info;
queue_t *q; struct snd_seq_queue *q;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1535,10 +1565,11 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg) ...@@ -1535,10 +1565,11 @@ static int snd_seq_ioctl_get_queue_info(client_t *client, void __user *arg)
} }
/* SET_QUEUE_INFO ioctl() */ /* SET_QUEUE_INFO ioctl() */
static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg) static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_info_t info; struct snd_seq_queue_info info;
queue_t *q; struct snd_seq_queue *q;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1570,10 +1601,10 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg) ...@@ -1570,10 +1601,10 @@ static int snd_seq_ioctl_set_queue_info(client_t *client, void __user *arg)
} }
/* GET_NAMED_QUEUE ioctl() */ /* GET_NAMED_QUEUE ioctl() */
static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg) static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, void __user *arg)
{ {
snd_seq_queue_info_t info; struct snd_seq_queue_info info;
queue_t *q; struct snd_seq_queue *q;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1593,11 +1624,12 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg) ...@@ -1593,11 +1624,12 @@ static int snd_seq_ioctl_get_named_queue(client_t *client, void __user *arg)
} }
/* GET_QUEUE_STATUS ioctl() */ /* GET_QUEUE_STATUS ioctl() */
static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg) static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_status_t status; struct snd_seq_queue_status status;
queue_t *queue; struct snd_seq_queue *queue;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
if (copy_from_user(&status, arg, sizeof(status))) if (copy_from_user(&status, arg, sizeof(status)))
return -EFAULT; return -EFAULT;
...@@ -1626,11 +1658,12 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg) ...@@ -1626,11 +1658,12 @@ static int snd_seq_ioctl_get_queue_status(client_t * client, void __user *arg)
/* GET_QUEUE_TEMPO ioctl() */ /* GET_QUEUE_TEMPO ioctl() */
static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg) static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_tempo_t tempo; struct snd_seq_queue_tempo tempo;
queue_t *queue; struct snd_seq_queue *queue;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
if (copy_from_user(&tempo, arg, sizeof(tempo))) if (copy_from_user(&tempo, arg, sizeof(tempo)))
return -EFAULT; return -EFAULT;
...@@ -1656,17 +1689,18 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg) ...@@ -1656,17 +1689,18 @@ static int snd_seq_ioctl_get_queue_tempo(client_t * client, void __user *arg)
/* SET_QUEUE_TEMPO ioctl() */ /* SET_QUEUE_TEMPO ioctl() */
int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo) int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo)
{ {
if (!snd_seq_queue_check_access(tempo->queue, client)) if (!snd_seq_queue_check_access(tempo->queue, client))
return -EPERM; return -EPERM;
return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo);
} }
static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg) static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client,
void __user *arg)
{ {
int result; int result;
snd_seq_queue_tempo_t tempo; struct snd_seq_queue_tempo tempo;
if (copy_from_user(&tempo, arg, sizeof(tempo))) if (copy_from_user(&tempo, arg, sizeof(tempo)))
return -EFAULT; return -EFAULT;
...@@ -1677,11 +1711,12 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg) ...@@ -1677,11 +1711,12 @@ static int snd_seq_ioctl_set_queue_tempo(client_t * client, void __user *arg)
/* GET_QUEUE_TIMER ioctl() */ /* GET_QUEUE_TIMER ioctl() */
static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg) static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_timer_t timer; struct snd_seq_queue_timer timer;
queue_t *queue; struct snd_seq_queue *queue;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
if (copy_from_user(&timer, arg, sizeof(timer))) if (copy_from_user(&timer, arg, sizeof(timer)))
return -EFAULT; return -EFAULT;
...@@ -1713,10 +1748,11 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg) ...@@ -1713,10 +1748,11 @@ static int snd_seq_ioctl_get_queue_timer(client_t * client, void __user *arg)
/* SET_QUEUE_TIMER ioctl() */ /* SET_QUEUE_TIMER ioctl() */
static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
void __user *arg)
{ {
int result = 0; int result = 0;
snd_seq_queue_timer_t timer; struct snd_seq_queue_timer timer;
if (copy_from_user(&timer, arg, sizeof(timer))) if (copy_from_user(&timer, arg, sizeof(timer)))
return -EFAULT; return -EFAULT;
...@@ -1725,8 +1761,8 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) ...@@ -1725,8 +1761,8 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg)
return -EINVAL; return -EINVAL;
if (snd_seq_queue_check_access(timer.queue, client->number)) { if (snd_seq_queue_check_access(timer.queue, client->number)) {
queue_t *q; struct snd_seq_queue *q;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
q = queueptr(timer.queue); q = queueptr(timer.queue);
if (q == NULL) if (q == NULL)
...@@ -1754,9 +1790,10 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg) ...@@ -1754,9 +1790,10 @@ static int snd_seq_ioctl_set_queue_timer(client_t * client, void __user *arg)
/* GET_QUEUE_CLIENT ioctl() */ /* GET_QUEUE_CLIENT ioctl() */
static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg) static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_queue_client_t info; struct snd_seq_queue_client info;
int used; int used;
if (copy_from_user(&info, arg, sizeof(info))) 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,10 +1812,11 @@ static int snd_seq_ioctl_get_queue_client(client_t * client, void __user *arg)
/* SET_QUEUE_CLIENT ioctl() */ /* SET_QUEUE_CLIENT ioctl() */
static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg) static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client,
void __user *arg)
{ {
int err; int err;
snd_seq_queue_client_t info; struct snd_seq_queue_client info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1794,10 +1832,11 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg) ...@@ -1794,10 +1832,11 @@ static int snd_seq_ioctl_set_queue_client(client_t * client, void __user *arg)
/* GET_CLIENT_POOL ioctl() */ /* GET_CLIENT_POOL ioctl() */
static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg) static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_client_pool_t info; struct snd_seq_client_pool info;
client_t *cptr; struct snd_seq_client *cptr;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1828,9 +1867,10 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg) ...@@ -1828,9 +1867,10 @@ static int snd_seq_ioctl_get_client_pool(client_t * client, void __user *arg)
} }
/* SET_CLIENT_POOL ioctl() */ /* SET_CLIENT_POOL ioctl() */
static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg) static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_client_pool_t info; struct snd_seq_client_pool info;
int rc; int rc;
if (copy_from_user(&info, arg, sizeof(info))) 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,9 +1912,10 @@ static int snd_seq_ioctl_set_client_pool(client_t * client, void __user *arg)
/* REMOVE_EVENTS ioctl() */ /* REMOVE_EVENTS ioctl() */
static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg) static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
void __user *arg)
{ {
snd_seq_remove_events_t info; struct snd_seq_remove_events info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -1901,13 +1942,14 @@ static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg) ...@@ -1901,13 +1942,14 @@ static int snd_seq_ioctl_remove_events(client_t * client, void __user *arg)
/* /*
* get subscription info * get subscription info
*/ */
static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg) static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
void __user *arg)
{ {
int result; int result;
client_t *sender = NULL; struct snd_seq_client *sender = NULL;
client_port_t *sport = NULL; struct snd_seq_client_port *sport = NULL;
snd_seq_port_subscribe_t subs; struct snd_seq_port_subscribe subs;
subscribers_t *p; struct snd_seq_subscribers *p;
if (copy_from_user(&subs, arg, sizeof(subs))) if (copy_from_user(&subs, arg, sizeof(subs)))
return -EFAULT; return -EFAULT;
...@@ -1940,13 +1982,14 @@ static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg) ...@@ -1940,13 +1982,14 @@ static int snd_seq_ioctl_get_subscription(client_t *client, void __user *arg)
/* /*
* get subscription info - check only its presence * get subscription info - check only its presence
*/ */
static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
void __user *arg)
{ {
int result = -ENXIO; int result = -ENXIO;
client_t *cptr = NULL; struct snd_seq_client *cptr = NULL;
client_port_t *port = NULL; struct snd_seq_client_port *port = NULL;
snd_seq_query_subs_t subs; struct snd_seq_query_subs subs;
port_subs_info_t *group; struct snd_seq_port_subs_info *group;
struct list_head *p; struct list_head *p;
int i; int i;
...@@ -1977,12 +2020,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) ...@@ -1977,12 +2020,12 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg)
list_for_each(p, &group->list_head) { list_for_each(p, &group->list_head) {
if (i++ == subs.index) { if (i++ == subs.index) {
/* found! */ /* found! */
subscribers_t *s; struct snd_seq_subscribers *s;
if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) { if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) {
s = list_entry(p, subscribers_t, src_list); s = list_entry(p, struct snd_seq_subscribers, src_list);
subs.addr = s->info.dest; subs.addr = s->info.dest;
} else { } else {
s = list_entry(p, subscribers_t, dest_list); s = list_entry(p, struct snd_seq_subscribers, dest_list);
subs.addr = s->info.sender; subs.addr = s->info.sender;
} }
subs.flags = s->info.flags; subs.flags = s->info.flags;
...@@ -2009,10 +2052,11 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg) ...@@ -2009,10 +2052,11 @@ static int snd_seq_ioctl_query_subs(client_t *client, void __user *arg)
/* /*
* query next client * query next client
*/ */
static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg) static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
void __user *arg)
{ {
client_t *cptr = NULL; struct snd_seq_client *cptr = NULL;
snd_seq_client_info_t info; struct snd_seq_client_info info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -2040,11 +2084,12 @@ static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg) ...@@ -2040,11 +2084,12 @@ static int snd_seq_ioctl_query_next_client(client_t *client, void __user *arg)
/* /*
* query next port * query next port
*/ */
static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg) static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client,
void __user *arg)
{ {
client_t *cptr; struct snd_seq_client *cptr;
client_port_t *port = NULL; struct snd_seq_client_port *port = NULL;
snd_seq_port_info_t info; struct snd_seq_port_info info;
if (copy_from_user(&info, arg, sizeof(info))) if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -2075,7 +2120,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg) ...@@ -2075,7 +2120,7 @@ static int snd_seq_ioctl_query_next_port(client_t *client, void __user *arg)
static struct seq_ioctl_table { static struct seq_ioctl_table {
unsigned int cmd; unsigned int cmd;
int (*func)(client_t *client, void __user * arg); int (*func)(struct snd_seq_client *client, void __user * arg);
} ioctl_tables[] = { } ioctl_tables[] = {
{ SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info }, { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info },
{ SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode }, { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode },
...@@ -2109,7 +2154,8 @@ static struct seq_ioctl_table { ...@@ -2109,7 +2154,8 @@ static struct seq_ioctl_table {
{ 0, NULL }, { 0, NULL },
}; };
static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg) static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd,
void __user *arg)
{ {
struct seq_ioctl_table *p; struct seq_ioctl_table *p;
...@@ -2136,7 +2182,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg ...@@ -2136,7 +2182,7 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg
static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
snd_assert(client != NULL, return -ENXIO); snd_assert(client != NULL, return -ENXIO);
...@@ -2153,9 +2199,10 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -2153,9 +2199,10 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg
/* exported to kernel modules */ /* exported to kernel modules */
int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t * callback) int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
struct snd_seq_client_callback *callback)
{ {
client_t *client; struct snd_seq_client *client;
snd_assert(! in_interrupt(), return -EBUSY); snd_assert(! in_interrupt(), return -EBUSY);
...@@ -2199,7 +2246,7 @@ int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_cli ...@@ -2199,7 +2246,7 @@ int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_cli
/* exported to kernel modules */ /* exported to kernel modules */
int snd_seq_delete_kernel_client(int client) int snd_seq_delete_kernel_client(int client)
{ {
client_t *ptr; struct snd_seq_client *ptr;
snd_assert(! in_interrupt(), return -EBUSY); snd_assert(! in_interrupt(), return -EBUSY);
...@@ -2216,11 +2263,11 @@ int snd_seq_delete_kernel_client(int client) ...@@ -2216,11 +2263,11 @@ int snd_seq_delete_kernel_client(int client)
/* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue /* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue
* and snd_seq_kernel_client_enqueue_blocking * and snd_seq_kernel_client_enqueue_blocking
*/ */
static int kernel_client_enqueue(int client, snd_seq_event_t *ev, static int kernel_client_enqueue(int client, struct snd_seq_event *ev,
struct file *file, int blocking, struct file *file, int blocking,
int atomic, int hop) int atomic, int hop)
{ {
client_t *cptr; struct snd_seq_client *cptr;
int result; int result;
snd_assert(ev != NULL, return -EINVAL); snd_assert(ev != NULL, return -EINVAL);
...@@ -2254,7 +2301,7 @@ static int kernel_client_enqueue(int client, snd_seq_event_t *ev, ...@@ -2254,7 +2301,7 @@ static int kernel_client_enqueue(int client, snd_seq_event_t *ev,
* *
* RETURN VALUE: zero if succeed, negative if error * RETURN VALUE: zero if succeed, negative if error
*/ */
int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev, int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event * ev,
int atomic, int hop) int atomic, int hop)
{ {
return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop); 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,7 +2312,7 @@ int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t * ev,
* *
* RETURN VALUE: zero if succeed, negative if error * RETURN VALUE: zero if succeed, negative if error
*/ */
int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
struct file *file, struct file *file,
int atomic, int hop) int atomic, int hop)
{ {
...@@ -2280,10 +2327,10 @@ int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, ...@@ -2280,10 +2327,10 @@ int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev,
* RETURN VALUE: negative = delivery failed, * RETURN VALUE: negative = delivery failed,
* zero, or positive: the number of delivered events * zero, or positive: the number of delivered events
*/ */
int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev,
int atomic, int hop) int atomic, int hop)
{ {
client_t *cptr; struct snd_seq_client *cptr;
int result; int result;
snd_assert(ev != NULL, return -EINVAL); snd_assert(ev != NULL, return -EINVAL);
...@@ -2315,7 +2362,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, ...@@ -2315,7 +2362,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev,
*/ */
int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
{ {
client_t *client; struct snd_seq_client *client;
mm_segment_t fs; mm_segment_t fs;
int result; int result;
...@@ -2332,7 +2379,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) ...@@ -2332,7 +2379,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
/* exported (for OSS emulator) */ /* exported (for OSS emulator) */
int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait) int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait)
{ {
client_t *client; struct snd_seq_client *client;
client = clientptr(clientid); client = clientptr(clientid);
if (client == NULL) if (client == NULL)
...@@ -2350,10 +2397,12 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table ...@@ -2350,10 +2397,12 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table
/* /*
* /proc interface * /proc interface
*/ */
static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_info_t *group, int is_src, char *msg) static void snd_seq_info_dump_subscribers(struct snd_info_buffer *buffer,
struct snd_seq_port_subs_info *group,
int is_src, char *msg)
{ {
struct list_head *p; struct list_head *p;
subscribers_t *s; struct snd_seq_subscribers *s;
int count = 0; int count = 0;
down_read(&group->list_mutex); 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,9 +2413,9 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i
snd_iprintf(buffer, msg); snd_iprintf(buffer, msg);
list_for_each(p, &group->list_head) { list_for_each(p, &group->list_head) {
if (is_src) if (is_src)
s = list_entry(p, subscribers_t, src_list); s = list_entry(p, struct snd_seq_subscribers, src_list);
else else
s = list_entry(p, subscribers_t, dest_list); s = list_entry(p, struct snd_seq_subscribers, dest_list);
if (count++) if (count++)
snd_iprintf(buffer, ", "); snd_iprintf(buffer, ", ");
snd_iprintf(buffer, "%d:%d", 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,13 +2436,14 @@ static void snd_seq_info_dump_subscribers(snd_info_buffer_t *buffer, port_subs_i
#define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-') #define FLAG_PERM_DUPLEX(perm) ((perm) & SNDRV_SEQ_PORT_CAP_DUPLEX ? 'X' : '-')
static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client) static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
struct snd_seq_client *client)
{ {
struct list_head *l; struct list_head *l;
down(&client->ports_mutex); down(&client->ports_mutex);
list_for_each(l, &client->ports_list_head) { list_for_each(l, &client->ports_list_head) {
client_port_t *p = list_entry(l, client_port_t, list); struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n",
p->addr.port, p->name, p->addr.port, p->name,
FLAG_PERM_RD(p->capability), 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,13 +2457,15 @@ static void snd_seq_info_dump_ports(snd_info_buffer_t *buffer, client_t *client)
} }
void snd_seq_info_pool(struct snd_info_buffer *buffer,
struct snd_seq_pool *pool, char *space);
/* exported to seq_info.c */ /* exported to seq_info.c */
void snd_seq_info_clients_read(snd_info_entry_t *entry, void snd_seq_info_clients_read(struct snd_info_entry *entry,
snd_info_buffer_t * buffer) struct snd_info_buffer *buffer)
{ {
extern void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t * pool, char *space);
int c; int c;
client_t *client; struct snd_seq_client *client;
snd_iprintf(buffer, "Client info\n"); snd_iprintf(buffer, "Client info\n");
snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur); snd_iprintf(buffer, " cur clients : %d\n", client_usage.cur);
...@@ -2468,7 +2520,7 @@ static struct file_operations snd_seq_f_ops = ...@@ -2468,7 +2520,7 @@ static struct file_operations snd_seq_f_ops =
.compat_ioctl = snd_seq_ioctl_compat, .compat_ioctl = snd_seq_ioctl_compat,
}; };
static snd_minor_t snd_seq_reg = static struct snd_minor snd_seq_reg =
{ {
.comment = "sequencer", .comment = "sequencer",
.f_ops = &snd_seq_f_ops, .f_ops = &snd_seq_f_ops,
......
...@@ -30,24 +30,24 @@ ...@@ -30,24 +30,24 @@
/* client manager */ /* client manager */
struct _snd_seq_user_client { struct snd_seq_user_client {
struct file *file; /* file struct of client */ struct file *file; /* file struct of client */
/* ... */ /* ... */
/* fifo */ /* fifo */
fifo_t *fifo; /* queue for incoming events */ struct snd_seq_fifo *fifo; /* queue for incoming events */
int fifo_pool_size; int fifo_pool_size;
}; };
struct _snd_seq_kernel_client { struct snd_seq_kernel_client {
snd_card_t *card; struct snd_card *card;
/* pointer to client functions */ /* pointer to client functions */
void *private_data; /* private data for client */ void *private_data; /* private data for client */
/* ... */ /* ... */
}; };
struct _snd_seq_client { struct snd_seq_client {
snd_seq_client_type_t type; snd_seq_client_type_t type;
unsigned int accept_input: 1, unsigned int accept_input: 1,
accept_output: 1; accept_output: 1;
...@@ -65,40 +65,42 @@ struct _snd_seq_client { ...@@ -65,40 +65,42 @@ struct _snd_seq_client {
int convert32; /* convert 32->64bit */ int convert32; /* convert 32->64bit */
/* output pool */ /* output pool */
pool_t *pool; /* memory pool for this client */ struct snd_seq_pool *pool; /* memory pool for this client */
union { union {
user_client_t user; struct snd_seq_user_client user;
kernel_client_t kernel; struct snd_seq_kernel_client kernel;
} data; } data;
}; };
/* usage statistics */ /* usage statistics */
typedef struct { struct snd_seq_usage {
int cur; int cur;
int peak; int peak;
} usage_t; };
extern int client_init_data(void); int client_init_data(void);
extern int snd_sequencer_device_init(void); int snd_sequencer_device_init(void);
extern void snd_sequencer_device_done(void); void snd_sequencer_device_done(void);
/* get locked pointer to client */ /* get locked pointer to client */
extern client_t *snd_seq_client_use_ptr(int clientid); struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
/* unlock pointer to client */ /* unlock pointer to client */
#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock) #define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
/* dispatch event to client(s) */ /* dispatch event to client(s) */
extern int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop); int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
/* exported to other modules */ /* exported to other modules */
extern int snd_seq_register_kernel_client(snd_seq_client_callback_t *callback, void *private_data); int snd_seq_register_kernel_client(struct snd_seq_client_callback *callback, void *private_data);
extern int snd_seq_unregister_kernel_client(int client); int snd_seq_unregister_kernel_client(int client);
extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, struct file *file, int atomic, int hop); int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
struct file *file, int atomic, int hop);
int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait); int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
int snd_seq_client_notify_subscription(int client, int port, snd_seq_port_subscribe_t *info, int evtype); int snd_seq_client_notify_subscription(int client, int port,
struct snd_seq_port_subscribe *info, int evtype);
#endif #endif
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include <linux/compat.h> #include <linux/compat.h>
struct sndrv_seq_port_info32 { struct snd_seq_port_info32 {
struct sndrv_seq_addr addr; /* client/port numbers */ struct snd_seq_addr addr; /* client/port numbers */
char name[64]; /* port name */ char name[64]; /* port name */
u32 capability; /* port capability bits */ u32 capability; /* port capability bits */
...@@ -41,11 +41,11 @@ struct sndrv_seq_port_info32 { ...@@ -41,11 +41,11 @@ struct sndrv_seq_port_info32 {
char reserved[59]; /* for future use */ char reserved[59]; /* for future use */
}; };
static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd, static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned int cmd,
struct sndrv_seq_port_info32 __user *data32) struct snd_seq_port_info32 __user *data32)
{ {
int err = -EFAULT; int err = -EFAULT;
snd_seq_port_info_t *data; struct snd_seq_port_info *data;
mm_segment_t fs; mm_segment_t fs;
data = kmalloc(sizeof(*data), GFP_KERNEL); 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,16 +80,16 @@ static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd,
*/ */
enum { enum {
SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct snd_seq_port_info32),
}; };
static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
void __user *argp = compat_ptr(arg); void __user *argp = compat_ptr(arg);
snd_assert(client != NULL, return -ENXIO); snd_assert(client != NULL, return -ENXIO);
......
...@@ -50,11 +50,6 @@ MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); ...@@ -50,11 +50,6 @@ MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
MODULE_DESCRIPTION("ALSA sequencer device management"); MODULE_DESCRIPTION("ALSA sequencer device management");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/*
* driver list
*/
typedef struct ops_list ops_list_t;
/* driver state */ /* driver state */
#define DRIVER_EMPTY 0 #define DRIVER_EMPTY 0
#define DRIVER_LOADED (1<<0) #define DRIVER_LOADED (1<<0)
...@@ -68,7 +63,7 @@ struct ops_list { ...@@ -68,7 +63,7 @@ struct ops_list {
int argsize; /* argument size */ int argsize; /* argument size */
/* operators */ /* operators */
snd_seq_dev_ops_t ops; struct snd_seq_dev_ops ops;
/* registred devices */ /* registred devices */
struct list_head dev_list; /* list of devices */ struct list_head dev_list; /* list of devices */
...@@ -83,35 +78,36 @@ struct ops_list { ...@@ -83,35 +78,36 @@ struct ops_list {
static LIST_HEAD(opslist); static LIST_HEAD(opslist);
static int num_ops; static int num_ops;
static DECLARE_MUTEX(ops_mutex); static DECLARE_MUTEX(ops_mutex);
static snd_info_entry_t *info_entry = NULL; static struct snd_info_entry *info_entry = NULL;
/* /*
* prototypes * prototypes
*/ */
static int snd_seq_device_free(snd_seq_device_t *dev); static int snd_seq_device_free(struct snd_seq_device *dev);
static int snd_seq_device_dev_free(snd_device_t *device); static int snd_seq_device_dev_free(struct snd_device *device);
static int snd_seq_device_dev_register(snd_device_t *device); static int snd_seq_device_dev_register(struct snd_device *device);
static int snd_seq_device_dev_disconnect(snd_device_t *device); static int snd_seq_device_dev_disconnect(struct snd_device *device);
static int snd_seq_device_dev_unregister(snd_device_t *device); static int snd_seq_device_dev_unregister(struct snd_device *device);
static int init_device(snd_seq_device_t *dev, ops_list_t *ops); static int init_device(struct snd_seq_device *dev, struct ops_list *ops);
static int free_device(snd_seq_device_t *dev, ops_list_t *ops); static int free_device(struct snd_seq_device *dev, struct ops_list *ops);
static ops_list_t *find_driver(char *id, int create_if_empty); static struct ops_list *find_driver(char *id, int create_if_empty);
static ops_list_t *create_driver(char *id); static struct ops_list *create_driver(char *id);
static void unlock_driver(ops_list_t *ops); static void unlock_driver(struct ops_list *ops);
static void remove_drivers(void); static void remove_drivers(void);
/* /*
* show all drivers and their status * show all drivers and their status
*/ */
static void snd_seq_device_info(snd_info_entry_t *entry, snd_info_buffer_t * buffer) static void snd_seq_device_info(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
struct list_head *head; struct list_head *head;
down(&ops_mutex); down(&ops_mutex);
list_for_each(head, &opslist) { list_for_each(head, &opslist) {
ops_list_t *ops = list_entry(head, ops_list_t, list); struct ops_list *ops = list_entry(head, struct ops_list, list);
snd_iprintf(buffer, "snd-%s%s%s%s,%d\n", snd_iprintf(buffer, "snd-%s%s%s%s,%d\n",
ops->id, ops->id,
ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""), ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""),
...@@ -156,7 +152,7 @@ void snd_seq_device_load_drivers(void) ...@@ -156,7 +152,7 @@ void snd_seq_device_load_drivers(void)
down(&ops_mutex); down(&ops_mutex);
list_for_each(head, &opslist) { list_for_each(head, &opslist) {
ops_list_t *ops = list_entry(head, ops_list_t, list); struct ops_list *ops = list_entry(head, struct ops_list, list);
if (! (ops->driver & DRIVER_LOADED) && if (! (ops->driver & DRIVER_LOADED) &&
! (ops->driver & DRIVER_REQUESTED)) { ! (ops->driver & DRIVER_REQUESTED)) {
ops->used++; ops->used++;
...@@ -178,13 +174,13 @@ void snd_seq_device_load_drivers(void) ...@@ -178,13 +174,13 @@ void snd_seq_device_load_drivers(void)
* id = id of driver * id = id of driver
* result = return pointer (NULL allowed if unnecessary) * result = return pointer (NULL allowed if unnecessary)
*/ */
int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize,
snd_seq_device_t **result) struct snd_seq_device **result)
{ {
snd_seq_device_t *dev; struct snd_seq_device *dev;
ops_list_t *ops; struct ops_list *ops;
int err; int err;
static snd_device_ops_t dops = { static struct snd_device_ops dops = {
.dev_free = snd_seq_device_dev_free, .dev_free = snd_seq_device_dev_free,
.dev_register = snd_seq_device_dev_register, .dev_register = snd_seq_device_dev_register,
.dev_disconnect = snd_seq_device_dev_disconnect, .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,9 +231,9 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize,
/* /*
* free the existing device * free the existing device
*/ */
static int snd_seq_device_free(snd_seq_device_t *dev) static int snd_seq_device_free(struct snd_seq_device *dev)
{ {
ops_list_t *ops; struct ops_list *ops;
snd_assert(dev != NULL, return -EINVAL); snd_assert(dev != NULL, return -EINVAL);
...@@ -261,19 +257,19 @@ static int snd_seq_device_free(snd_seq_device_t *dev) ...@@ -261,19 +257,19 @@ static int snd_seq_device_free(snd_seq_device_t *dev)
return 0; return 0;
} }
static int snd_seq_device_dev_free(snd_device_t *device) static int snd_seq_device_dev_free(struct snd_device *device)
{ {
snd_seq_device_t *dev = device->device_data; struct snd_seq_device *dev = device->device_data;
return snd_seq_device_free(dev); return snd_seq_device_free(dev);
} }
/* /*
* register the device * register the device
*/ */
static int snd_seq_device_dev_register(snd_device_t *device) static int snd_seq_device_dev_register(struct snd_device *device)
{ {
snd_seq_device_t *dev = device->device_data; struct snd_seq_device *dev = device->device_data;
ops_list_t *ops; struct ops_list *ops;
ops = find_driver(dev->id, 0); ops = find_driver(dev->id, 0);
if (ops == NULL) if (ops == NULL)
...@@ -292,10 +288,10 @@ static int snd_seq_device_dev_register(snd_device_t *device) ...@@ -292,10 +288,10 @@ static int snd_seq_device_dev_register(snd_device_t *device)
/* /*
* disconnect the device * disconnect the device
*/ */
static int snd_seq_device_dev_disconnect(snd_device_t *device) static int snd_seq_device_dev_disconnect(struct snd_device *device)
{ {
snd_seq_device_t *dev = device->device_data; struct snd_seq_device *dev = device->device_data;
ops_list_t *ops; struct ops_list *ops;
ops = find_driver(dev->id, 0); ops = find_driver(dev->id, 0);
if (ops == NULL) if (ops == NULL)
...@@ -310,9 +306,9 @@ static int snd_seq_device_dev_disconnect(snd_device_t *device) ...@@ -310,9 +306,9 @@ static int snd_seq_device_dev_disconnect(snd_device_t *device)
/* /*
* unregister the existing device * unregister the existing device
*/ */
static int snd_seq_device_dev_unregister(snd_device_t *device) static int snd_seq_device_dev_unregister(struct snd_device *device)
{ {
snd_seq_device_t *dev = device->device_data; struct snd_seq_device *dev = device->device_data;
return snd_seq_device_free(dev); return snd_seq_device_free(dev);
} }
...@@ -321,10 +317,11 @@ static int snd_seq_device_dev_unregister(snd_device_t *device) ...@@ -321,10 +317,11 @@ static int snd_seq_device_dev_unregister(snd_device_t *device)
* id = driver id * id = driver id
* entry = driver operators - duplicated to each instance * entry = driver operators - duplicated to each instance
*/ */
int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize) int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,
int argsize)
{ {
struct list_head *head; struct list_head *head;
ops_list_t *ops; struct ops_list *ops;
if (id == NULL || entry == NULL || if (id == NULL || entry == NULL ||
entry->init_device == NULL || entry->free_device == NULL) 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,7 +348,7 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi
/* initialize existing devices if necessary */ /* initialize existing devices if necessary */
list_for_each(head, &ops->dev_list) { list_for_each(head, &ops->dev_list) {
snd_seq_device_t *dev = list_entry(head, snd_seq_device_t, list); struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
init_device(dev, ops); init_device(dev, ops);
} }
up(&ops->reg_mutex); 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,9 +363,9 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi
/* /*
* create driver record * create driver record
*/ */
static ops_list_t * create_driver(char *id) static struct ops_list * create_driver(char *id)
{ {
ops_list_t *ops; struct ops_list *ops;
ops = kmalloc(sizeof(*ops), GFP_KERNEL); ops = kmalloc(sizeof(*ops), GFP_KERNEL);
if (ops == NULL) if (ops == NULL)
...@@ -399,14 +396,15 @@ static ops_list_t * create_driver(char *id) ...@@ -399,14 +396,15 @@ static ops_list_t * create_driver(char *id)
int snd_seq_device_unregister_driver(char *id) int snd_seq_device_unregister_driver(char *id)
{ {
struct list_head *head; struct list_head *head;
ops_list_t *ops; struct ops_list *ops;
ops = find_driver(id, 0); ops = find_driver(id, 0);
if (ops == NULL) if (ops == NULL)
return -ENXIO; return -ENXIO;
if (! (ops->driver & DRIVER_LOADED) || if (! (ops->driver & DRIVER_LOADED) ||
(ops->driver & DRIVER_LOCKED)) { (ops->driver & DRIVER_LOCKED)) {
snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", id, ops->driver); snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n",
id, ops->driver);
unlock_driver(ops); unlock_driver(ops);
return -EBUSY; return -EBUSY;
} }
...@@ -415,13 +413,14 @@ int snd_seq_device_unregister_driver(char *id) ...@@ -415,13 +413,14 @@ int snd_seq_device_unregister_driver(char *id)
down(&ops->reg_mutex); down(&ops->reg_mutex);
ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */ ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */
list_for_each(head, &ops->dev_list) { list_for_each(head, &ops->dev_list) {
snd_seq_device_t *dev = list_entry(head, snd_seq_device_t, list); struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
free_device(dev, ops); free_device(dev, ops);
} }
ops->driver = 0; ops->driver = 0;
if (ops->num_init_devices > 0) if (ops->num_init_devices > 0)
snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", ops->num_init_devices); snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n",
ops->num_init_devices);
up(&ops->reg_mutex); up(&ops->reg_mutex);
unlock_driver(ops); unlock_driver(ops);
...@@ -443,7 +442,7 @@ static void remove_drivers(void) ...@@ -443,7 +442,7 @@ static void remove_drivers(void)
down(&ops_mutex); down(&ops_mutex);
head = opslist.next; head = opslist.next;
while (head != &opslist) { while (head != &opslist) {
ops_list_t *ops = list_entry(head, ops_list_t, list); struct ops_list *ops = list_entry(head, struct ops_list, list);
if (! (ops->driver & DRIVER_LOADED) && if (! (ops->driver & DRIVER_LOADED) &&
ops->used == 0 && ops->num_devices == 0) { ops->used == 0 && ops->num_devices == 0) {
head = head->next; head = head->next;
...@@ -459,21 +458,23 @@ static void remove_drivers(void) ...@@ -459,21 +458,23 @@ static void remove_drivers(void)
/* /*
* initialize the device - call init_device operator * initialize the device - call init_device operator
*/ */
static int init_device(snd_seq_device_t *dev, ops_list_t *ops) static int init_device(struct snd_seq_device *dev, struct ops_list *ops)
{ {
if (! (ops->driver & DRIVER_LOADED)) if (! (ops->driver & DRIVER_LOADED))
return 0; /* driver is not loaded yet */ return 0; /* driver is not loaded yet */
if (dev->status != SNDRV_SEQ_DEVICE_FREE) if (dev->status != SNDRV_SEQ_DEVICE_FREE)
return 0; /* already initialized */ return 0; /* already initialized */
if (ops->argsize != dev->argsize) { if (ops->argsize != dev->argsize) {
snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n",
dev->name, ops->id, ops->argsize, dev->argsize);
return -EINVAL; return -EINVAL;
} }
if (ops->ops.init_device(dev) >= 0) { if (ops->ops.init_device(dev) >= 0) {
dev->status = SNDRV_SEQ_DEVICE_REGISTERED; dev->status = SNDRV_SEQ_DEVICE_REGISTERED;
ops->num_init_devices++; ops->num_init_devices++;
} else { } else {
snd_printk(KERN_ERR "init_device failed: %s: %s\n", dev->name, dev->id); snd_printk(KERN_ERR "init_device failed: %s: %s\n",
dev->name, dev->id);
} }
return 0; return 0;
...@@ -482,7 +483,7 @@ static int init_device(snd_seq_device_t *dev, ops_list_t *ops) ...@@ -482,7 +483,7 @@ static int init_device(snd_seq_device_t *dev, ops_list_t *ops)
/* /*
* release the device - call free_device operator * release the device - call free_device operator
*/ */
static int free_device(snd_seq_device_t *dev, ops_list_t *ops) static int free_device(struct snd_seq_device *dev, struct ops_list *ops)
{ {
int result; int result;
...@@ -491,7 +492,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) ...@@ -491,7 +492,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops)
if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED)
return 0; /* not registered */ return 0; /* not registered */
if (ops->argsize != dev->argsize) { if (ops->argsize != dev->argsize) {
snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n",
dev->name, ops->id, ops->argsize, dev->argsize);
return -EINVAL; return -EINVAL;
} }
if ((result = ops->ops.free_device(dev)) >= 0 || result == -ENXIO) { 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,7 +501,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops)
dev->driver_data = NULL; dev->driver_data = NULL;
ops->num_init_devices--; ops->num_init_devices--;
} else { } else {
snd_printk(KERN_ERR "free_device failed: %s: %s\n", dev->name, dev->id); snd_printk(KERN_ERR "free_device failed: %s: %s\n",
dev->name, dev->id);
} }
return 0; return 0;
...@@ -508,13 +511,13 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) ...@@ -508,13 +511,13 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops)
/* /*
* find the matching driver with given id * find the matching driver with given id
*/ */
static ops_list_t * find_driver(char *id, int create_if_empty) static struct ops_list * find_driver(char *id, int create_if_empty)
{ {
struct list_head *head; struct list_head *head;
down(&ops_mutex); down(&ops_mutex);
list_for_each(head, &opslist) { list_for_each(head, &opslist) {
ops_list_t *ops = list_entry(head, ops_list_t, list); struct ops_list *ops = list_entry(head, struct ops_list, list);
if (strcmp(ops->id, id) == 0) { if (strcmp(ops->id, id) == 0) {
ops->used++; ops->used++;
up(&ops_mutex); up(&ops_mutex);
...@@ -527,7 +530,7 @@ static ops_list_t * find_driver(char *id, int create_if_empty) ...@@ -527,7 +530,7 @@ static ops_list_t * find_driver(char *id, int create_if_empty)
return NULL; return NULL;
} }
static void unlock_driver(ops_list_t *ops) static void unlock_driver(struct ops_list *ops)
{ {
down(&ops_mutex); down(&ops_mutex);
ops->used--; ops->used--;
...@@ -541,7 +544,8 @@ static void unlock_driver(ops_list_t *ops) ...@@ -541,7 +544,8 @@ static void unlock_driver(ops_list_t *ops)
static int __init alsa_seq_device_init(void) static int __init alsa_seq_device_init(void)
{ {
info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers", snd_seq_root); info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers",
snd_seq_root);
if (info_entry == NULL) if (info_entry == NULL)
return -ENOMEM; return -ENOMEM;
info_entry->content = SNDRV_INFO_CONTENT_TEXT; info_entry->content = SNDRV_INFO_CONTENT_TEXT;
......
...@@ -73,12 +73,12 @@ MODULE_PARM_DESC(ports, "number of ports to be created"); ...@@ -73,12 +73,12 @@ MODULE_PARM_DESC(ports, "number of ports to be created");
module_param(duplex, bool, 0444); module_param(duplex, bool, 0444);
MODULE_PARM_DESC(duplex, "create DUPLEX ports"); MODULE_PARM_DESC(duplex, "create DUPLEX ports");
typedef struct snd_seq_dummy_port { struct snd_seq_dummy_port {
int client; int client;
int port; int port;
int duplex; int duplex;
int connect; int connect;
} snd_seq_dummy_port_t; };
static int my_client = -1; static int my_client = -1;
...@@ -88,11 +88,11 @@ static int my_client = -1; ...@@ -88,11 +88,11 @@ static int my_client = -1;
* Note: this callback is called only after all subscribers are removed. * Note: this callback is called only after all subscribers are removed.
*/ */
static int static int
dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info) dummy_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{ {
snd_seq_dummy_port_t *p; struct snd_seq_dummy_port *p;
int i; int i;
snd_seq_event_t ev; struct snd_seq_event ev;
p = private_data; p = private_data;
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
...@@ -116,10 +116,11 @@ dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info) ...@@ -116,10 +116,11 @@ dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info)
* event input callback - just redirect events to subscribers * event input callback - just redirect events to subscribers
*/ */
static int static int
dummy_input(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop) dummy_input(struct snd_seq_event *ev, int direct, void *private_data,
int atomic, int hop)
{ {
snd_seq_dummy_port_t *p; struct snd_seq_dummy_port *p;
snd_seq_event_t tmpev; struct snd_seq_event tmpev;
p = private_data; p = private_data;
if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM || if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM ||
...@@ -146,12 +147,12 @@ dummy_free(void *private_data) ...@@ -146,12 +147,12 @@ dummy_free(void *private_data)
/* /*
* create a port * create a port
*/ */
static snd_seq_dummy_port_t __init * static struct snd_seq_dummy_port __init *
create_port(int idx, int type) create_port(int idx, int type)
{ {
snd_seq_port_info_t pinfo; struct snd_seq_port_info pinfo;
snd_seq_port_callback_t pcb; struct snd_seq_port_callback pcb;
snd_seq_dummy_port_t *rec; struct snd_seq_dummy_port *rec;
if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL)
return NULL; return NULL;
...@@ -192,9 +193,9 @@ create_port(int idx, int type) ...@@ -192,9 +193,9 @@ create_port(int idx, int type)
static int __init static int __init
register_client(void) register_client(void)
{ {
snd_seq_client_callback_t cb; struct snd_seq_client_callback cb;
snd_seq_client_info_t cinfo; struct snd_seq_client_info cinfo;
snd_seq_dummy_port_t *rec1, *rec2; struct snd_seq_dummy_port *rec1, *rec2;
int i; int i;
if (ports < 1) { if (ports < 1) {
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
/* FIFO */ /* FIFO */
/* create new fifo */ /* create new fifo */
fifo_t *snd_seq_fifo_new(int poolsize) struct snd_seq_fifo *snd_seq_fifo_new(int poolsize)
{ {
fifo_t *f; struct snd_seq_fifo *f;
f = kzalloc(sizeof(*f), GFP_KERNEL); f = kzalloc(sizeof(*f), GFP_KERNEL);
if (f == NULL) { if (f == NULL) {
...@@ -62,9 +62,9 @@ fifo_t *snd_seq_fifo_new(int poolsize) ...@@ -62,9 +62,9 @@ fifo_t *snd_seq_fifo_new(int poolsize)
return f; return f;
} }
void snd_seq_fifo_delete(fifo_t **fifo) void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
{ {
fifo_t *f; struct snd_seq_fifo *f;
snd_assert(fifo != NULL, return); snd_assert(fifo != NULL, return);
f = *fifo; f = *fifo;
...@@ -88,12 +88,12 @@ void snd_seq_fifo_delete(fifo_t **fifo) ...@@ -88,12 +88,12 @@ void snd_seq_fifo_delete(fifo_t **fifo)
kfree(f); kfree(f);
} }
static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f); static struct snd_seq_event_cell *fifo_cell_out(struct snd_seq_fifo *f);
/* clear queue */ /* clear queue */
void snd_seq_fifo_clear(fifo_t *f) void snd_seq_fifo_clear(struct snd_seq_fifo *f)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
/* clear overflow flag */ /* clear overflow flag */
...@@ -110,9 +110,10 @@ void snd_seq_fifo_clear(fifo_t *f) ...@@ -110,9 +110,10 @@ void snd_seq_fifo_clear(fifo_t *f)
/* enqueue event to fifo */ /* enqueue event to fifo */
int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event) int snd_seq_fifo_event_in(struct snd_seq_fifo *f,
struct snd_seq_event *event)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
int err; int err;
...@@ -148,9 +149,9 @@ int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event) ...@@ -148,9 +149,9 @@ int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event)
} }
/* dequeue cell from fifo */ /* dequeue cell from fifo */
static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f) static struct snd_seq_event_cell *fifo_cell_out(struct snd_seq_fifo *f)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
if ((cell = f->head) != NULL) { if ((cell = f->head) != NULL) {
f->head = cell->next; f->head = cell->next;
...@@ -167,9 +168,10 @@ static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f) ...@@ -167,9 +168,10 @@ static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f)
} }
/* dequeue cell from fifo and copy on user space */ /* dequeue cell from fifo and copy on user space */
int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock) int snd_seq_fifo_cell_out(struct snd_seq_fifo *f,
struct snd_seq_event_cell **cellp, int nonblock)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
wait_queue_t wait; wait_queue_t wait;
...@@ -202,7 +204,8 @@ int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock) ...@@ -202,7 +204,8 @@ int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock)
} }
void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell) void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f,
struct snd_seq_event_cell *cell)
{ {
unsigned long flags; unsigned long flags;
...@@ -217,18 +220,19 @@ void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell) ...@@ -217,18 +220,19 @@ void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell)
/* polling; return non-zero if queue is available */ /* polling; return non-zero if queue is available */
int snd_seq_fifo_poll_wait(fifo_t *f, struct file *file, poll_table *wait) int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file,
poll_table *wait)
{ {
poll_wait(file, &f->input_sleep, wait); poll_wait(file, &f->input_sleep, wait);
return (f->cells > 0); return (f->cells > 0);
} }
/* change the size of pool; all old events are removed */ /* change the size of pool; all old events are removed */
int snd_seq_fifo_resize(fifo_t *f, int poolsize) int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
{ {
unsigned long flags; unsigned long flags;
pool_t *newpool, *oldpool; struct snd_seq_pool *newpool, *oldpool;
snd_seq_event_cell_t *cell, *next, *oldhead; struct snd_seq_event_cell *cell, *next, *oldhead;
snd_assert(f != NULL && f->pool != NULL, return -EINVAL); snd_assert(f != NULL && f->pool != NULL, return -EINVAL);
......
...@@ -27,46 +27,46 @@ ...@@ -27,46 +27,46 @@
/* === FIFO === */ /* === FIFO === */
typedef struct { struct snd_seq_fifo {
pool_t *pool; /* FIFO pool */ struct snd_seq_pool *pool; /* FIFO pool */
snd_seq_event_cell_t* head; /* pointer to head of fifo */ struct snd_seq_event_cell *head; /* pointer to head of fifo */
snd_seq_event_cell_t* tail; /* pointer to tail of fifo */ struct snd_seq_event_cell *tail; /* pointer to tail of fifo */
int cells; int cells;
spinlock_t lock; spinlock_t lock;
snd_use_lock_t use_lock; snd_use_lock_t use_lock;
wait_queue_head_t input_sleep; wait_queue_head_t input_sleep;
atomic_t overflow; atomic_t overflow;
} fifo_t; };
/* create new fifo (constructor) */ /* create new fifo (constructor) */
extern fifo_t *snd_seq_fifo_new(int poolsize); struct snd_seq_fifo *snd_seq_fifo_new(int poolsize);
/* delete fifo (destructor) */ /* delete fifo (destructor) */
extern void snd_seq_fifo_delete(fifo_t **f); void snd_seq_fifo_delete(struct snd_seq_fifo **f);
/* enqueue event to fifo */ /* enqueue event to fifo */
extern int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event); int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event);
/* lock fifo from release */ /* lock fifo from release */
#define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock) #define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock)
#define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock) #define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock)
/* get a cell from fifo - fifo should be locked */ /* get a cell from fifo - fifo should be locked */
int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock); int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, struct snd_seq_event_cell **cellp, int nonblock);
/* free dequeued cell - fifo should be locked */ /* free dequeued cell - fifo should be locked */
extern void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell); void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f, struct snd_seq_event_cell *cell);
/* clean up queue */ /* clean up queue */
extern void snd_seq_fifo_clear(fifo_t *f); void snd_seq_fifo_clear(struct snd_seq_fifo *f);
/* polling */ /* polling */
extern int snd_seq_fifo_poll_wait(fifo_t *f, struct file *file, poll_table *wait); int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table *wait);
/* resize pool in fifo */ /* resize pool in fifo */
int snd_seq_fifo_resize(fifo_t *f, int poolsize); int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
#endif #endif
...@@ -28,15 +28,16 @@ ...@@ -28,15 +28,16 @@
#include "seq_timer.h" #include "seq_timer.h"
static snd_info_entry_t *queues_entry; static struct snd_info_entry *queues_entry;
static snd_info_entry_t *clients_entry; static struct snd_info_entry *clients_entry;
static snd_info_entry_t *timer_entry; static struct snd_info_entry *timer_entry;
static snd_info_entry_t * __init static struct snd_info_entry * __init
create_info_entry(char *name, int size, void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) create_info_entry(char *name, int size, void (*read)(struct snd_info_entry *,
struct snd_info_buffer *))
{ {
snd_info_entry_t *entry; struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root); entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root);
if (entry == NULL) if (entry == NULL)
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#include <sound/info.h> #include <sound/info.h>
#include <sound/seq_kernel.h> #include <sound/seq_kernel.h>
void snd_seq_info_clients_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); void snd_seq_info_clients_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
void snd_seq_info_timer_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); void snd_seq_info_timer_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
void snd_seq_info_queues_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); void snd_seq_info_queues_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
int snd_seq_info_init( void ); int snd_seq_info_init( void );
......
...@@ -31,7 +31,7 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer instrument libra ...@@ -31,7 +31,7 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer instrument libra
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static void snd_instr_lock_ops(snd_seq_kinstr_list_t *list) static void snd_instr_lock_ops(struct snd_seq_kinstr_list *list)
{ {
if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
spin_lock_irqsave(&list->ops_lock, list->ops_flags); 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,7 +40,7 @@ static void snd_instr_lock_ops(snd_seq_kinstr_list_t *list)
} }
} }
static void snd_instr_unlock_ops(snd_seq_kinstr_list_t *list) static void snd_instr_unlock_ops(struct snd_seq_kinstr_list *list)
{ {
if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
spin_unlock_irqrestore(&list->ops_lock, list->ops_flags); 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,18 +49,18 @@ static void snd_instr_unlock_ops(snd_seq_kinstr_list_t *list)
} }
} }
static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic) static struct snd_seq_kinstr *snd_seq_instr_new(int add_len, int atomic)
{ {
snd_seq_kinstr_t *instr; struct snd_seq_kinstr *instr;
instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); instr = kzalloc(sizeof(struct snd_seq_kinstr) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
if (instr == NULL) if (instr == NULL)
return NULL; return NULL;
instr->add_len = add_len; instr->add_len = add_len;
return instr; return instr;
} }
static int snd_seq_instr_free(snd_seq_kinstr_t *instr, int atomic) static int snd_seq_instr_free(struct snd_seq_kinstr *instr, int atomic)
{ {
int result = 0; int result = 0;
...@@ -73,11 +73,11 @@ static int snd_seq_instr_free(snd_seq_kinstr_t *instr, int atomic) ...@@ -73,11 +73,11 @@ static int snd_seq_instr_free(snd_seq_kinstr_t *instr, int atomic)
return result; return result;
} }
snd_seq_kinstr_list_t *snd_seq_instr_list_new(void) struct snd_seq_kinstr_list *snd_seq_instr_list_new(void)
{ {
snd_seq_kinstr_list_t *list; struct snd_seq_kinstr_list *list;
list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); list = kzalloc(sizeof(struct snd_seq_kinstr_list), GFP_KERNEL);
if (list == NULL) if (list == NULL)
return NULL; return NULL;
spin_lock_init(&list->lock); spin_lock_init(&list->lock);
...@@ -87,11 +87,11 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void) ...@@ -87,11 +87,11 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void)
return list; return list;
} }
void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr) void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list_ptr)
{ {
snd_seq_kinstr_list_t *list; struct snd_seq_kinstr_list *list;
snd_seq_kinstr_t *instr; struct snd_seq_kinstr *instr;
snd_seq_kcluster_t *cluster; struct snd_seq_kcluster *cluster;
int idx; int idx;
unsigned long flags; unsigned long flags;
...@@ -125,8 +125,8 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr) ...@@ -125,8 +125,8 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
kfree(list); kfree(list);
} }
static int instr_free_compare(snd_seq_kinstr_t *instr, static int instr_free_compare(struct snd_seq_kinstr *instr,
snd_seq_instr_header_t *ifree, struct snd_seq_instr_header *ifree,
unsigned int client) unsigned int client)
{ {
switch (ifree->cmd) { switch (ifree->cmd) {
...@@ -160,12 +160,12 @@ static int instr_free_compare(snd_seq_kinstr_t *instr, ...@@ -160,12 +160,12 @@ static int instr_free_compare(snd_seq_kinstr_t *instr,
return 1; return 1;
} }
int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
snd_seq_instr_header_t *ifree, struct snd_seq_instr_header *ifree,
int client, int client,
int atomic) int atomic)
{ {
snd_seq_kinstr_t *instr, *prev, *next, *flist; struct snd_seq_kinstr *instr, *prev, *next, *flist;
int idx; int idx;
unsigned long flags; unsigned long flags;
...@@ -209,7 +209,7 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, ...@@ -209,7 +209,7 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
return 0; return 0;
} }
static int compute_hash_instr_key(snd_seq_instr_t *instr) static int compute_hash_instr_key(struct snd_seq_instr *instr)
{ {
int result; int result;
...@@ -233,7 +233,7 @@ static int compute_hash_cluster_key(snd_seq_instr_cluster_t cluster) ...@@ -233,7 +233,7 @@ static int compute_hash_cluster_key(snd_seq_instr_cluster_t cluster)
} }
#endif #endif
static int compare_instr(snd_seq_instr_t *i1, snd_seq_instr_t *i2, int exact) static int compare_instr(struct snd_seq_instr *i1, struct snd_seq_instr *i2, int exact)
{ {
if (exact) { if (exact) {
if (i1->cluster != i2->cluster || 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,14 +262,14 @@ static int compare_instr(snd_seq_instr_t *i1, snd_seq_instr_t *i2, int exact)
} }
} }
snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
snd_seq_instr_t *instr, struct snd_seq_instr *instr,
int exact, int exact,
int follow_alias) int follow_alias)
{ {
unsigned long flags; unsigned long flags;
int depth = 0; int depth = 0;
snd_seq_kinstr_t *result; struct snd_seq_kinstr *result;
if (list == NULL || instr == NULL) if (list == NULL || instr == NULL)
return NULL; return NULL;
...@@ -279,7 +279,7 @@ snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, ...@@ -279,7 +279,7 @@ snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list,
while (result) { while (result) {
if (!compare_instr(&result->instr, instr, exact)) { if (!compare_instr(&result->instr, instr, exact)) {
if (follow_alias && (result->type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)) { if (follow_alias && (result->type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)) {
instr = (snd_seq_instr_t *)KINSTR_DATA(result); instr = (struct snd_seq_instr *)KINSTR_DATA(result);
if (++depth > 10) if (++depth > 10)
goto __not_found; goto __not_found;
goto __again; goto __again;
...@@ -295,8 +295,8 @@ snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, ...@@ -295,8 +295,8 @@ snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list,
return NULL; return NULL;
} }
void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
snd_seq_kinstr_t *instr) struct snd_seq_kinstr *instr)
{ {
unsigned long flags; unsigned long flags;
...@@ -311,7 +311,8 @@ void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, ...@@ -311,7 +311,8 @@ void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list,
spin_unlock_irqrestore(&list->lock, flags); spin_unlock_irqrestore(&list->lock, flags);
} }
static snd_seq_kinstr_ops_t *instr_ops(snd_seq_kinstr_ops_t *ops, char *instr_type) static struct snd_seq_kinstr_ops *instr_ops(struct snd_seq_kinstr_ops *ops,
char *instr_type)
{ {
while (ops) { while (ops) {
if (!strcmp(ops->instr_type, instr_type)) 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,11 +322,11 @@ static snd_seq_kinstr_ops_t *instr_ops(snd_seq_kinstr_ops_t *ops, char *instr_ty
return NULL; return NULL;
} }
static int instr_result(snd_seq_event_t *ev, static int instr_result(struct snd_seq_event *ev,
int type, int result, int type, int result,
int atomic) int atomic)
{ {
snd_seq_event_t sev; struct snd_seq_event sev;
memset(&sev, 0, sizeof(sev)); memset(&sev, 0, sizeof(sev));
sev.type = SNDRV_SEQ_EVENT_RESULT; sev.type = SNDRV_SEQ_EVENT_RESULT;
...@@ -345,9 +346,9 @@ static int instr_result(snd_seq_event_t *ev, ...@@ -345,9 +346,9 @@ static int instr_result(snd_seq_event_t *ev,
return snd_seq_kernel_client_dispatch(sev.source.client, &sev, atomic, 0); return snd_seq_kernel_client_dispatch(sev.source.client, &sev, atomic, 0);
} }
static int instr_begin(snd_seq_kinstr_ops_t *ops, static int instr_begin(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
unsigned long flags; unsigned long flags;
...@@ -362,9 +363,9 @@ static int instr_begin(snd_seq_kinstr_ops_t *ops, ...@@ -362,9 +363,9 @@ static int instr_begin(snd_seq_kinstr_ops_t *ops,
return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, 0, atomic); return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, 0, atomic);
} }
static int instr_end(snd_seq_kinstr_ops_t *ops, static int instr_end(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
unsigned long flags; unsigned long flags;
...@@ -380,54 +381,55 @@ static int instr_end(snd_seq_kinstr_ops_t *ops, ...@@ -380,54 +381,55 @@ static int instr_end(snd_seq_kinstr_ops_t *ops,
return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, -EINVAL, atomic); return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, -EINVAL, atomic);
} }
static int instr_info(snd_seq_kinstr_ops_t *ops, static int instr_info(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
static int instr_format_info(snd_seq_kinstr_ops_t *ops, static int instr_format_info(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
static int instr_reset(snd_seq_kinstr_ops_t *ops, static int instr_reset(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
static int instr_status(snd_seq_kinstr_ops_t *ops, static int instr_status(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
static int instr_put(snd_seq_kinstr_ops_t *ops, static int instr_put(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
unsigned long flags; unsigned long flags;
snd_seq_instr_header_t put; struct snd_seq_instr_header put;
snd_seq_kinstr_t *instr; struct snd_seq_kinstr *instr;
int result = -EINVAL, len, key; int result = -EINVAL, len, key;
if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR) if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR)
goto __return; goto __return;
if (ev->data.ext.len < sizeof(snd_seq_instr_header_t)) if (ev->data.ext.len < sizeof(struct snd_seq_instr_header))
goto __return; goto __return;
if (copy_from_user(&put, (void __user *)ev->data.ext.ptr, sizeof(snd_seq_instr_header_t))) { if (copy_from_user(&put, (void __user *)ev->data.ext.ptr,
sizeof(struct snd_seq_instr_header))) {
result = -EFAULT; result = -EFAULT;
goto __return; goto __return;
} }
...@@ -449,7 +451,7 @@ static int instr_put(snd_seq_kinstr_ops_t *ops, ...@@ -449,7 +451,7 @@ static int instr_put(snd_seq_kinstr_ops_t *ops,
} }
len = ops->add_len; len = ops->add_len;
if (put.data.type == SNDRV_SEQ_INSTR_ATYPE_ALIAS) if (put.data.type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)
len = sizeof(snd_seq_instr_t); len = sizeof(struct snd_seq_instr);
instr = snd_seq_instr_new(len, atomic); instr = snd_seq_instr_new(len, atomic);
if (instr == NULL) { if (instr == NULL) {
snd_instr_unlock_ops(list); snd_instr_unlock_ops(list);
...@@ -463,8 +465,8 @@ static int instr_put(snd_seq_kinstr_ops_t *ops, ...@@ -463,8 +465,8 @@ static int instr_put(snd_seq_kinstr_ops_t *ops,
if (instr->type == SNDRV_SEQ_INSTR_ATYPE_DATA) { if (instr->type == SNDRV_SEQ_INSTR_ATYPE_DATA) {
result = ops->put(ops->private_data, result = ops->put(ops->private_data,
instr, instr,
(void __user *)ev->data.ext.ptr + sizeof(snd_seq_instr_header_t), (void __user *)ev->data.ext.ptr + sizeof(struct snd_seq_instr_header),
ev->data.ext.len - sizeof(snd_seq_instr_header_t), ev->data.ext.len - sizeof(struct snd_seq_instr_header),
atomic, atomic,
put.cmd); put.cmd);
if (result < 0) { if (result < 0) {
...@@ -486,21 +488,21 @@ static int instr_put(snd_seq_kinstr_ops_t *ops, ...@@ -486,21 +488,21 @@ static int instr_put(snd_seq_kinstr_ops_t *ops,
return result; return result;
} }
static int instr_get(snd_seq_kinstr_ops_t *ops, static int instr_get(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
static int instr_free(snd_seq_kinstr_ops_t *ops, static int instr_free(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
snd_seq_instr_header_t ifree; struct snd_seq_instr_header ifree;
snd_seq_kinstr_t *instr, *prev; struct snd_seq_kinstr *instr, *prev;
int result = -EINVAL; int result = -EINVAL;
unsigned long flags; unsigned long flags;
unsigned int hash; unsigned int hash;
...@@ -508,9 +510,10 @@ static int instr_free(snd_seq_kinstr_ops_t *ops, ...@@ -508,9 +510,10 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR) if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR)
goto __return; goto __return;
if (ev->data.ext.len < sizeof(snd_seq_instr_header_t)) if (ev->data.ext.len < sizeof(struct snd_seq_instr_header))
goto __return; goto __return;
if (copy_from_user(&ifree, (void __user *)ev->data.ext.ptr, sizeof(snd_seq_instr_header_t))) { if (copy_from_user(&ifree, (void __user *)ev->data.ext.ptr,
sizeof(struct snd_seq_instr_header))) {
result = -EFAULT; result = -EFAULT;
goto __return; goto __return;
} }
...@@ -548,7 +551,8 @@ static int instr_free(snd_seq_kinstr_ops_t *ops, ...@@ -548,7 +551,8 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
list->hash[hash] = instr->next; list->hash[hash] = instr->next;
} }
if (instr->ops && instr->ops->notify) if (instr->ops && instr->ops->notify)
instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); instr->ops->notify(instr->ops->private_data, instr,
SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
while (instr->use) { while (instr->use) {
spin_unlock_irqrestore(&list->lock, flags); spin_unlock_irqrestore(&list->lock, flags);
schedule_timeout_interruptible(1); schedule_timeout_interruptible(1);
...@@ -565,25 +569,25 @@ static int instr_free(snd_seq_kinstr_ops_t *ops, ...@@ -565,25 +569,25 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
return result; return result;
} }
static int instr_list(snd_seq_kinstr_ops_t *ops, static int instr_list(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
static int instr_cluster(snd_seq_kinstr_ops_t *ops, static int instr_cluster(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
return -ENXIO; return -ENXIO;
} }
int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int client, int client,
int atomic, int atomic,
int hop) int hop)
......
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem) #define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem)
static inline int snd_seq_pool_available(pool_t *pool) static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
{ {
return pool->total_elements - atomic_read(&pool->counter); return pool->total_elements - atomic_read(&pool->counter);
} }
static inline int snd_seq_output_ok(pool_t *pool) static inline int snd_seq_output_ok(struct snd_seq_pool *pool)
{ {
return snd_seq_pool_available(pool) >= pool->room; return snd_seq_pool_available(pool) >= pool->room;
} }
...@@ -72,7 +72,7 @@ static inline int snd_seq_output_ok(pool_t *pool) ...@@ -72,7 +72,7 @@ static inline int snd_seq_output_ok(pool_t *pool)
* call dump function to expand external data. * call dump function to expand external data.
*/ */
static int get_var_len(const snd_seq_event_t *event) static int get_var_len(const struct snd_seq_event *event)
{ {
if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
return -EINVAL; return -EINVAL;
...@@ -80,10 +80,11 @@ static int get_var_len(const snd_seq_event_t *event) ...@@ -80,10 +80,11 @@ static int get_var_len(const snd_seq_event_t *event)
return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
} }
int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data) int snd_seq_dump_var_event(const struct snd_seq_event *event,
snd_seq_dump_func_t func, void *private_data)
{ {
int len, err; int len, err;
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
if ((len = get_var_len(event)) <= 0) if ((len = get_var_len(event)) <= 0)
return len; 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,9 +109,9 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
return func(private_data, event->data.ext.ptr, len); return func(private_data, event->data.ext.ptr, len);
} }
cell = (snd_seq_event_cell_t*)event->data.ext.ptr; cell = (struct snd_seq_event_cell *)event->data.ext.ptr;
for (; len > 0 && cell; cell = cell->next) { for (; len > 0 && cell; cell = cell->next) {
int size = sizeof(snd_seq_event_t); int size = sizeof(struct snd_seq_event);
if (len < size) if (len < size)
size = len; size = len;
err = func(private_data, &cell->event, size); 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,7 +143,8 @@ static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
return 0; return 0;
} }
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned) int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
int in_kernel, int size_aligned)
{ {
int len, newlen; int len, newlen;
int err; int err;
...@@ -174,17 +176,18 @@ int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, ...@@ -174,17 +176,18 @@ int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
* release this cell, free extended data if available * release this cell, free extended data if available
*/ */
static inline void free_cell(pool_t *pool, snd_seq_event_cell_t *cell) static inline void free_cell(struct snd_seq_pool *pool,
struct snd_seq_event_cell *cell)
{ {
cell->next = pool->free; cell->next = pool->free;
pool->free = cell; pool->free = cell;
atomic_dec(&pool->counter); atomic_dec(&pool->counter);
} }
void snd_seq_cell_free(snd_seq_event_cell_t * cell) void snd_seq_cell_free(struct snd_seq_event_cell * cell)
{ {
unsigned long flags; unsigned long flags;
pool_t *pool; struct snd_seq_pool *pool;
snd_assert(cell != NULL, return); snd_assert(cell != NULL, return);
pool = cell->pool; pool = cell->pool;
...@@ -194,7 +197,7 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell) ...@@ -194,7 +197,7 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
free_cell(pool, cell); free_cell(pool, cell);
if (snd_seq_ev_is_variable(&cell->event)) { if (snd_seq_ev_is_variable(&cell->event)) {
if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) { if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) {
snd_seq_event_cell_t *curp, *nextptr; struct snd_seq_event_cell *curp, *nextptr;
curp = cell->event.data.ext.ptr; curp = cell->event.data.ext.ptr;
for (; curp; curp = nextptr) { for (; curp; curp = nextptr) {
nextptr = curp->next; nextptr = curp->next;
...@@ -215,9 +218,11 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell) ...@@ -215,9 +218,11 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
/* /*
* allocate an event cell. * allocate an event cell.
*/ */
static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int nonblock, struct file *file) static int snd_seq_cell_alloc(struct snd_seq_pool *pool,
struct snd_seq_event_cell **cellp,
int nonblock, struct file *file)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
int err = -EAGAIN; int err = -EAGAIN;
wait_queue_t wait; wait_queue_t wait;
...@@ -280,11 +285,13 @@ static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int no ...@@ -280,11 +285,13 @@ static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int no
* if the event has external data, the data is decomposed to additional * if the event has external data, the data is decomposed to additional
* cells. * cells.
*/ */
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file) int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
struct snd_seq_event_cell **cellp, int nonblock,
struct file *file)
{ {
int ncells, err; int ncells, err;
unsigned int extlen; unsigned int extlen;
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
*cellp = NULL; *cellp = NULL;
...@@ -292,7 +299,7 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t ...@@ -292,7 +299,7 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
extlen = 0; extlen = 0;
if (snd_seq_ev_is_variable(event)) { if (snd_seq_ev_is_variable(event)) {
extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
ncells = (extlen + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t); ncells = (extlen + sizeof(struct snd_seq_event) - 1) / sizeof(struct snd_seq_event);
} }
if (ncells >= pool->total_elements) if (ncells >= pool->total_elements)
return -ENOMEM; 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,18 +316,18 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
int len = extlen; int len = extlen;
int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED; int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED;
int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR; int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR;
snd_seq_event_cell_t *src, *tmp, *tail; struct snd_seq_event_cell *src, *tmp, *tail;
char *buf; char *buf;
cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED; cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED;
cell->event.data.ext.ptr = NULL; cell->event.data.ext.ptr = NULL;
src = (snd_seq_event_cell_t*)event->data.ext.ptr; src = (struct snd_seq_event_cell *)event->data.ext.ptr;
buf = (char *)event->data.ext.ptr; buf = (char *)event->data.ext.ptr;
tail = NULL; tail = NULL;
while (ncells-- > 0) { while (ncells-- > 0) {
int size = sizeof(snd_seq_event_t); int size = sizeof(struct snd_seq_event);
if (len < size) if (len < size)
size = len; size = len;
err = snd_seq_cell_alloc(pool, &tmp, nonblock, file); err = snd_seq_cell_alloc(pool, &tmp, nonblock, file);
...@@ -358,7 +365,8 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t ...@@ -358,7 +365,8 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
/* poll wait */ /* poll wait */
int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait) int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file,
poll_table *wait)
{ {
poll_wait(file, &pool->output_sleep, wait); poll_wait(file, &pool->output_sleep, wait);
return snd_seq_output_ok(pool); 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,17 +374,17 @@ int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait)
/* allocate room specified number of events */ /* allocate room specified number of events */
int snd_seq_pool_init(pool_t *pool) int snd_seq_pool_init(struct snd_seq_pool *pool)
{ {
int cell; int cell;
snd_seq_event_cell_t *cellptr; struct snd_seq_event_cell *cellptr;
unsigned long flags; unsigned long flags;
snd_assert(pool != NULL, return -EINVAL); snd_assert(pool != NULL, return -EINVAL);
if (pool->ptr) /* should be atomic? */ if (pool->ptr) /* should be atomic? */
return 0; return 0;
pool->ptr = vmalloc(sizeof(snd_seq_event_cell_t) * pool->size); pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size);
if (pool->ptr == NULL) { if (pool->ptr == NULL) {
snd_printd("seq: malloc for sequencer events failed\n"); snd_printd("seq: malloc for sequencer events failed\n");
return -ENOMEM; return -ENOMEM;
...@@ -402,10 +410,10 @@ int snd_seq_pool_init(pool_t *pool) ...@@ -402,10 +410,10 @@ int snd_seq_pool_init(pool_t *pool)
} }
/* remove events */ /* remove events */
int snd_seq_pool_done(pool_t *pool) int snd_seq_pool_done(struct snd_seq_pool *pool)
{ {
unsigned long flags; unsigned long flags;
snd_seq_event_cell_t *ptr; struct snd_seq_event_cell *ptr;
int max_count = 5 * HZ; int max_count = 5 * HZ;
snd_assert(pool != NULL, return -EINVAL); snd_assert(pool != NULL, return -EINVAL);
...@@ -446,9 +454,9 @@ int snd_seq_pool_done(pool_t *pool) ...@@ -446,9 +454,9 @@ int snd_seq_pool_done(pool_t *pool)
/* init new memory pool */ /* init new memory pool */
pool_t *snd_seq_pool_new(int poolsize) struct snd_seq_pool *snd_seq_pool_new(int poolsize)
{ {
pool_t *pool; struct snd_seq_pool *pool;
/* create pool block */ /* create pool block */
pool = kzalloc(sizeof(*pool), GFP_KERNEL); pool = kzalloc(sizeof(*pool), GFP_KERNEL);
...@@ -472,9 +480,9 @@ pool_t *snd_seq_pool_new(int poolsize) ...@@ -472,9 +480,9 @@ pool_t *snd_seq_pool_new(int poolsize)
} }
/* remove memory pool */ /* remove memory pool */
int snd_seq_pool_delete(pool_t **ppool) int snd_seq_pool_delete(struct snd_seq_pool **ppool)
{ {
pool_t *pool = *ppool; struct snd_seq_pool *pool = *ppool;
*ppool = NULL; *ppool = NULL;
if (pool == NULL) if (pool == NULL)
...@@ -497,7 +505,8 @@ void __exit snd_sequencer_memory_done(void) ...@@ -497,7 +505,8 @@ void __exit snd_sequencer_memory_done(void)
/* exported to seq_clientmgr.c */ /* exported to seq_clientmgr.c */
void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t *pool, char *space) void snd_seq_info_pool(struct snd_info_buffer *buffer,
struct snd_seq_pool *pool, char *space)
{ {
if (pool == NULL) if (pool == NULL)
return; return;
......
...@@ -24,23 +24,21 @@ ...@@ -24,23 +24,21 @@
#include <sound/seq_kernel.h> #include <sound/seq_kernel.h>
#include <linux/poll.h> #include <linux/poll.h>
typedef struct pool pool_t;
/* container for sequencer event (internal use) */ /* container for sequencer event (internal use) */
typedef struct snd_seq_event_cell_t { struct snd_seq_event_cell {
snd_seq_event_t event; struct snd_seq_event event;
pool_t *pool; /* used pool */ struct snd_seq_pool *pool; /* used pool */
struct snd_seq_event_cell_t *next; /* next cell */ struct snd_seq_event_cell *next; /* next cell */
} snd_seq_event_cell_t; };
/* design note: the pool is a contigious block of memory, if we dynamicly /* design note: the pool is a contigious block of memory, if we dynamicly
want to add additional cells to the pool be better store this in another want to add additional cells to the pool be better store this in another
pool as we need to know the base address of the pool when releasing pool as we need to know the base address of the pool when releasing
memory. */ memory. */
struct pool { struct snd_seq_pool {
snd_seq_event_cell_t *ptr; /* pointer to first event chunk */ struct snd_seq_event_cell *ptr; /* pointer to first event chunk */
snd_seq_event_cell_t *free; /* pointer to the head of the free list */ struct snd_seq_event_cell *free; /* pointer to the head of the free list */
int total_elements; /* pool size actually allocated */ int total_elements; /* pool size actually allocated */
atomic_t counter; /* cells free */ atomic_t counter; /* cells free */
...@@ -63,33 +61,34 @@ struct pool { ...@@ -63,33 +61,34 @@ struct pool {
spinlock_t lock; spinlock_t lock;
}; };
extern void snd_seq_cell_free(snd_seq_event_cell_t* cell); void snd_seq_cell_free(struct snd_seq_event_cell *cell);
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file); int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
struct snd_seq_event_cell **cellp, int nonblock, struct file *file);
/* return number of unused (free) cells */ /* return number of unused (free) cells */
static inline int snd_seq_unused_cells(pool_t *pool) static inline int snd_seq_unused_cells(struct snd_seq_pool *pool)
{ {
return pool ? pool->total_elements - atomic_read(&pool->counter) : 0; return pool ? pool->total_elements - atomic_read(&pool->counter) : 0;
} }
/* return total number of allocated cells */ /* return total number of allocated cells */
static inline int snd_seq_total_cells(pool_t *pool) static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
{ {
return pool ? pool->total_elements : 0; return pool ? pool->total_elements : 0;
} }
/* init pool - allocate events */ /* init pool - allocate events */
int snd_seq_pool_init(pool_t *pool); int snd_seq_pool_init(struct snd_seq_pool *pool);
/* done pool - free events */ /* done pool - free events */
int snd_seq_pool_done(pool_t *pool); int snd_seq_pool_done(struct snd_seq_pool *pool);
/* create pool */ /* create pool */
pool_t *snd_seq_pool_new(int poolsize); struct snd_seq_pool *snd_seq_pool_new(int poolsize);
/* remove pool */ /* remove pool */
int snd_seq_pool_delete(pool_t **pool); int snd_seq_pool_delete(struct snd_seq_pool **pool);
/* init memory */ /* init memory */
int snd_sequencer_memory_init(void); int snd_sequencer_memory_init(void);
...@@ -98,7 +97,7 @@ int snd_sequencer_memory_init(void); ...@@ -98,7 +97,7 @@ int snd_sequencer_memory_init(void);
void snd_sequencer_memory_done(void); void snd_sequencer_memory_done(void);
/* polling */ /* polling */
int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait); int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait);
#endif #endif
...@@ -51,40 +51,40 @@ module_param(input_buffer_size, int, 0644); ...@@ -51,40 +51,40 @@ module_param(input_buffer_size, int, 0644);
MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes."); MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes.");
/* data for this midi synth driver */ /* data for this midi synth driver */
typedef struct { struct seq_midisynth {
snd_card_t *card; struct snd_card *card;
int device; int device;
int subdevice; int subdevice;
snd_rawmidi_file_t input_rfile; struct snd_rawmidi_file input_rfile;
snd_rawmidi_file_t output_rfile; struct snd_rawmidi_file output_rfile;
int seq_client; int seq_client;
int seq_port; int seq_port;
snd_midi_event_t *parser; struct snd_midi_event *parser;
} seq_midisynth_t; };
typedef struct { struct seq_midisynth_client {
int seq_client; int seq_client;
int num_ports; int num_ports;
int ports_per_device[SNDRV_RAWMIDI_DEVICES]; int ports_per_device[SNDRV_RAWMIDI_DEVICES];
seq_midisynth_t *ports[SNDRV_RAWMIDI_DEVICES]; struct seq_midisynth *ports[SNDRV_RAWMIDI_DEVICES];
} seq_midisynth_client_t; };
static seq_midisynth_client_t *synths[SNDRV_CARDS]; static struct seq_midisynth_client *synths[SNDRV_CARDS];
static DECLARE_MUTEX(register_mutex); static DECLARE_MUTEX(register_mutex);
/* handle rawmidi input event (MIDI v1.0 stream) */ /* handle rawmidi input event (MIDI v1.0 stream) */
static void snd_midi_input_event(snd_rawmidi_substream_t * substream) static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
{ {
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
seq_midisynth_t *msynth; struct seq_midisynth *msynth;
snd_seq_event_t ev; struct snd_seq_event ev;
char buf[16], *pbuf; char buf[16], *pbuf;
long res, count; long res, count;
if (substream == NULL) if (substream == NULL)
return; return;
runtime = substream->runtime; runtime = substream->runtime;
msynth = (seq_midisynth_t *) runtime->private_data; msynth = runtime->private_data;
if (msynth == NULL) if (msynth == NULL)
return; return;
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
...@@ -112,9 +112,9 @@ static void snd_midi_input_event(snd_rawmidi_substream_t * substream) ...@@ -112,9 +112,9 @@ static void snd_midi_input_event(snd_rawmidi_substream_t * substream)
} }
} }
static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int count) static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, int count)
{ {
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
int tmp; int tmp;
snd_assert(substream != NULL || buf != NULL, return -EINVAL); 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,12 +128,12 @@ static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int co
return 0; return 0;
} }
static int event_process_midi(snd_seq_event_t * ev, int direct, static int event_process_midi(struct snd_seq_event *ev, int direct,
void *private_data, int atomic, int hop) void *private_data, int atomic, int hop)
{ {
seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; struct seq_midisynth *msynth = private_data;
unsigned char msg[10]; /* buffer for constructing midi messages */ unsigned char msg[10]; /* buffer for constructing midi messages */
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
int len; int len;
snd_assert(msynth != NULL, return -EINVAL); snd_assert(msynth != NULL, return -EINVAL);
...@@ -161,8 +161,8 @@ static int event_process_midi(snd_seq_event_t * ev, int direct, ...@@ -161,8 +161,8 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
} }
static int snd_seq_midisynth_new(seq_midisynth_t *msynth, static int snd_seq_midisynth_new(struct seq_midisynth *msynth,
snd_card_t *card, struct snd_card *card,
int device, int device,
int subdevice) int subdevice)
{ {
...@@ -175,12 +175,12 @@ static int snd_seq_midisynth_new(seq_midisynth_t *msynth, ...@@ -175,12 +175,12 @@ static int snd_seq_midisynth_new(seq_midisynth_t *msynth,
} }
/* open associated midi device for input */ /* open associated midi device for input */
static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
{ {
int err; int err;
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
snd_rawmidi_params_t params; struct snd_rawmidi_params params;
/* open midi port */ /* open midi port */
if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) { 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,10 +203,10 @@ static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *inf
} }
/* close associated midi device for input */ /* close associated midi device for input */
static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_unsubscribe(void *private_data, struct snd_seq_port_subscribe *info)
{ {
int err; int err;
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
snd_assert(msynth->input_rfile.input != NULL, return -EINVAL); snd_assert(msynth->input_rfile.input != NULL, return -EINVAL);
err = snd_rawmidi_kernel_release(&msynth->input_rfile); 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,11 +214,11 @@ static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *i
} }
/* open associated midi device for output */ /* open associated midi device for output */
static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info)
{ {
int err; int err;
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
snd_rawmidi_params_t params; struct snd_rawmidi_params params;
/* open midi port */ /* open midi port */
if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) { 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,9 +237,9 @@ static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info)
} }
/* close associated midi device for output */ /* close associated midi device for output */
static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{ {
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
unsigned char buf = 0xff; /* MIDI reset */ unsigned char buf = 0xff; /* MIDI reset */
snd_assert(msynth->output_rfile.output != NULL, return -EINVAL); 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,7 +250,7 @@ static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info)
} }
/* delete given midi synth port */ /* delete given midi synth port */
static void snd_seq_midisynth_delete(seq_midisynth_t *msynth) static void snd_seq_midisynth_delete(struct seq_midisynth *msynth)
{ {
if (msynth == NULL) if (msynth == NULL)
return; return;
...@@ -265,10 +265,10 @@ static void snd_seq_midisynth_delete(seq_midisynth_t *msynth) ...@@ -265,10 +265,10 @@ static void snd_seq_midisynth_delete(seq_midisynth_t *msynth)
} }
/* set our client name */ /* set our client name */
static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card, static int set_client_name(struct seq_midisynth_client *client, struct snd_card *card,
snd_rawmidi_info_t *rmidi) struct snd_rawmidi_info *rmidi)
{ {
snd_seq_client_info_t cinfo; struct snd_seq_client_info cinfo;
const char *name; const char *name;
memset(&cinfo, 0, sizeof(cinfo)); memset(&cinfo, 0, sizeof(cinfo));
...@@ -281,17 +281,17 @@ static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card, ...@@ -281,17 +281,17 @@ static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card,
/* register new midi synth port */ /* register new midi synth port */
static int static int
snd_seq_midisynth_register_port(snd_seq_device_t *dev) snd_seq_midisynth_register_port(struct snd_seq_device *dev)
{ {
seq_midisynth_client_t *client; struct seq_midisynth_client *client;
seq_midisynth_t *msynth, *ms; struct seq_midisynth *msynth, *ms;
snd_seq_port_info_t *port; struct snd_seq_port_info *port;
snd_rawmidi_info_t *info; struct snd_rawmidi_info *info;
int newclient = 0; int newclient = 0;
unsigned int p, ports; unsigned int p, ports;
snd_seq_client_callback_t callbacks; struct snd_seq_client_callback callbacks;
snd_seq_port_callback_t pcallbacks; struct snd_seq_port_callback pcallbacks;
snd_card_t *card = dev->card; struct snd_card *card = dev->card;
int device = dev->device; int device = dev->device;
unsigned int input_count = 0, output_count = 0; unsigned int input_count = 0, output_count = 0;
...@@ -342,7 +342,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev) ...@@ -342,7 +342,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
} else if (device == 0) } else if (device == 0)
set_client_name(client, card, info); /* use the first device's name */ set_client_name(client, card, info); /* use the first device's name */
msynth = kcalloc(ports, sizeof(seq_midisynth_t), GFP_KERNEL); msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL);
port = kmalloc(sizeof(*port), GFP_KERNEL); port = kmalloc(sizeof(*port), GFP_KERNEL);
if (msynth == NULL || port == NULL) if (msynth == NULL || port == NULL)
goto __nomem; goto __nomem;
...@@ -432,11 +432,11 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev) ...@@ -432,11 +432,11 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
/* release midi synth port */ /* release midi synth port */
static int static int
snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
{ {
seq_midisynth_client_t *client; struct seq_midisynth_client *client;
seq_midisynth_t *msynth; struct seq_midisynth *msynth;
snd_card_t *card = dev->card; struct snd_card *card = dev->card;
int device = dev->device, p, ports; int device = dev->device, p, ports;
down(&register_mutex); down(&register_mutex);
...@@ -465,7 +465,7 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) ...@@ -465,7 +465,7 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev)
static int __init alsa_seq_midi_init(void) static int __init alsa_seq_midi_init(void)
{ {
static snd_seq_dev_ops_t ops = { static struct snd_seq_dev_ops ops = {
snd_seq_midisynth_register_port, snd_seq_midisynth_register_port,
snd_seq_midisynth_unregister_port, snd_seq_midisynth_unregister_port,
}; };
......
...@@ -44,17 +44,25 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer MIDI emulation." ...@@ -44,17 +44,25 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer MIDI emulation."
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* Prototypes for static functions */ /* Prototypes for static functions */
static void note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int vel); static void note_off(struct snd_midi_op *ops, void *drv,
static void do_control(snd_midi_op_t *ops, void *private, struct snd_midi_channel *chan,
snd_midi_channel_set_t *chset, snd_midi_channel_t *chan, int note, int vel);
static void do_control(struct snd_midi_op *ops, void *private,
struct snd_midi_channel_set *chset,
struct snd_midi_channel *chan,
int control, int value); int control, int value);
static void rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); static void rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
static void nrpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); struct snd_midi_channel_set *chset);
static void sysex(snd_midi_op_t *ops, void *private, unsigned char *sysex, int len, snd_midi_channel_set_t *chset); static void nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
static void all_sounds_off(snd_midi_op_t *ops, void *private, snd_midi_channel_t *chan); struct snd_midi_channel_set *chset);
static void all_notes_off(snd_midi_op_t *ops, void *private, snd_midi_channel_t *chan); static void sysex(struct snd_midi_op *ops, void *private, unsigned char *sysex,
static void snd_midi_reset_controllers(snd_midi_channel_t *chan); int len, struct snd_midi_channel_set *chset);
static void reset_all_channels(snd_midi_channel_set_t *chset); static void all_sounds_off(struct snd_midi_op *ops, void *private,
struct snd_midi_channel *chan);
static void all_notes_off(struct snd_midi_op *ops, void *private,
struct snd_midi_channel *chan);
static void snd_midi_reset_controllers(struct snd_midi_channel *chan);
static void reset_all_channels(struct snd_midi_channel_set *chset);
/* /*
...@@ -72,10 +80,11 @@ static void reset_all_channels(snd_midi_channel_set_t *chset); ...@@ -72,10 +80,11 @@ static void reset_all_channels(snd_midi_channel_set_t *chset);
* be interpreted. * be interpreted.
*/ */
void void
snd_midi_process_event(snd_midi_op_t *ops, snd_midi_process_event(struct snd_midi_op *ops,
snd_seq_event_t *ev, snd_midi_channel_set_t *chanset) struct snd_seq_event *ev,
struct snd_midi_channel_set *chanset)
{ {
snd_midi_channel_t *chan; struct snd_midi_channel *chan;
void *drv; void *drv;
int dest_channel = 0; int dest_channel = 0;
...@@ -89,7 +98,8 @@ snd_midi_process_event(snd_midi_op_t *ops, ...@@ -89,7 +98,8 @@ snd_midi_process_event(snd_midi_op_t *ops,
if (snd_seq_ev_is_channel_type(ev)) { if (snd_seq_ev_is_channel_type(ev)) {
dest_channel = ev->data.note.channel; dest_channel = ev->data.note.channel;
if (dest_channel >= chanset->max_channels) { if (dest_channel >= chanset->max_channels) {
snd_printd("dest channel is %d, max is %d\n", dest_channel, chanset->max_channels); snd_printd("dest channel is %d, max is %d\n",
dest_channel, chanset->max_channels);
return; return;
} }
} }
...@@ -239,7 +249,8 @@ snd_midi_process_event(snd_midi_op_t *ops, ...@@ -239,7 +249,8 @@ snd_midi_process_event(snd_midi_op_t *ops,
* release note * release note
*/ */
static void static void
note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int vel) note_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
int note, int vel)
{ {
if (chan->gm_hold) { if (chan->gm_hold) {
/* Hold this note until pedal is turned off */ /* 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,8 +271,8 @@ note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int
* events that need to take place immediately to the driver. * events that need to take place immediately to the driver.
*/ */
static void static void
do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset, do_control(struct snd_midi_op *ops, void *drv, struct snd_midi_channel_set *chset,
snd_midi_channel_t *chan, int control, int value) struct snd_midi_channel *chan, int control, int value)
{ {
int i; int i;
...@@ -376,7 +387,7 @@ do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset, ...@@ -376,7 +387,7 @@ do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset,
* initialize the MIDI status * initialize the MIDI status
*/ */
void void
snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) snd_midi_channel_set_clear(struct snd_midi_channel_set *chset)
{ {
int i; int i;
...@@ -384,7 +395,7 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) ...@@ -384,7 +395,7 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset)
chset->gs_master_volume = 127; chset->gs_master_volume = 127;
for (i = 0; i < chset->max_channels; i++) { for (i = 0; i < chset->max_channels; i++) {
snd_midi_channel_t *chan = chset->channels + i; struct snd_midi_channel *chan = chset->channels + i;
memset(chan->note, 0, sizeof(chan->note)); memset(chan->note, 0, sizeof(chan->note));
chan->midi_aftertouch = 0; chan->midi_aftertouch = 0;
...@@ -407,8 +418,8 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) ...@@ -407,8 +418,8 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset)
* Process a rpn message. * Process a rpn message.
*/ */
static void static void
rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
snd_midi_channel_set_t *chset) struct snd_midi_channel_set *chset)
{ {
int type; int type;
int val; int val;
...@@ -447,8 +458,8 @@ rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, ...@@ -447,8 +458,8 @@ rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan,
* Process an nrpn message. * Process an nrpn message.
*/ */
static void static void
nrpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
snd_midi_channel_set_t *chset) struct snd_midi_channel_set *chset)
{ {
/* parse XG NRPNs here if possible */ /* parse XG NRPNs here if possible */
if (ops->nrpn) if (ops->nrpn)
...@@ -475,7 +486,8 @@ get_channel(unsigned char cmd) ...@@ -475,7 +486,8 @@ get_channel(unsigned char cmd)
* Process a sysex message. * Process a sysex message.
*/ */
static void static void
sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_channel_set_t *chset) sysex(struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
struct snd_midi_channel_set *chset)
{ {
/* GM on */ /* GM on */
static unsigned char gm_on_macro[] = { 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,7 +600,7 @@ sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_c
* all sound off * all sound off
*/ */
static void static void
all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) all_sounds_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
{ {
int n; int n;
...@@ -606,7 +618,7 @@ all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) ...@@ -606,7 +618,7 @@ all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan)
* all notes off * all notes off
*/ */
static void static void
all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) all_notes_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
{ {
int n; int n;
...@@ -621,12 +633,12 @@ all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) ...@@ -621,12 +633,12 @@ all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan)
/* /*
* Initialise a single midi channel control block. * Initialise a single midi channel control block.
*/ */
static void snd_midi_channel_init(snd_midi_channel_t *p, int n) static void snd_midi_channel_init(struct snd_midi_channel *p, int n)
{ {
if (p == NULL) if (p == NULL)
return; return;
memset(p, 0, sizeof(snd_midi_channel_t)); memset(p, 0, sizeof(struct snd_midi_channel));
p->private = NULL; p->private = NULL;
p->number = n; p->number = n;
...@@ -642,12 +654,12 @@ static void snd_midi_channel_init(snd_midi_channel_t *p, int n) ...@@ -642,12 +654,12 @@ static void snd_midi_channel_init(snd_midi_channel_t *p, int n)
/* /*
* Allocate and initialise a set of midi channel control blocks. * Allocate and initialise a set of midi channel control blocks.
*/ */
static snd_midi_channel_t *snd_midi_channel_init_set(int n) static struct snd_midi_channel *snd_midi_channel_init_set(int n)
{ {
snd_midi_channel_t *chan; struct snd_midi_channel *chan;
int i; int i;
chan = kmalloc(n * sizeof(snd_midi_channel_t), GFP_KERNEL); chan = kmalloc(n * sizeof(struct snd_midi_channel), GFP_KERNEL);
if (chan) { if (chan) {
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
snd_midi_channel_init(chan+i, i); snd_midi_channel_init(chan+i, i);
...@@ -660,11 +672,11 @@ static snd_midi_channel_t *snd_midi_channel_init_set(int n) ...@@ -660,11 +672,11 @@ static snd_midi_channel_t *snd_midi_channel_init_set(int n)
* reset all midi channels * reset all midi channels
*/ */
static void static void
reset_all_channels(snd_midi_channel_set_t *chset) reset_all_channels(struct snd_midi_channel_set *chset)
{ {
int ch; int ch;
for (ch = 0; ch < chset->max_channels; ch++) { for (ch = 0; ch < chset->max_channels; ch++) {
snd_midi_channel_t *chan = chset->channels + ch; struct snd_midi_channel *chan = chset->channels + ch;
snd_midi_reset_controllers(chan); snd_midi_reset_controllers(chan);
chan->gm_rpn_pitch_bend_range = 256; /* 2 semitones */ chan->gm_rpn_pitch_bend_range = 256; /* 2 semitones */
chan->gm_rpn_fine_tuning = 0; chan->gm_rpn_fine_tuning = 0;
...@@ -681,9 +693,9 @@ reset_all_channels(snd_midi_channel_set_t *chset) ...@@ -681,9 +693,9 @@ reset_all_channels(snd_midi_channel_set_t *chset)
/* /*
* Allocate and initialise a midi channel set. * Allocate and initialise a midi channel set.
*/ */
snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n) struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n)
{ {
snd_midi_channel_set_t *chset; struct snd_midi_channel_set *chset;
chset = kmalloc(sizeof(*chset), GFP_KERNEL); chset = kmalloc(sizeof(*chset), GFP_KERNEL);
if (chset) { if (chset) {
...@@ -697,7 +709,7 @@ snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n) ...@@ -697,7 +709,7 @@ snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n)
/* /*
* Reset the midi controllers on a particular channel to default values. * Reset the midi controllers on a particular channel to default values.
*/ */
static void snd_midi_reset_controllers(snd_midi_channel_t *chan) static void snd_midi_reset_controllers(struct snd_midi_channel *chan)
{ {
memset(chan->control, 0, sizeof(chan->control)); memset(chan->control, 0, sizeof(chan->control));
chan->gm_volume = 127; chan->gm_volume = 127;
...@@ -709,7 +721,7 @@ static void snd_midi_reset_controllers(snd_midi_channel_t *chan) ...@@ -709,7 +721,7 @@ static void snd_midi_reset_controllers(snd_midi_channel_t *chan)
/* /*
* Free a midi channel set. * Free a midi channel set.
*/ */
void snd_midi_channel_free_set(snd_midi_channel_set_t *chset) void snd_midi_channel_free_set(struct snd_midi_channel_set *chset)
{ {
if (chset == NULL) if (chset == NULL)
return; return;
......
...@@ -41,33 +41,29 @@ MODULE_LICENSE("GPL"); ...@@ -41,33 +41,29 @@ MODULE_LICENSE("GPL");
/* from 8 to 15 are events for 0xf0-0xf7 */ /* from 8 to 15 are events for 0xf0-0xf7 */
/* status event types */
typedef void (*event_encode_t)(snd_midi_event_t *dev, snd_seq_event_t *ev);
typedef void (*event_decode_t)(snd_seq_event_t *ev, unsigned char *buf);
/* /*
* prototypes * prototypes
*/ */
static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev); static void note_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev); static void one_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev); static void pitchbend_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev); static void two_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev); static void one_param_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev); static void songpos_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
static void note_decode(snd_seq_event_t *ev, unsigned char *buf); static void note_decode(struct snd_seq_event *ev, unsigned char *buf);
static void one_param_decode(snd_seq_event_t *ev, unsigned char *buf); static void one_param_decode(struct snd_seq_event *ev, unsigned char *buf);
static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf); static void pitchbend_decode(struct snd_seq_event *ev, unsigned char *buf);
static void two_param_decode(snd_seq_event_t *ev, unsigned char *buf); static void two_param_decode(struct snd_seq_event *ev, unsigned char *buf);
static void songpos_decode(snd_seq_event_t *ev, unsigned char *buf); static void songpos_decode(struct snd_seq_event *ev, unsigned char *buf);
/* /*
* event list * event list
*/ */
static struct status_event_list_t { static struct status_event_list {
int event; int event;
int qlen; int qlen;
event_encode_t encode; void (*encode)(struct snd_midi_event *dev, struct snd_seq_event *ev);
event_decode_t decode; void (*decode)(struct snd_seq_event *ev, unsigned char *buf);
} status_event[] = { } status_event[] = {
/* 0x80 - 0xf0 */ /* 0x80 - 0xf0 */
{SNDRV_SEQ_EVENT_NOTEOFF, 2, note_event, note_decode}, {SNDRV_SEQ_EVENT_NOTEOFF, 2, note_event, note_decode},
...@@ -97,12 +93,15 @@ static struct status_event_list_t { ...@@ -97,12 +93,15 @@ static struct status_event_list_t {
{SNDRV_SEQ_EVENT_RESET, 0, NULL, NULL}, /* 0xff */ {SNDRV_SEQ_EVENT_RESET, 0, NULL, NULL}, /* 0xff */
}; };
static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int len, snd_seq_event_t *ev); static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf, int len,
static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, snd_seq_event_t *ev); struct snd_seq_event *ev);
static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf, int count,
struct snd_seq_event *ev);
static struct extra_event_list_t { static struct extra_event_list {
int event; int event;
int (*decode)(snd_midi_event_t *dev, unsigned char *buf, int len, snd_seq_event_t *ev); int (*decode)(struct snd_midi_event *dev, unsigned char *buf, int len,
struct snd_seq_event *ev);
} extra_event[] = { } extra_event[] = {
{SNDRV_SEQ_EVENT_CONTROL14, extra_decode_ctrl14}, {SNDRV_SEQ_EVENT_CONTROL14, extra_decode_ctrl14},
{SNDRV_SEQ_EVENT_NONREGPARAM, extra_decode_xrpn}, {SNDRV_SEQ_EVENT_NONREGPARAM, extra_decode_xrpn},
...@@ -113,9 +112,9 @@ static struct extra_event_list_t { ...@@ -113,9 +112,9 @@ static struct extra_event_list_t {
* new/delete record * new/delete record
*/ */
int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev) int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev)
{ {
snd_midi_event_t *dev; struct snd_midi_event *dev;
*rdev = NULL; *rdev = NULL;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
...@@ -135,7 +134,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev) ...@@ -135,7 +134,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev)
return 0; return 0;
} }
void snd_midi_event_free(snd_midi_event_t *dev) void snd_midi_event_free(struct snd_midi_event *dev)
{ {
if (dev != NULL) { if (dev != NULL) {
kfree(dev->buf); kfree(dev->buf);
...@@ -146,14 +145,14 @@ void snd_midi_event_free(snd_midi_event_t *dev) ...@@ -146,14 +145,14 @@ void snd_midi_event_free(snd_midi_event_t *dev)
/* /*
* initialize record * initialize record
*/ */
static inline void reset_encode(snd_midi_event_t *dev) static inline void reset_encode(struct snd_midi_event *dev)
{ {
dev->read = 0; dev->read = 0;
dev->qlen = 0; dev->qlen = 0;
dev->type = 0; dev->type = 0;
} }
void snd_midi_event_reset_encode(snd_midi_event_t *dev) void snd_midi_event_reset_encode(struct snd_midi_event *dev)
{ {
unsigned long flags; unsigned long flags;
...@@ -162,7 +161,7 @@ void snd_midi_event_reset_encode(snd_midi_event_t *dev) ...@@ -162,7 +161,7 @@ void snd_midi_event_reset_encode(snd_midi_event_t *dev)
spin_unlock_irqrestore(&dev->lock, flags); spin_unlock_irqrestore(&dev->lock, flags);
} }
void snd_midi_event_reset_decode(snd_midi_event_t *dev) void snd_midi_event_reset_decode(struct snd_midi_event *dev)
{ {
unsigned long flags; unsigned long flags;
...@@ -172,14 +171,14 @@ void snd_midi_event_reset_decode(snd_midi_event_t *dev) ...@@ -172,14 +171,14 @@ void snd_midi_event_reset_decode(snd_midi_event_t *dev)
} }
#if 0 #if 0
void snd_midi_event_init(snd_midi_event_t *dev) void snd_midi_event_init(struct snd_midi_event *dev)
{ {
snd_midi_event_reset_encode(dev); snd_midi_event_reset_encode(dev);
snd_midi_event_reset_decode(dev); snd_midi_event_reset_decode(dev);
} }
#endif /* 0 */ #endif /* 0 */
void snd_midi_event_no_status(snd_midi_event_t *dev, int on) void snd_midi_event_no_status(struct snd_midi_event *dev, int on)
{ {
dev->nostat = on ? 1 : 0; dev->nostat = on ? 1 : 0;
} }
...@@ -188,7 +187,7 @@ void snd_midi_event_no_status(snd_midi_event_t *dev, int on) ...@@ -188,7 +187,7 @@ void snd_midi_event_no_status(snd_midi_event_t *dev, int on)
* resize buffer * resize buffer
*/ */
#if 0 #if 0
int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize) int snd_midi_event_resize_buffer(struct snd_midi_event *dev, int bufsize)
{ {
unsigned char *new_buf, *old_buf; unsigned char *new_buf, *old_buf;
unsigned long flags; unsigned long flags;
...@@ -213,7 +212,8 @@ int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize) ...@@ -213,7 +212,8 @@ int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize)
* read bytes and encode to sequencer event if finished * read bytes and encode to sequencer event if finished
* return the size of encoded bytes * return the size of encoded bytes
*/ */
long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev) long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
struct snd_seq_event *ev)
{ {
long result = 0; long result = 0;
int rc; int rc;
...@@ -238,7 +238,8 @@ long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count ...@@ -238,7 +238,8 @@ long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count
* 0 data is not finished * 0 data is not finished
* negative for error * negative for error
*/ */
int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev) int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c,
struct snd_seq_event *ev)
{ {
int rc = 0; int rc = 0;
unsigned long flags; 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,7 +304,7 @@ int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev
} }
/* encode note event */ /* encode note event */
static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev) static void note_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
{ {
ev->data.note.channel = dev->buf[0] & 0x0f; ev->data.note.channel = dev->buf[0] & 0x0f;
ev->data.note.note = dev->buf[1]; 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,21 +312,21 @@ static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
} }
/* encode one parameter controls */ /* encode one parameter controls */
static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev) static void one_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
{ {
ev->data.control.channel = dev->buf[0] & 0x0f; ev->data.control.channel = dev->buf[0] & 0x0f;
ev->data.control.value = dev->buf[1]; ev->data.control.value = dev->buf[1];
} }
/* encode pitch wheel change */ /* encode pitch wheel change */
static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev) static void pitchbend_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
{ {
ev->data.control.channel = dev->buf[0] & 0x0f; ev->data.control.channel = dev->buf[0] & 0x0f;
ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192; ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192;
} }
/* encode midi control change */ /* encode midi control change */
static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev) static void two_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
{ {
ev->data.control.channel = dev->buf[0] & 0x0f; ev->data.control.channel = dev->buf[0] & 0x0f;
ev->data.control.param = dev->buf[1]; 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,13 +334,13 @@ static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
} }
/* encode one parameter value*/ /* encode one parameter value*/
static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev) static void one_param_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
{ {
ev->data.control.value = dev->buf[1]; ev->data.control.value = dev->buf[1];
} }
/* encode song position */ /* encode song position */
static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev) static void songpos_event(struct snd_midi_event *dev, struct snd_seq_event *ev)
{ {
ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1]; ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1];
} }
...@@ -348,7 +349,8 @@ static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev) ...@@ -348,7 +349,8 @@ static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
* decode from a sequencer event to midi bytes * decode from a sequencer event to midi bytes
* return the size of decoded midi events * return the size of decoded midi events
*/ */
long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev) long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
struct snd_seq_event *ev)
{ {
unsigned int cmd, type; unsigned int cmd, type;
...@@ -404,20 +406,20 @@ long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count ...@@ -404,20 +406,20 @@ long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count
/* decode note event */ /* decode note event */
static void note_decode(snd_seq_event_t *ev, unsigned char *buf) static void note_decode(struct snd_seq_event *ev, unsigned char *buf)
{ {
buf[0] = ev->data.note.note & 0x7f; buf[0] = ev->data.note.note & 0x7f;
buf[1] = ev->data.note.velocity & 0x7f; buf[1] = ev->data.note.velocity & 0x7f;
} }
/* decode one parameter controls */ /* decode one parameter controls */
static void one_param_decode(snd_seq_event_t *ev, unsigned char *buf) static void one_param_decode(struct snd_seq_event *ev, unsigned char *buf)
{ {
buf[0] = ev->data.control.value & 0x7f; buf[0] = ev->data.control.value & 0x7f;
} }
/* decode pitch wheel change */ /* decode pitch wheel change */
static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf) static void pitchbend_decode(struct snd_seq_event *ev, unsigned char *buf)
{ {
int value = ev->data.control.value + 8192; int value = ev->data.control.value + 8192;
buf[0] = value & 0x7f; buf[0] = value & 0x7f;
...@@ -425,21 +427,22 @@ static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf) ...@@ -425,21 +427,22 @@ static void pitchbend_decode(snd_seq_event_t *ev, unsigned char *buf)
} }
/* decode midi control change */ /* decode midi control change */
static void two_param_decode(snd_seq_event_t *ev, unsigned char *buf) static void two_param_decode(struct snd_seq_event *ev, unsigned char *buf)
{ {
buf[0] = ev->data.control.param & 0x7f; buf[0] = ev->data.control.param & 0x7f;
buf[1] = ev->data.control.value & 0x7f; buf[1] = ev->data.control.value & 0x7f;
} }
/* decode song position */ /* decode song position */
static void songpos_decode(snd_seq_event_t *ev, unsigned char *buf) static void songpos_decode(struct snd_seq_event *ev, unsigned char *buf)
{ {
buf[0] = ev->data.control.value & 0x7f; buf[0] = ev->data.control.value & 0x7f;
buf[1] = (ev->data.control.value >> 7) & 0x7f; buf[1] = (ev->data.control.value >> 7) & 0x7f;
} }
/* decode 14bit control */ /* decode 14bit control */
static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int count, snd_seq_event_t *ev) static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf,
int count, struct snd_seq_event *ev)
{ {
unsigned char cmd; unsigned char cmd;
int idx = 0; int idx = 0;
...@@ -476,7 +479,8 @@ static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int co ...@@ -476,7 +479,8 @@ static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int co
} }
/* decode reg/nonreg param */ /* decode reg/nonreg param */
static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, snd_seq_event_t *ev) static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
int count, struct snd_seq_event *ev)
{ {
unsigned char cmd; unsigned char cmd;
char *cbytes; char *cbytes;
......
...@@ -56,16 +56,17 @@ much elements are in array. ...@@ -56,16 +56,17 @@ much elements are in array.
*/ */
/* return pointer to port structure - port is locked if found */ /* return pointer to port structure - port is locked if found */
client_port_t *snd_seq_port_use_ptr(client_t *client, int num) struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client,
int num)
{ {
struct list_head *p; struct list_head *p;
client_port_t *port; struct snd_seq_client_port *port;
if (client == NULL) if (client == NULL)
return NULL; return NULL;
read_lock(&client->ports_lock); read_lock(&client->ports_lock);
list_for_each(p, &client->ports_list_head) { list_for_each(p, &client->ports_list_head) {
port = list_entry(p, client_port_t, list); port = list_entry(p, struct snd_seq_client_port, list);
if (port->addr.port == num) { if (port->addr.port == num) {
if (port->closing) if (port->closing)
break; /* deleting now */ break; /* deleting now */
...@@ -80,17 +81,18 @@ client_port_t *snd_seq_port_use_ptr(client_t *client, int num) ...@@ -80,17 +81,18 @@ client_port_t *snd_seq_port_use_ptr(client_t *client, int num)
/* search for the next port - port is locked if found */ /* search for the next port - port is locked if found */
client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t *pinfo) struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *client,
struct snd_seq_port_info *pinfo)
{ {
int num; int num;
struct list_head *p; struct list_head *p;
client_port_t *port, *found; struct snd_seq_client_port *port, *found;
num = pinfo->addr.port; num = pinfo->addr.port;
found = NULL; found = NULL;
read_lock(&client->ports_lock); read_lock(&client->ports_lock);
list_for_each(p, &client->ports_list_head) { list_for_each(p, &client->ports_list_head) {
port = list_entry(p, client_port_t, list); port = list_entry(p, struct snd_seq_client_port, list);
if (port->addr.port < num) if (port->addr.port < num)
continue; continue;
if (port->addr.port == num) { 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,8 +113,8 @@ client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t
} }
/* initialize port_subs_info_t */ /* initialize snd_seq_port_subs_info */
static void port_subs_info_init(port_subs_info_t *grp) static void port_subs_info_init(struct snd_seq_port_subs_info *grp)
{ {
INIT_LIST_HEAD(&grp->list_head); INIT_LIST_HEAD(&grp->list_head);
grp->count = 0; grp->count = 0;
...@@ -125,10 +127,11 @@ static void port_subs_info_init(port_subs_info_t *grp) ...@@ -125,10 +127,11 @@ static void port_subs_info_init(port_subs_info_t *grp)
/* create a port, port number is returned (-1 on failure) */ /* create a port, port number is returned (-1 on failure) */
client_port_t *snd_seq_create_port(client_t *client, int port) struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
int port)
{ {
unsigned long flags; unsigned long flags;
client_port_t *new_port; struct snd_seq_client_port *new_port;
struct list_head *l; struct list_head *l;
int num = -1; int num = -1;
...@@ -159,7 +162,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port) ...@@ -159,7 +162,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port)
down(&client->ports_mutex); down(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags); write_lock_irqsave(&client->ports_lock, flags);
list_for_each(l, &client->ports_list_head) { list_for_each(l, &client->ports_list_head) {
client_port_t *p = list_entry(l, client_port_t, list); struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
if (p->addr.port > num) if (p->addr.port > num)
break; break;
if (port < 0) /* auto-probe mode */ if (port < 0) /* auto-probe mode */
...@@ -177,17 +180,24 @@ client_port_t *snd_seq_create_port(client_t *client, int port) ...@@ -177,17 +180,24 @@ client_port_t *snd_seq_create_port(client_t *client, int port)
} }
/* */ /* */
enum group_type_t { enum group_type {
SRC_LIST, DEST_LIST SRC_LIST, DEST_LIST
}; };
static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_t *grp, snd_seq_port_subscribe_t *info, int send_ack); static int subscribe_port(struct snd_seq_client *client,
static int unsubscribe_port(client_t *client, client_port_t *port, port_subs_info_t *grp, snd_seq_port_subscribe_t *info, int send_ack); struct snd_seq_client_port *port,
struct snd_seq_port_subs_info *grp,
struct snd_seq_port_subscribe *info, int send_ack);
static int unsubscribe_port(struct snd_seq_client *client,
struct snd_seq_client_port *port,
struct snd_seq_port_subs_info *grp,
struct snd_seq_port_subscribe *info, int send_ack);
static client_port_t *get_client_port(snd_seq_addr_t *addr, client_t **cp) static struct snd_seq_client_port *get_client_port(struct snd_seq_addr *addr,
struct snd_seq_client **cp)
{ {
client_port_t *p; struct snd_seq_client_port *p;
*cp = snd_seq_client_use_ptr(addr->client); *cp = snd_seq_client_use_ptr(addr->client);
if (*cp) { if (*cp) {
p = snd_seq_port_use_ptr(*cp, addr->port); 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,22 +214,24 @@ static client_port_t *get_client_port(snd_seq_addr_t *addr, client_t **cp)
* remove all subscribers on the list * remove all subscribers on the list
* this is called from port_delete, for each src and dest list. * this is called from port_delete, for each src and dest list.
*/ */
static void clear_subscriber_list(client_t *client, client_port_t *port, static void clear_subscriber_list(struct snd_seq_client *client,
port_subs_info_t *grp, int grptype) struct snd_seq_client_port *port,
struct snd_seq_port_subs_info *grp,
int grptype)
{ {
struct list_head *p, *n; struct list_head *p, *n;
down_write(&grp->list_mutex); down_write(&grp->list_mutex);
list_for_each_safe(p, n, &grp->list_head) { list_for_each_safe(p, n, &grp->list_head) {
subscribers_t *subs; struct snd_seq_subscribers *subs;
client_t *c; struct snd_seq_client *c;
client_port_t *aport; struct snd_seq_client_port *aport;
if (grptype == SRC_LIST) { if (grptype == SRC_LIST) {
subs = list_entry(p, subscribers_t, src_list); subs = list_entry(p, struct snd_seq_subscribers, src_list);
aport = get_client_port(&subs->info.dest, &c); aport = get_client_port(&subs->info.dest, &c);
} else { } else {
subs = list_entry(p, subscribers_t, dest_list); subs = list_entry(p, struct snd_seq_subscribers, dest_list);
aport = get_client_port(&subs->info.sender, &c); aport = get_client_port(&subs->info.sender, &c);
} }
list_del(p); list_del(p);
...@@ -233,7 +245,7 @@ static void clear_subscriber_list(client_t *client, client_port_t *port, ...@@ -233,7 +245,7 @@ static void clear_subscriber_list(client_t *client, client_port_t *port,
kfree(subs); kfree(subs);
} else { } else {
/* ok we got the connected port */ /* ok we got the connected port */
port_subs_info_t *agrp; struct snd_seq_port_subs_info *agrp;
agrp = (grptype == SRC_LIST) ? &aport->c_dest : &aport->c_src; agrp = (grptype == SRC_LIST) ? &aport->c_dest : &aport->c_src;
down_write(&agrp->list_mutex); down_write(&agrp->list_mutex);
if (grptype == SRC_LIST) if (grptype == SRC_LIST)
...@@ -251,7 +263,8 @@ static void clear_subscriber_list(client_t *client, client_port_t *port, ...@@ -251,7 +263,8 @@ static void clear_subscriber_list(client_t *client, client_port_t *port,
} }
/* delete port data */ /* delete port data */
static int port_delete(client_t *client, client_port_t *port) static int port_delete(struct snd_seq_client *client,
struct snd_seq_client_port *port)
{ {
/* set closing flag and wait for all port access are gone */ /* set closing flag and wait for all port access are gone */
port->closing = 1; port->closing = 1;
...@@ -273,16 +286,16 @@ static int port_delete(client_t *client, client_port_t *port) ...@@ -273,16 +286,16 @@ static int port_delete(client_t *client, client_port_t *port)
/* delete a port with the given port id */ /* delete a port with the given port id */
int snd_seq_delete_port(client_t *client, int port) int snd_seq_delete_port(struct snd_seq_client *client, int port)
{ {
unsigned long flags; unsigned long flags;
struct list_head *l; struct list_head *l;
client_port_t *found = NULL; struct snd_seq_client_port *found = NULL;
down(&client->ports_mutex); down(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags); write_lock_irqsave(&client->ports_lock, flags);
list_for_each(l, &client->ports_list_head) { list_for_each(l, &client->ports_list_head) {
client_port_t *p = list_entry(l, client_port_t, list); struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
if (p->addr.port == port) { if (p->addr.port == port) {
/* ok found. delete from the list at first */ /* ok found. delete from the list at first */
list_del(l); list_del(l);
...@@ -300,7 +313,7 @@ int snd_seq_delete_port(client_t *client, int port) ...@@ -300,7 +313,7 @@ int snd_seq_delete_port(client_t *client, int port)
} }
/* delete the all ports belonging to the given client */ /* delete the all ports belonging to the given client */
int snd_seq_delete_all_ports(client_t *client) int snd_seq_delete_all_ports(struct snd_seq_client *client)
{ {
unsigned long flags; unsigned long flags;
struct list_head deleted_list, *p, *n; struct list_head deleted_list, *p, *n;
...@@ -323,7 +336,7 @@ int snd_seq_delete_all_ports(client_t *client) ...@@ -323,7 +336,7 @@ int snd_seq_delete_all_ports(client_t *client)
/* remove each port in deleted_list */ /* remove each port in deleted_list */
list_for_each_safe(p, n, &deleted_list) { list_for_each_safe(p, n, &deleted_list) {
client_port_t *port = list_entry(p, client_port_t, list); struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list);
list_del(p); list_del(p);
snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port); snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port);
port_delete(client, port); port_delete(client, port);
...@@ -333,7 +346,8 @@ int snd_seq_delete_all_ports(client_t *client) ...@@ -333,7 +346,8 @@ int snd_seq_delete_all_ports(client_t *client)
} }
/* set port info fields */ /* set port info fields */
int snd_seq_set_port_info(client_port_t * port, snd_seq_port_info_t * info) int snd_seq_set_port_info(struct snd_seq_client_port * port,
struct snd_seq_port_info * info)
{ {
snd_assert(port && info, return -EINVAL); snd_assert(port && info, return -EINVAL);
...@@ -361,7 +375,8 @@ int snd_seq_set_port_info(client_port_t * port, snd_seq_port_info_t * info) ...@@ -361,7 +375,8 @@ int snd_seq_set_port_info(client_port_t * port, snd_seq_port_info_t * info)
} }
/* get port info fields */ /* get port info fields */
int snd_seq_get_port_info(client_port_t * port, snd_seq_port_info_t * info) int snd_seq_get_port_info(struct snd_seq_client_port * port,
struct snd_seq_port_info * info)
{ {
snd_assert(port && info, return -EINVAL); snd_assert(port && info, return -EINVAL);
...@@ -410,8 +425,11 @@ int snd_seq_get_port_info(client_port_t * port, snd_seq_port_info_t * info) ...@@ -410,8 +425,11 @@ int snd_seq_get_port_info(client_port_t * port, snd_seq_port_info_t * info)
* at each connnection/disconnection. * at each connnection/disconnection.
*/ */
static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_t *grp, static int subscribe_port(struct snd_seq_client *client,
snd_seq_port_subscribe_t *info, int send_ack) struct snd_seq_client_port *port,
struct snd_seq_port_subs_info *grp,
struct snd_seq_port_subscribe *info,
int send_ack)
{ {
int err = 0; int err = 0;
...@@ -432,9 +450,11 @@ static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_ ...@@ -432,9 +450,11 @@ static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_
return err; return err;
} }
static int unsubscribe_port(client_t *client, client_port_t *port, static int unsubscribe_port(struct snd_seq_client *client,
port_subs_info_t *grp, struct snd_seq_client_port *port,
snd_seq_port_subscribe_t *info, int send_ack) struct snd_seq_port_subs_info *grp,
struct snd_seq_port_subscribe *info,
int send_ack)
{ {
int err = 0; int err = 0;
...@@ -453,15 +473,15 @@ static int unsubscribe_port(client_t *client, client_port_t *port, ...@@ -453,15 +473,15 @@ static int unsubscribe_port(client_t *client, client_port_t *port,
/* check if both addresses are identical */ /* check if both addresses are identical */
static inline int addr_match(snd_seq_addr_t *r, snd_seq_addr_t *s) static inline int addr_match(struct snd_seq_addr *r, struct snd_seq_addr *s)
{ {
return (r->client == s->client) && (r->port == s->port); return (r->client == s->client) && (r->port == s->port);
} }
/* check the two subscribe info match */ /* check the two subscribe info match */
/* if flags is zero, checks only sender and destination addresses */ /* if flags is zero, checks only sender and destination addresses */
static int match_subs_info(snd_seq_port_subscribe_t *r, static int match_subs_info(struct snd_seq_port_subscribe *r,
snd_seq_port_subscribe_t *s) struct snd_seq_port_subscribe *s)
{ {
if (addr_match(&r->sender, &s->sender) && if (addr_match(&r->sender, &s->sender) &&
addr_match(&r->dest, &s->dest)) { addr_match(&r->dest, &s->dest)) {
...@@ -475,14 +495,16 @@ static int match_subs_info(snd_seq_port_subscribe_t *r, ...@@ -475,14 +495,16 @@ static int match_subs_info(snd_seq_port_subscribe_t *r,
/* connect two ports */ /* connect two ports */
int snd_seq_port_connect(client_t *connector, int snd_seq_port_connect(struct snd_seq_client *connector,
client_t *src_client, client_port_t *src_port, struct snd_seq_client *src_client,
client_t *dest_client, client_port_t *dest_port, struct snd_seq_client_port *src_port,
snd_seq_port_subscribe_t *info) struct snd_seq_client *dest_client,
struct snd_seq_client_port *dest_port,
struct snd_seq_port_subscribe *info)
{ {
port_subs_info_t *src = &src_port->c_src; struct snd_seq_port_subs_info *src = &src_port->c_src;
port_subs_info_t *dest = &dest_port->c_dest; struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
subscribers_t *subs; struct snd_seq_subscribers *subs;
struct list_head *p; struct list_head *p;
int err, src_called = 0; int err, src_called = 0;
unsigned long flags; unsigned long flags;
...@@ -508,12 +530,12 @@ int snd_seq_port_connect(client_t *connector, ...@@ -508,12 +530,12 @@ int snd_seq_port_connect(client_t *connector,
goto __error; goto __error;
/* check whether already exists */ /* check whether already exists */
list_for_each(p, &src->list_head) { list_for_each(p, &src->list_head) {
subscribers_t *s = list_entry(p, subscribers_t, src_list); struct snd_seq_subscribers *s = list_entry(p, struct snd_seq_subscribers, src_list);
if (match_subs_info(info, &s->info)) if (match_subs_info(info, &s->info))
goto __error; goto __error;
} }
list_for_each(p, &dest->list_head) { list_for_each(p, &dest->list_head) {
subscribers_t *s = list_entry(p, subscribers_t, dest_list); struct snd_seq_subscribers *s = list_entry(p, struct snd_seq_subscribers, dest_list);
if (match_subs_info(info, &s->info)) if (match_subs_info(info, &s->info))
goto __error; goto __error;
} }
...@@ -554,14 +576,16 @@ int snd_seq_port_connect(client_t *connector, ...@@ -554,14 +576,16 @@ int snd_seq_port_connect(client_t *connector,
/* remove the connection */ /* remove the connection */
int snd_seq_port_disconnect(client_t *connector, int snd_seq_port_disconnect(struct snd_seq_client *connector,
client_t *src_client, client_port_t *src_port, struct snd_seq_client *src_client,
client_t *dest_client, client_port_t *dest_port, struct snd_seq_client_port *src_port,
snd_seq_port_subscribe_t *info) struct snd_seq_client *dest_client,
struct snd_seq_client_port *dest_port,
struct snd_seq_port_subscribe *info)
{ {
port_subs_info_t *src = &src_port->c_src; struct snd_seq_port_subs_info *src = &src_port->c_src;
port_subs_info_t *dest = &dest_port->c_dest; struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
subscribers_t *subs; struct snd_seq_subscribers *subs;
struct list_head *p; struct list_head *p;
int err = -ENOENT; int err = -ENOENT;
unsigned long flags; unsigned long flags;
...@@ -571,7 +595,7 @@ int snd_seq_port_disconnect(client_t *connector, ...@@ -571,7 +595,7 @@ int snd_seq_port_disconnect(client_t *connector,
/* look for the connection */ /* look for the connection */
list_for_each(p, &src->list_head) { list_for_each(p, &src->list_head) {
subs = list_entry(p, subscribers_t, src_list); subs = list_entry(p, struct snd_seq_subscribers, src_list);
if (match_subs_info(info, &subs->info)) { if (match_subs_info(info, &subs->info)) {
write_lock_irqsave(&src->list_lock, flags); write_lock_irqsave(&src->list_lock, flags);
// write_lock(&dest->list_lock); // no lock yet // write_lock(&dest->list_lock); // no lock yet
...@@ -597,15 +621,15 @@ int snd_seq_port_disconnect(client_t *connector, ...@@ -597,15 +621,15 @@ int snd_seq_port_disconnect(client_t *connector,
/* get matched subscriber */ /* get matched subscriber */
subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp, struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp,
snd_seq_addr_t *dest_addr) struct snd_seq_addr *dest_addr)
{ {
struct list_head *p; struct list_head *p;
subscribers_t *s, *found = NULL; struct snd_seq_subscribers *s, *found = NULL;
down_read(&src_grp->list_mutex); down_read(&src_grp->list_mutex);
list_for_each(p, &src_grp->list_head) { list_for_each(p, &src_grp->list_head) {
s = list_entry(p, subscribers_t, src_list); s = list_entry(p, struct snd_seq_subscribers, src_list);
if (addr_match(dest_addr, &s->info.dest)) { if (addr_match(dest_addr, &s->info.dest)) {
found = s; found = s;
break; break;
...@@ -623,11 +647,11 @@ subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp, ...@@ -623,11 +647,11 @@ subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp,
*/ */
/* exported */ /* exported */
int snd_seq_event_port_attach(int client, int snd_seq_event_port_attach(int client,
snd_seq_port_callback_t *pcbp, struct snd_seq_port_callback *pcbp,
int cap, int type, int midi_channels, int cap, int type, int midi_channels,
int midi_voices, char *portname) int midi_voices, char *portname)
{ {
snd_seq_port_info_t portinfo; struct snd_seq_port_info portinfo;
int ret; int ret;
/* Set up the port */ /* Set up the port */
...@@ -660,7 +684,7 @@ int snd_seq_event_port_attach(int client, ...@@ -660,7 +684,7 @@ int snd_seq_event_port_attach(int client,
/* exported */ /* exported */
int snd_seq_event_port_detach(int client, int port) int snd_seq_event_port_detach(int client, int port)
{ {
snd_seq_port_info_t portinfo; struct snd_seq_port_info portinfo;
int err; int err;
memset(&portinfo, 0, sizeof(portinfo)); memset(&portinfo, 0, sizeof(portinfo));
......
...@@ -40,37 +40,38 @@ ...@@ -40,37 +40,38 @@
*/ */
typedef struct subscribers_t { struct snd_seq_subscribers {
snd_seq_port_subscribe_t info; /* additional info */ struct snd_seq_port_subscribe info; /* additional info */
struct list_head src_list; /* link of sources */ struct list_head src_list; /* link of sources */
struct list_head dest_list; /* link of destinations */ struct list_head dest_list; /* link of destinations */
atomic_t ref_count; atomic_t ref_count;
} subscribers_t; };
typedef struct port_subs_info_t { struct snd_seq_port_subs_info {
struct list_head list_head; /* list of subscribed ports */ struct list_head list_head; /* list of subscribed ports */
unsigned int count; /* count of subscribers */ unsigned int count; /* count of subscribers */
unsigned int exclusive: 1; /* exclusive mode */ unsigned int exclusive: 1; /* exclusive mode */
struct rw_semaphore list_mutex; struct rw_semaphore list_mutex;
rwlock_t list_lock; rwlock_t list_lock;
snd_seq_kernel_port_open_t *open; int (*open)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_close_t *close; int (*close)(void *private_data, struct snd_seq_port_subscribe *info);
} port_subs_info_t; };
typedef struct client_port_t { struct snd_seq_client_port {
snd_seq_addr_t addr; /* client/port number */ struct snd_seq_addr addr; /* client/port number */
struct module *owner; /* owner of this port */ struct module *owner; /* owner of this port */
char name[64]; /* port name */ char name[64]; /* port name */
struct list_head list; /* port list */ struct list_head list; /* port list */
snd_use_lock_t use_lock; snd_use_lock_t use_lock;
/* subscribers */ /* subscribers */
port_subs_info_t c_src; /* read (sender) list */ struct snd_seq_port_subs_info c_src; /* read (sender) list */
port_subs_info_t c_dest; /* write (dest) list */ struct snd_seq_port_subs_info c_dest; /* write (dest) list */
snd_seq_kernel_port_input_t *event_input; int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data,
snd_seq_kernel_port_private_free_t *private_free; int atomic, int hop);
void (*private_free)(void *private_data);
void *private_data; void *private_data;
unsigned int callback_all : 1; unsigned int callback_all : 1;
unsigned int closing : 1; unsigned int closing : 1;
...@@ -87,42 +88,55 @@ typedef struct client_port_t { ...@@ -87,42 +88,55 @@ typedef struct client_port_t {
int midi_voices; int midi_voices;
int synth_voices; int synth_voices;
} client_port_t; };
struct snd_seq_client;
/* return pointer to port structure and lock port */ /* return pointer to port structure and lock port */
client_port_t *snd_seq_port_use_ptr(client_t *client, int num); struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client, int num);
/* search for next port - port is locked if found */ /* search for next port - port is locked if found */
client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t *pinfo); struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *client,
struct snd_seq_port_info *pinfo);
/* unlock the port */ /* unlock the port */
#define snd_seq_port_unlock(port) snd_use_lock_free(&(port)->use_lock) #define snd_seq_port_unlock(port) snd_use_lock_free(&(port)->use_lock)
/* create a port, port number is returned (-1 on failure) */ /* create a port, port number is returned (-1 on failure) */
client_port_t *snd_seq_create_port(client_t *client, int port_index); struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, int port_index);
/* delete a port */ /* delete a port */
int snd_seq_delete_port(client_t *client, int port); int snd_seq_delete_port(struct snd_seq_client *client, int port);
/* delete all ports */ /* delete all ports */
int snd_seq_delete_all_ports(client_t *client); int snd_seq_delete_all_ports(struct snd_seq_client *client);
/* set port info fields */ /* set port info fields */
int snd_seq_set_port_info(client_port_t *port, snd_seq_port_info_t *info); int snd_seq_set_port_info(struct snd_seq_client_port *port,
struct snd_seq_port_info *info);
/* get port info fields */ /* get port info fields */
int snd_seq_get_port_info(client_port_t *port, snd_seq_port_info_t *info); int snd_seq_get_port_info(struct snd_seq_client_port *port,
struct snd_seq_port_info *info);
/* add subscriber to subscription list */ /* add subscriber to subscription list */
int 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); int snd_seq_port_connect(struct snd_seq_client *caller,
struct snd_seq_client *s, struct snd_seq_client_port *sp,
struct snd_seq_client *d, struct snd_seq_client_port *dp,
struct snd_seq_port_subscribe *info);
/* remove subscriber from subscription list */ /* remove subscriber from subscription list */
int 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); int snd_seq_port_disconnect(struct snd_seq_client *caller,
struct snd_seq_client *s, struct snd_seq_client_port *sp,
struct snd_seq_client *d, struct snd_seq_client_port *dp,
struct snd_seq_port_subscribe *info);
/* subscribe port */ /* subscribe port */
int snd_seq_port_subscribe(client_port_t *port, snd_seq_port_subscribe_t *info); int snd_seq_port_subscribe(struct snd_seq_client_port *port,
struct snd_seq_port_subscribe *info);
/* get matched subscriber */ /* get matched subscriber */
subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp, snd_seq_addr_t *dest_addr); struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp,
struct snd_seq_addr *dest_addr);
#endif #endif
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
/* create new prioq (constructor) */ /* create new prioq (constructor) */
prioq_t *snd_seq_prioq_new(void) struct snd_seq_prioq *snd_seq_prioq_new(void)
{ {
prioq_t *f; struct snd_seq_prioq *f;
f = kzalloc(sizeof(*f), GFP_KERNEL); f = kzalloc(sizeof(*f), GFP_KERNEL);
if (f == NULL) { if (f == NULL) {
...@@ -74,9 +74,9 @@ prioq_t *snd_seq_prioq_new(void) ...@@ -74,9 +74,9 @@ prioq_t *snd_seq_prioq_new(void)
} }
/* delete prioq (destructor) */ /* delete prioq (destructor) */
void snd_seq_prioq_delete(prioq_t **fifo) void snd_seq_prioq_delete(struct snd_seq_prioq **fifo)
{ {
prioq_t *f = *fifo; struct snd_seq_prioq *f = *fifo;
*fifo = NULL; *fifo = NULL;
if (f == NULL) { if (f == NULL) {
...@@ -101,7 +101,8 @@ void snd_seq_prioq_delete(prioq_t **fifo) ...@@ -101,7 +101,8 @@ void snd_seq_prioq_delete(prioq_t **fifo)
/* compare timestamp between events */ /* compare timestamp between events */
/* return 1 if a >= b; 0 */ /* return 1 if a >= b; 0 */
static inline int compare_timestamp(snd_seq_event_t * a, snd_seq_event_t * b) static inline int compare_timestamp(struct snd_seq_event *a,
struct snd_seq_event *b)
{ {
if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) { if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) {
/* compare ticks */ /* compare ticks */
...@@ -117,7 +118,8 @@ static inline int compare_timestamp(snd_seq_event_t * a, snd_seq_event_t * b) ...@@ -117,7 +118,8 @@ static inline int compare_timestamp(snd_seq_event_t * a, snd_seq_event_t * b)
* zero if a = b; * zero if a = b;
* positive if a > b; * positive if a > b;
*/ */
static inline int compare_timestamp_rel(snd_seq_event_t *a, snd_seq_event_t *b) static inline int compare_timestamp_rel(struct snd_seq_event *a,
struct snd_seq_event *b)
{ {
if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) { if ((a->flags & SNDRV_SEQ_TIME_STAMP_MASK) == SNDRV_SEQ_TIME_STAMP_TICK) {
/* compare ticks */ /* compare ticks */
...@@ -144,9 +146,10 @@ static inline int compare_timestamp_rel(snd_seq_event_t *a, snd_seq_event_t *b) ...@@ -144,9 +146,10 @@ static inline int compare_timestamp_rel(snd_seq_event_t *a, snd_seq_event_t *b)
} }
/* enqueue cell to prioq */ /* enqueue cell to prioq */
int snd_seq_prioq_cell_in(prioq_t * f, snd_seq_event_cell_t * cell) int snd_seq_prioq_cell_in(struct snd_seq_prioq * f,
struct snd_seq_event_cell * cell)
{ {
snd_seq_event_cell_t *cur, *prev; struct snd_seq_event_cell *cur, *prev;
unsigned long flags; unsigned long flags;
int count; int count;
int prior; int prior;
...@@ -215,9 +218,9 @@ int snd_seq_prioq_cell_in(prioq_t * f, snd_seq_event_cell_t * cell) ...@@ -215,9 +218,9 @@ int snd_seq_prioq_cell_in(prioq_t * f, snd_seq_event_cell_t * cell)
} }
/* dequeue cell from prioq */ /* dequeue cell from prioq */
snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t * f) struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
if (f == NULL) { if (f == NULL) {
...@@ -243,7 +246,7 @@ snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t * f) ...@@ -243,7 +246,7 @@ snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t * f)
} }
/* return number of events available in prioq */ /* return number of events available in prioq */
int snd_seq_prioq_avail(prioq_t * f) int snd_seq_prioq_avail(struct snd_seq_prioq * f)
{ {
if (f == NULL) { if (f == NULL) {
snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); 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,7 +257,7 @@ int snd_seq_prioq_avail(prioq_t * f)
/* peek at cell at the head of the prioq */ /* peek at cell at the head of the prioq */
snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t * f) struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq * f)
{ {
if (f == NULL) { if (f == NULL) {
snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); 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,7 +267,8 @@ snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t * f)
} }
static inline int prioq_match(snd_seq_event_cell_t *cell, int client, int timestamp) static inline int prioq_match(struct snd_seq_event_cell *cell,
int client, int timestamp)
{ {
if (cell->event.source.client == client || if (cell->event.source.client == client ||
cell->event.dest.client == client) 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,12 +290,12 @@ static inline int prioq_match(snd_seq_event_cell_t *cell, int client, int timest
} }
/* remove cells for left client */ /* remove cells for left client */
void snd_seq_prioq_leave(prioq_t * f, int client, int timestamp) void snd_seq_prioq_leave(struct snd_seq_prioq * f, int client, int timestamp)
{ {
register snd_seq_event_cell_t *cell, *next; register struct snd_seq_event_cell *cell, *next;
unsigned long flags; unsigned long flags;
snd_seq_event_cell_t *prev = NULL; struct snd_seq_event_cell *prev = NULL;
snd_seq_event_cell_t *freefirst = NULL, *freeprev = NULL, *freenext; struct snd_seq_event_cell *freefirst = NULL, *freeprev = NULL, *freenext;
/* collect all removed cells */ /* collect all removed cells */
spin_lock_irqsave(&f->lock, flags); spin_lock_irqsave(&f->lock, flags);
...@@ -338,8 +342,8 @@ void snd_seq_prioq_leave(prioq_t * f, int client, int timestamp) ...@@ -338,8 +342,8 @@ void snd_seq_prioq_leave(prioq_t * f, int client, int timestamp)
} }
} }
static int prioq_remove_match(snd_seq_remove_events_t *info, static int prioq_remove_match(struct snd_seq_remove_events *info,
snd_seq_event_t *ev) struct snd_seq_event *ev)
{ {
int res; int res;
...@@ -394,13 +398,13 @@ static int prioq_remove_match(snd_seq_remove_events_t *info, ...@@ -394,13 +398,13 @@ static int prioq_remove_match(snd_seq_remove_events_t *info,
} }
/* remove cells matching remove criteria */ /* remove cells matching remove criteria */
void snd_seq_prioq_remove_events(prioq_t * f, int client, void snd_seq_prioq_remove_events(struct snd_seq_prioq * f, int client,
snd_seq_remove_events_t *info) struct snd_seq_remove_events *info)
{ {
register snd_seq_event_cell_t *cell, *next; struct snd_seq_event_cell *cell, *next;
unsigned long flags; unsigned long flags;
snd_seq_event_cell_t *prev = NULL; struct snd_seq_event_cell *prev = NULL;
snd_seq_event_cell_t *freefirst = NULL, *freeprev = NULL, *freenext; struct snd_seq_event_cell *freefirst = NULL, *freeprev = NULL, *freenext;
/* collect all removed cells */ /* collect all removed cells */
spin_lock_irqsave(&f->lock, flags); spin_lock_irqsave(&f->lock, flags);
......
...@@ -26,37 +26,37 @@ ...@@ -26,37 +26,37 @@
/* === PRIOQ === */ /* === PRIOQ === */
typedef struct { struct snd_seq_prioq {
snd_seq_event_cell_t* head; /* pointer to head of prioq */ struct snd_seq_event_cell *head; /* pointer to head of prioq */
snd_seq_event_cell_t* tail; /* pointer to tail of prioq */ struct snd_seq_event_cell *tail; /* pointer to tail of prioq */
int cells; int cells;
spinlock_t lock; spinlock_t lock;
} prioq_t; };
/* create new prioq (constructor) */ /* create new prioq (constructor) */
extern prioq_t *snd_seq_prioq_new(void); struct snd_seq_prioq *snd_seq_prioq_new(void);
/* delete prioq (destructor) */ /* delete prioq (destructor) */
extern void snd_seq_prioq_delete(prioq_t **fifo); void snd_seq_prioq_delete(struct snd_seq_prioq **fifo);
/* enqueue cell to prioq */ /* enqueue cell to prioq */
extern int snd_seq_prioq_cell_in(prioq_t *f, snd_seq_event_cell_t *cell); int snd_seq_prioq_cell_in(struct snd_seq_prioq *f, struct snd_seq_event_cell *cell);
/* dequeue cell from prioq */ /* dequeue cell from prioq */
extern snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t *f); struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f);
/* return number of events available in prioq */ /* return number of events available in prioq */
extern int snd_seq_prioq_avail(prioq_t *f); int snd_seq_prioq_avail(struct snd_seq_prioq *f);
/* peek at cell at the head of the prioq */ /* peek at cell at the head of the prioq */
extern snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t *f); struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq *f);
/* client left queue */ /* client left queue */
extern void snd_seq_prioq_leave(prioq_t *f, int client, int timestamp); void snd_seq_prioq_leave(struct snd_seq_prioq *f, int client, int timestamp);
/* Remove events */ /* Remove events */
void snd_seq_prioq_remove_events(prioq_t * f, int client, void snd_seq_prioq_remove_events(struct snd_seq_prioq *f, int client,
snd_seq_remove_events_t *info); struct snd_seq_remove_events *info);
#endif #endif
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* Aug. 30, 2000 Takashi Iwai * Aug. 30, 2000 Takashi Iwai
* - Queues are managed in static array again, but with better way. * - Queues are managed in static array again, but with better way.
* The API itself is identical. * The API itself is identical.
* - The queue is locked when queue_t pinter is returned via * - The queue is locked when struct snd_seq_queue pointer is returned via
* queueptr(). This pointer *MUST* be released afterward by * queueptr(). This pointer *MUST* be released afterward by
* queuefree(ptr). * queuefree(ptr).
* - Addition of experimental sync support. * - Addition of experimental sync support.
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "seq_info.h" #include "seq_info.h"
/* list of allocated queues */ /* list of allocated queues */
static queue_t *queue_list[SNDRV_SEQ_MAX_QUEUES]; static struct snd_seq_queue *queue_list[SNDRV_SEQ_MAX_QUEUES];
static DEFINE_SPINLOCK(queue_list_lock); static DEFINE_SPINLOCK(queue_list_lock);
/* number of queues allocated */ /* number of queues allocated */
static int num_queues; static int num_queues;
...@@ -61,7 +61,7 @@ int snd_seq_queue_get_cur_queues(void) ...@@ -61,7 +61,7 @@ int snd_seq_queue_get_cur_queues(void)
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
/* assign queue id and insert to list */ /* assign queue id and insert to list */
static int queue_list_add(queue_t *q) static int queue_list_add(struct snd_seq_queue *q)
{ {
int i; int i;
unsigned long flags; unsigned long flags;
...@@ -80,9 +80,9 @@ static int queue_list_add(queue_t *q) ...@@ -80,9 +80,9 @@ static int queue_list_add(queue_t *q)
return -1; return -1;
} }
static queue_t *queue_list_remove(int id, int client) static struct snd_seq_queue *queue_list_remove(int id, int client)
{ {
queue_t *q; struct snd_seq_queue *q;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&queue_list_lock, flags); spin_lock_irqsave(&queue_list_lock, flags);
...@@ -107,9 +107,9 @@ static queue_t *queue_list_remove(int id, int client) ...@@ -107,9 +107,9 @@ static queue_t *queue_list_remove(int id, int client)
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
/* create new queue (constructor) */ /* create new queue (constructor) */
static queue_t *queue_new(int owner, int locked) static struct snd_seq_queue *queue_new(int owner, int locked)
{ {
queue_t *q; struct snd_seq_queue *q;
q = kzalloc(sizeof(*q), GFP_KERNEL); q = kzalloc(sizeof(*q), GFP_KERNEL);
if (q == NULL) { if (q == NULL) {
...@@ -142,7 +142,7 @@ static queue_t *queue_new(int owner, int locked) ...@@ -142,7 +142,7 @@ static queue_t *queue_new(int owner, int locked)
} }
/* delete queue (destructor) */ /* delete queue (destructor) */
static void queue_delete(queue_t *q) static void queue_delete(struct snd_seq_queue *q)
{ {
/* stop and release the timer */ /* stop and release the timer */
snd_seq_timer_stop(q->timer); snd_seq_timer_stop(q->timer);
...@@ -187,7 +187,7 @@ void __exit snd_seq_queues_delete(void) ...@@ -187,7 +187,7 @@ void __exit snd_seq_queues_delete(void)
*/ */
int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
{ {
queue_t *q; struct snd_seq_queue *q;
q = queue_new(client, locked); q = queue_new(client, locked);
if (q == NULL) if (q == NULL)
...@@ -204,7 +204,7 @@ int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) ...@@ -204,7 +204,7 @@ int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
/* delete a queue - queue must be owned by the client */ /* delete a queue - queue must be owned by the client */
int snd_seq_queue_delete(int client, int queueid) int snd_seq_queue_delete(int client, int queueid)
{ {
queue_t *q; struct snd_seq_queue *q;
if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES) if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES)
return -EINVAL; return -EINVAL;
...@@ -218,9 +218,9 @@ int snd_seq_queue_delete(int client, int queueid) ...@@ -218,9 +218,9 @@ int snd_seq_queue_delete(int client, int queueid)
/* return pointer to queue structure for specified id */ /* return pointer to queue structure for specified id */
queue_t *queueptr(int queueid) struct snd_seq_queue *queueptr(int queueid)
{ {
queue_t *q; struct snd_seq_queue *q;
unsigned long flags; unsigned long flags;
if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES) if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES)
...@@ -234,10 +234,10 @@ queue_t *queueptr(int queueid) ...@@ -234,10 +234,10 @@ queue_t *queueptr(int queueid)
} }
/* return the (first) queue matching with the specified name */ /* return the (first) queue matching with the specified name */
queue_t *snd_seq_queue_find_name(char *name) struct snd_seq_queue *snd_seq_queue_find_name(char *name)
{ {
int i; int i;
queue_t *q; struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) != NULL) { if ((q = queueptr(i)) != NULL) {
...@@ -252,10 +252,10 @@ queue_t *snd_seq_queue_find_name(char *name) ...@@ -252,10 +252,10 @@ queue_t *snd_seq_queue_find_name(char *name)
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
void snd_seq_check_queue(queue_t *q, int atomic, int hop) void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
{ {
unsigned long flags; unsigned long flags;
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
if (q == NULL) if (q == NULL)
return; return;
...@@ -273,7 +273,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop) ...@@ -273,7 +273,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
__again: __again:
/* Process tick queue... */ /* Process tick queue... */
while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) { while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) {
if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick, &cell->event.time.tick)) { if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick,
&cell->event.time.tick)) {
cell = snd_seq_prioq_cell_out(q->tickq); cell = snd_seq_prioq_cell_out(q->tickq);
if (cell) if (cell)
snd_seq_dispatch_event(cell, atomic, hop); snd_seq_dispatch_event(cell, atomic, hop);
...@@ -286,7 +287,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop) ...@@ -286,7 +287,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
/* Process time queue... */ /* Process time queue... */
while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) { while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) {
if (snd_seq_compare_real_time(&q->timer->cur_time, &cell->event.time.time)) { if (snd_seq_compare_real_time(&q->timer->cur_time,
&cell->event.time.time)) {
cell = snd_seq_prioq_cell_out(q->timeq); cell = snd_seq_prioq_cell_out(q->timeq);
if (cell) if (cell)
snd_seq_dispatch_event(cell, atomic, hop); snd_seq_dispatch_event(cell, atomic, hop);
...@@ -309,10 +311,10 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop) ...@@ -309,10 +311,10 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
/* enqueue a event to singe queue */ /* enqueue a event to singe queue */
int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop) int snd_seq_enqueue_event(struct snd_seq_event_cell *cell, int atomic, int hop)
{ {
int dest, err; int dest, err;
queue_t *q; struct snd_seq_queue *q;
snd_assert(cell != NULL, return -EINVAL); snd_assert(cell != NULL, return -EINVAL);
dest = cell->event.queue; /* destination queue */ 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,7 +329,8 @@ int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop)
break; break;
case SNDRV_SEQ_TIME_STAMP_REAL: case SNDRV_SEQ_TIME_STAMP_REAL:
snd_seq_inc_real_time(&cell->event.time.time, &q->timer->cur_time); snd_seq_inc_real_time(&cell->event.time.time,
&q->timer->cur_time);
break; break;
} }
cell->event.flags &= ~SNDRV_SEQ_TIME_MODE_MASK; 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,7 +364,7 @@ int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop)
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
static inline int check_access(queue_t *q, int client) static inline int check_access(struct snd_seq_queue *q, int client)
{ {
return (q->owner == client) || (!q->locked && !q->klocked); return (q->owner == client) || (!q->locked && !q->klocked);
} }
...@@ -369,7 +372,7 @@ static inline int check_access(queue_t *q, int client) ...@@ -369,7 +372,7 @@ static inline int check_access(queue_t *q, int client)
/* check if the client has permission to modify queue parameters. /* check if the client has permission to modify queue parameters.
* if it does, lock the queue * if it does, lock the queue
*/ */
static int queue_access_lock(queue_t *q, int client) static int queue_access_lock(struct snd_seq_queue *q, int client)
{ {
unsigned long flags; unsigned long flags;
int access_ok; int access_ok;
...@@ -383,7 +386,7 @@ static int queue_access_lock(queue_t *q, int client) ...@@ -383,7 +386,7 @@ static int queue_access_lock(queue_t *q, int client)
} }
/* unlock the queue */ /* unlock the queue */
static inline void queue_access_unlock(queue_t *q) static inline void queue_access_unlock(struct snd_seq_queue *q)
{ {
unsigned long flags; unsigned long flags;
...@@ -395,7 +398,7 @@ static inline void queue_access_unlock(queue_t *q) ...@@ -395,7 +398,7 @@ static inline void queue_access_unlock(queue_t *q)
/* exported - only checking permission */ /* exported - only checking permission */
int snd_seq_queue_check_access(int queueid, int client) int snd_seq_queue_check_access(int queueid, int client)
{ {
queue_t *q = queueptr(queueid); struct snd_seq_queue *q = queueptr(queueid);
int access_ok; int access_ok;
unsigned long flags; unsigned long flags;
...@@ -415,7 +418,7 @@ int snd_seq_queue_check_access(int queueid, int client) ...@@ -415,7 +418,7 @@ int snd_seq_queue_check_access(int queueid, int client)
*/ */
int snd_seq_queue_set_owner(int queueid, int client, int locked) int snd_seq_queue_set_owner(int queueid, int client, int locked)
{ {
queue_t *q = queueptr(queueid); struct snd_seq_queue *q = queueptr(queueid);
if (q == NULL) if (q == NULL)
return -EINVAL; return -EINVAL;
...@@ -443,8 +446,8 @@ int snd_seq_queue_set_owner(int queueid, int client, int locked) ...@@ -443,8 +446,8 @@ int snd_seq_queue_set_owner(int queueid, int client, int locked)
int snd_seq_queue_timer_open(int queueid) int snd_seq_queue_timer_open(int queueid)
{ {
int result = 0; int result = 0;
queue_t *queue; struct snd_seq_queue *queue;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
queue = queueptr(queueid); queue = queueptr(queueid);
if (queue == NULL) if (queue == NULL)
...@@ -463,8 +466,8 @@ int snd_seq_queue_timer_open(int queueid) ...@@ -463,8 +466,8 @@ int snd_seq_queue_timer_open(int queueid)
*/ */
int snd_seq_queue_timer_close(int queueid) int snd_seq_queue_timer_close(int queueid)
{ {
queue_t *queue; struct snd_seq_queue *queue;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
int result = 0; int result = 0;
queue = queueptr(queueid); queue = queueptr(queueid);
...@@ -477,9 +480,10 @@ int snd_seq_queue_timer_close(int queueid) ...@@ -477,9 +480,10 @@ int snd_seq_queue_timer_close(int queueid)
} }
/* change queue tempo and ppq */ /* change queue tempo and ppq */
int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t *info) int snd_seq_queue_timer_set_tempo(int queueid, int client,
struct snd_seq_queue_tempo *info)
{ {
queue_t *q = queueptr(queueid); struct snd_seq_queue *q = queueptr(queueid);
int result; int result;
if (q == NULL) if (q == NULL)
...@@ -493,7 +497,8 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t ...@@ -493,7 +497,8 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t
if (result >= 0) if (result >= 0)
result = snd_seq_timer_set_ppq(q->timer, info->ppq); result = snd_seq_timer_set_ppq(q->timer, info->ppq);
if (result >= 0 && info->skew_base > 0) if (result >= 0 && info->skew_base > 0)
result = snd_seq_timer_set_skew(q->timer, info->skew_value, info->skew_base); result = snd_seq_timer_set_skew(q->timer, info->skew_value,
info->skew_base);
queue_access_unlock(q); queue_access_unlock(q);
queuefree(q); queuefree(q);
return result; return result;
...@@ -506,7 +511,7 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t ...@@ -506,7 +511,7 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t
*/ */
int snd_seq_queue_use(int queueid, int client, int use) int snd_seq_queue_use(int queueid, int client, int use)
{ {
queue_t *queue; struct snd_seq_queue *queue;
queue = queueptr(queueid); queue = queueptr(queueid);
if (queue == NULL) if (queue == NULL)
...@@ -538,7 +543,7 @@ int snd_seq_queue_use(int queueid, int client, int use) ...@@ -538,7 +543,7 @@ int snd_seq_queue_use(int queueid, int client, int use)
*/ */
int snd_seq_queue_is_used(int queueid, int client) int snd_seq_queue_is_used(int queueid, int client)
{ {
queue_t *q; struct snd_seq_queue *q;
int result; int result;
q = queueptr(queueid); q = queueptr(queueid);
...@@ -559,7 +564,7 @@ void snd_seq_queue_client_termination(int client) ...@@ -559,7 +564,7 @@ void snd_seq_queue_client_termination(int client)
{ {
unsigned long flags; unsigned long flags;
int i; int i;
queue_t *q; struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL) if ((q = queueptr(i)) == NULL)
...@@ -584,7 +589,7 @@ void snd_seq_queue_client_termination(int client) ...@@ -584,7 +589,7 @@ void snd_seq_queue_client_termination(int client)
void snd_seq_queue_client_leave(int client) void snd_seq_queue_client_leave(int client)
{ {
int i; int i;
queue_t *q; struct snd_seq_queue *q;
/* delete own queues from queue list */ /* delete own queues from queue list */
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
...@@ -615,7 +620,7 @@ void snd_seq_queue_client_leave(int client) ...@@ -615,7 +620,7 @@ void snd_seq_queue_client_leave(int client)
void snd_seq_queue_client_leave_cells(int client) void snd_seq_queue_client_leave_cells(int client)
{ {
int i; int i;
queue_t *q; struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL) if ((q = queueptr(i)) == NULL)
...@@ -627,10 +632,10 @@ void snd_seq_queue_client_leave_cells(int client) ...@@ -627,10 +632,10 @@ void snd_seq_queue_client_leave_cells(int client)
} }
/* remove cells based on flush criteria */ /* remove cells based on flush criteria */
void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info) void snd_seq_queue_remove_cells(int client, struct snd_seq_remove_events *info)
{ {
int i; int i;
queue_t *q; struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL) if ((q = queueptr(i)) == NULL)
...@@ -650,9 +655,10 @@ void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info) ...@@ -650,9 +655,10 @@ void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info)
/* /*
* send events to all subscribed ports * send events to all subscribed ports
*/ */
static void queue_broadcast_event(queue_t *q, snd_seq_event_t *ev, int atomic, int hop) static void queue_broadcast_event(struct snd_seq_queue *q, struct snd_seq_event *ev,
int atomic, int hop)
{ {
snd_seq_event_t sev; struct snd_seq_event sev;
sev = *ev; sev = *ev;
...@@ -672,7 +678,8 @@ static void queue_broadcast_event(queue_t *q, snd_seq_event_t *ev, int atomic, i ...@@ -672,7 +678,8 @@ static void queue_broadcast_event(queue_t *q, snd_seq_event_t *ev, int atomic, i
* process a received queue-control event. * process a received queue-control event.
* this function is exported for seq_sync.c. * this function is exported for seq_sync.c.
*/ */
static void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev, static void snd_seq_queue_process_event(struct snd_seq_queue *q,
struct snd_seq_event *ev,
int atomic, int hop) int atomic, int hop)
{ {
switch (ev->type) { switch (ev->type) {
...@@ -724,9 +731,9 @@ static void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev, ...@@ -724,9 +731,9 @@ static void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev,
* Queue control via timer control port: * Queue control via timer control port:
* this function is exported as a callback of timer port. * this function is exported as a callback of timer port.
*/ */
int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop) int snd_seq_control_queue(struct snd_seq_event *ev, int atomic, int hop)
{ {
queue_t *q; struct snd_seq_queue *q;
snd_assert(ev != NULL, return -EINVAL); snd_assert(ev != NULL, return -EINVAL);
q = queueptr(ev->data.queue.queue); 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,12 +757,12 @@ int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop)
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
/* exported to seq_info.c */ /* exported to seq_info.c */
void snd_seq_info_queues_read(snd_info_entry_t *entry, void snd_seq_info_queues_read(struct snd_info_entry *entry,
snd_info_buffer_t * buffer) struct snd_info_buffer *buffer)
{ {
int i, bpm; int i, bpm;
queue_t *q; struct snd_seq_queue *q;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL) if ((q = queueptr(i)) == NULL)
......
...@@ -30,15 +30,15 @@ ...@@ -30,15 +30,15 @@
#define SEQ_QUEUE_NO_OWNER (-1) #define SEQ_QUEUE_NO_OWNER (-1)
struct _snd_seq_queue { struct snd_seq_queue {
int queue; /* queue number */ int queue; /* queue number */
char name[64]; /* name of this queue */ char name[64]; /* name of this queue */
prioq_t *tickq; /* midi tick event queue */ struct snd_seq_prioq *tickq; /* midi tick event queue */
prioq_t *timeq; /* real-time event queue */ struct snd_seq_prioq *timeq; /* real-time event queue */
seq_timer_t *timer; /* time keeper for this queue */ struct snd_seq_timer *timer; /* time keeper for this queue */
int owner; /* client that 'owns' the timer */ int owner; /* client that 'owns' the timer */
unsigned int locked:1, /* timer is only accesibble by owner if set */ unsigned int locked:1, /* timer is only accesibble by owner if set */
klocked:1, /* kernel lock (after START) */ klocked:1, /* kernel lock (after START) */
...@@ -83,26 +83,26 @@ void snd_seq_queue_client_termination(int client); ...@@ -83,26 +83,26 @@ void snd_seq_queue_client_termination(int client);
void snd_seq_queue_client_leave(int client); void snd_seq_queue_client_leave(int client);
/* enqueue a event received from one the clients */ /* enqueue a event received from one the clients */
int snd_seq_enqueue_event(snd_seq_event_cell_t *cell, int atomic, int hop); int snd_seq_enqueue_event(struct snd_seq_event_cell *cell, int atomic, int hop);
/* Remove events */ /* Remove events */
void snd_seq_queue_client_leave_cells(int client); void snd_seq_queue_client_leave_cells(int client);
void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info); void snd_seq_queue_remove_cells(int client, struct snd_seq_remove_events *info);
/* return pointer to queue structure for specified id */ /* return pointer to queue structure for specified id */
queue_t *queueptr(int queueid); struct snd_seq_queue *queueptr(int queueid);
/* unlock */ /* unlock */
#define queuefree(q) snd_use_lock_free(&(q)->use_lock) #define queuefree(q) snd_use_lock_free(&(q)->use_lock)
/* return the (first) queue matching with the specified name */ /* return the (first) queue matching with the specified name */
queue_t *snd_seq_queue_find_name(char *name); struct snd_seq_queue *snd_seq_queue_find_name(char *name);
/* check single queue and dispatch events */ /* check single queue and dispatch events */
void snd_seq_check_queue(queue_t *q, int atomic, int hop); void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop);
/* access to queue's parameters */ /* access to queue's parameters */
int snd_seq_queue_check_access(int queueid, int client); int snd_seq_queue_check_access(int queueid, int client);
int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t *info); int snd_seq_queue_timer_set_tempo(int queueid, int client, struct snd_seq_queue_tempo *info);
int snd_seq_queue_set_owner(int queueid, int client, int locked); int snd_seq_queue_set_owner(int queueid, int client, int locked);
int snd_seq_queue_set_locked(int queueid, int client, int locked); int snd_seq_queue_set_locked(int queueid, int client, int locked);
int snd_seq_queue_timer_open(int queueid); int snd_seq_queue_timer_open(int queueid);
...@@ -110,7 +110,7 @@ int snd_seq_queue_timer_close(int queueid); ...@@ -110,7 +110,7 @@ int snd_seq_queue_timer_close(int queueid);
int snd_seq_queue_use(int queueid, int client, int use); int snd_seq_queue_use(int queueid, int client, int use);
int snd_seq_queue_is_used(int queueid, int client); int snd_seq_queue_is_used(int queueid, int client);
int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop); int snd_seq_control_queue(struct snd_seq_event *ev, int atomic, int hop);
/* /*
* 64bit division - for sync stuff.. * 64bit division - for sync stuff..
......
...@@ -66,12 +66,12 @@ static int announce_port = -1; ...@@ -66,12 +66,12 @@ static int announce_port = -1;
/* fill standard header data, source port & channel are filled in */ /* fill standard header data, source port & channel are filled in */
static int setheader(snd_seq_event_t * ev, int client, int port) static int setheader(struct snd_seq_event * ev, int client, int port)
{ {
if (announce_port < 0) if (announce_port < 0)
return -ENODEV; return -ENODEV;
memset(ev, 0, sizeof(snd_seq_event_t)); memset(ev, 0, sizeof(struct snd_seq_event));
ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED; ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED;
...@@ -92,7 +92,7 @@ static int setheader(snd_seq_event_t * ev, int client, int port) ...@@ -92,7 +92,7 @@ static int setheader(snd_seq_event_t * ev, int client, int port)
/* entry points for broadcasting system events */ /* entry points for broadcasting system events */
void snd_seq_system_broadcast(int client, int port, int type) void snd_seq_system_broadcast(int client, int port, int type)
{ {
snd_seq_event_t ev; struct snd_seq_event ev;
if (setheader(&ev, client, port) < 0) if (setheader(&ev, client, port) < 0)
return; return;
...@@ -101,7 +101,7 @@ void snd_seq_system_broadcast(int client, int port, int type) ...@@ -101,7 +101,7 @@ void snd_seq_system_broadcast(int client, int port, int type)
} }
/* entry points for broadcasting system events */ /* entry points for broadcasting system events */
int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev) int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev)
{ {
ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED; ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED;
ev->source.client = sysclient; ev->source.client = sysclient;
...@@ -112,7 +112,7 @@ int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev) ...@@ -112,7 +112,7 @@ int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev)
} }
/* call-back handler for timer events */ /* call-back handler for timer events */
static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop) static int event_input_timer(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop)
{ {
return snd_seq_control_queue(ev, atomic, hop); return snd_seq_control_queue(ev, atomic, hop);
} }
...@@ -121,10 +121,10 @@ static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_dat ...@@ -121,10 +121,10 @@ static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_dat
int __init snd_seq_system_client_init(void) int __init snd_seq_system_client_init(void)
{ {
snd_seq_client_callback_t callbacks; struct snd_seq_client_callback callbacks;
snd_seq_port_callback_t pcallbacks; struct snd_seq_port_callback pcallbacks;
snd_seq_client_info_t *inf; struct snd_seq_client_info *inf;
snd_seq_port_info_t *port; struct snd_seq_port_info *port;
inf = kzalloc(sizeof(*inf), GFP_KERNEL); inf = kzalloc(sizeof(*inf), GFP_KERNEL);
port = kzalloc(sizeof(*port), GFP_KERNEL); port = kzalloc(sizeof(*port), GFP_KERNEL);
......
...@@ -34,7 +34,7 @@ void snd_seq_system_broadcast(int client, int port, int type); ...@@ -34,7 +34,7 @@ void snd_seq_system_broadcast(int client, int port, int type);
#define snd_seq_system_client_ev_port_exit(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_EXIT) #define snd_seq_system_client_ev_port_exit(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
#define snd_seq_system_client_ev_port_change(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE) #define snd_seq_system_client_ev_port_change(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev); int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev);
/* register our internal client */ /* register our internal client */
int snd_seq_system_client_init(void); int snd_seq_system_client_init(void);
......
...@@ -41,7 +41,7 @@ extern int seq_default_timer_resolution; ...@@ -41,7 +41,7 @@ extern int seq_default_timer_resolution;
#define SKEW_BASE 0x10000 /* 16bit shift */ #define SKEW_BASE 0x10000 /* 16bit shift */
static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick, static void snd_seq_timer_set_tick_resolution(struct snd_seq_timer_tick *tick,
int tempo, int ppq) int tempo, int ppq)
{ {
if (tempo < 1000000) if (tempo < 1000000)
...@@ -60,9 +60,9 @@ static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick, ...@@ -60,9 +60,9 @@ static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick,
} }
/* create new timer (constructor) */ /* create new timer (constructor) */
seq_timer_t *snd_seq_timer_new(void) struct snd_seq_timer *snd_seq_timer_new(void)
{ {
seq_timer_t *tmr; struct snd_seq_timer *tmr;
tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
if (tmr == NULL) { if (tmr == NULL) {
...@@ -81,9 +81,9 @@ seq_timer_t *snd_seq_timer_new(void) ...@@ -81,9 +81,9 @@ seq_timer_t *snd_seq_timer_new(void)
} }
/* delete timer (destructor) */ /* delete timer (destructor) */
void snd_seq_timer_delete(seq_timer_t **tmr) void snd_seq_timer_delete(struct snd_seq_timer **tmr)
{ {
seq_timer_t *t = *tmr; struct snd_seq_timer *t = *tmr;
*tmr = NULL; *tmr = NULL;
if (t == NULL) { if (t == NULL) {
...@@ -99,7 +99,7 @@ void snd_seq_timer_delete(seq_timer_t **tmr) ...@@ -99,7 +99,7 @@ void snd_seq_timer_delete(seq_timer_t **tmr)
kfree(t); kfree(t);
} }
void snd_seq_timer_defaults(seq_timer_t * tmr) void snd_seq_timer_defaults(struct snd_seq_timer * tmr)
{ {
/* setup defaults */ /* setup defaults */
tmr->ppq = 96; /* 96 PPQ */ tmr->ppq = 96; /* 96 PPQ */
...@@ -118,7 +118,7 @@ void snd_seq_timer_defaults(seq_timer_t * tmr) ...@@ -118,7 +118,7 @@ void snd_seq_timer_defaults(seq_timer_t * tmr)
tmr->skew = tmr->skew_base = SKEW_BASE; tmr->skew = tmr->skew_base = SKEW_BASE;
} }
void snd_seq_timer_reset(seq_timer_t * tmr) void snd_seq_timer_reset(struct snd_seq_timer * tmr)
{ {
unsigned long flags; unsigned long flags;
...@@ -136,13 +136,13 @@ void snd_seq_timer_reset(seq_timer_t * tmr) ...@@ -136,13 +136,13 @@ void snd_seq_timer_reset(seq_timer_t * tmr)
/* called by timer interrupt routine. the period time since previous invocation is passed */ /* called by timer interrupt routine. the period time since previous invocation is passed */
static void snd_seq_timer_interrupt(snd_timer_instance_t *timeri, static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri,
unsigned long resolution, unsigned long resolution,
unsigned long ticks) unsigned long ticks)
{ {
unsigned long flags; unsigned long flags;
queue_t *q = (queue_t *)timeri->callback_data; struct snd_seq_queue *q = timeri->callback_data;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
if (q == NULL) if (q == NULL)
return; return;
...@@ -177,7 +177,7 @@ static void snd_seq_timer_interrupt(snd_timer_instance_t *timeri, ...@@ -177,7 +177,7 @@ static void snd_seq_timer_interrupt(snd_timer_instance_t *timeri,
} }
/* set current tempo */ /* set current tempo */
int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo) int snd_seq_timer_set_tempo(struct snd_seq_timer * tmr, int tempo)
{ {
unsigned long flags; unsigned long flags;
...@@ -194,7 +194,7 @@ int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo) ...@@ -194,7 +194,7 @@ int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo)
} }
/* set current ppq */ /* set current ppq */
int snd_seq_timer_set_ppq(seq_timer_t * tmr, int ppq) int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq)
{ {
unsigned long flags; unsigned long flags;
...@@ -217,7 +217,8 @@ int snd_seq_timer_set_ppq(seq_timer_t * tmr, int ppq) ...@@ -217,7 +217,8 @@ int snd_seq_timer_set_ppq(seq_timer_t * tmr, int ppq)
} }
/* set current tick position */ /* set current tick position */
int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t position) int snd_seq_timer_set_position_tick(struct snd_seq_timer *tmr,
snd_seq_tick_time_t position)
{ {
unsigned long flags; unsigned long flags;
...@@ -231,7 +232,8 @@ int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t positi ...@@ -231,7 +232,8 @@ int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t positi
} }
/* set current real-time position */ /* set current real-time position */
int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t position) int snd_seq_timer_set_position_time(struct snd_seq_timer *tmr,
snd_seq_real_time_t position)
{ {
unsigned long flags; unsigned long flags;
...@@ -245,7 +247,8 @@ int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t positi ...@@ -245,7 +247,8 @@ int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t positi
} }
/* set timer skew */ /* set timer skew */
int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int base) int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew,
unsigned int base)
{ {
unsigned long flags; unsigned long flags;
...@@ -262,10 +265,10 @@ int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int bas ...@@ -262,10 +265,10 @@ int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int bas
return 0; return 0;
} }
int snd_seq_timer_open(queue_t *q) int snd_seq_timer_open(struct snd_seq_queue *q)
{ {
snd_timer_instance_t *t; struct snd_timer_instance *t;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
char str[32]; char str[32];
int err; int err;
...@@ -282,7 +285,7 @@ int snd_seq_timer_open(queue_t *q) ...@@ -282,7 +285,7 @@ int snd_seq_timer_open(queue_t *q)
if (err < 0 && tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_SLAVE) { if (err < 0 && tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_SLAVE) {
if (tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_GLOBAL || if (tmr->alsa_id.dev_class != SNDRV_TIMER_CLASS_GLOBAL ||
tmr->alsa_id.device != SNDRV_TIMER_GLOBAL_SYSTEM) { tmr->alsa_id.device != SNDRV_TIMER_GLOBAL_SYSTEM) {
snd_timer_id_t tid; struct snd_timer_id tid;
memset(&tid, 0, sizeof(tid)); memset(&tid, 0, sizeof(tid));
tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL; tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL;
tid.dev_sclass = SNDRV_TIMER_SCLASS_SEQUENCER; tid.dev_sclass = SNDRV_TIMER_SCLASS_SEQUENCER;
...@@ -302,9 +305,9 @@ int snd_seq_timer_open(queue_t *q) ...@@ -302,9 +305,9 @@ int snd_seq_timer_open(queue_t *q)
return 0; return 0;
} }
int snd_seq_timer_close(queue_t *q) int snd_seq_timer_close(struct snd_seq_queue *q)
{ {
seq_timer_t *tmr; struct snd_seq_timer *tmr;
tmr = q->timer; tmr = q->timer;
snd_assert(tmr != NULL, return -EINVAL); snd_assert(tmr != NULL, return -EINVAL);
...@@ -316,7 +319,7 @@ int snd_seq_timer_close(queue_t *q) ...@@ -316,7 +319,7 @@ int snd_seq_timer_close(queue_t *q)
return 0; return 0;
} }
int snd_seq_timer_stop(seq_timer_t * tmr) int snd_seq_timer_stop(struct snd_seq_timer * tmr)
{ {
if (! tmr->timeri) if (! tmr->timeri)
return -EINVAL; return -EINVAL;
...@@ -327,9 +330,9 @@ int snd_seq_timer_stop(seq_timer_t * tmr) ...@@ -327,9 +330,9 @@ int snd_seq_timer_stop(seq_timer_t * tmr)
return 0; return 0;
} }
static int initialize_timer(seq_timer_t *tmr) static int initialize_timer(struct snd_seq_timer *tmr)
{ {
snd_timer_t *t; struct snd_timer *t;
unsigned long freq; unsigned long freq;
t = tmr->timeri->timer; t = tmr->timeri->timer;
...@@ -358,7 +361,7 @@ static int initialize_timer(seq_timer_t *tmr) ...@@ -358,7 +361,7 @@ static int initialize_timer(seq_timer_t *tmr)
return 0; return 0;
} }
int snd_seq_timer_start(seq_timer_t * tmr) int snd_seq_timer_start(struct snd_seq_timer * tmr)
{ {
if (! tmr->timeri) if (! tmr->timeri)
return -EINVAL; return -EINVAL;
...@@ -373,7 +376,7 @@ int snd_seq_timer_start(seq_timer_t * tmr) ...@@ -373,7 +376,7 @@ int snd_seq_timer_start(seq_timer_t * tmr)
return 0; return 0;
} }
int snd_seq_timer_continue(seq_timer_t * tmr) int snd_seq_timer_continue(struct snd_seq_timer * tmr)
{ {
if (! tmr->timeri) if (! tmr->timeri)
return -EINVAL; return -EINVAL;
...@@ -391,7 +394,7 @@ int snd_seq_timer_continue(seq_timer_t * tmr) ...@@ -391,7 +394,7 @@ int snd_seq_timer_continue(seq_timer_t * tmr)
} }
/* return current 'real' time. use timeofday() to get better granularity. */ /* return current 'real' time. use timeofday() to get better granularity. */
snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr) snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr)
{ {
snd_seq_real_time_t cur_time; snd_seq_real_time_t cur_time;
...@@ -416,19 +419,20 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr) ...@@ -416,19 +419,20 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr)
/* TODO: use interpolation on tick queue (will only be useful for very /* TODO: use interpolation on tick queue (will only be useful for very
high PPQ values) */ high PPQ values) */
snd_seq_tick_time_t snd_seq_timer_get_cur_tick(seq_timer_t *tmr) snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr)
{ {
return tmr->tick.cur_tick; return tmr->tick.cur_tick;
} }
/* exported to seq_info.c */ /* exported to seq_info.c */
void snd_seq_info_timer_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) void snd_seq_info_timer_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
int idx; int idx;
queue_t *q; struct snd_seq_queue *q;
seq_timer_t *tmr; struct snd_seq_timer *tmr;
snd_timer_instance_t *ti; struct snd_timer_instance *ti;
unsigned long resolution; unsigned long resolution;
for (idx = 0; idx < SNDRV_SEQ_MAX_QUEUES; idx++) { for (idx = 0; idx < SNDRV_SEQ_MAX_QUEUES; idx++) {
......
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
#include <sound/timer.h> #include <sound/timer.h>
#include <sound/seq_kernel.h> #include <sound/seq_kernel.h>
typedef struct { struct snd_seq_timer_tick {
snd_seq_tick_time_t cur_tick; /* current tick */ snd_seq_tick_time_t cur_tick; /* current tick */
unsigned long resolution; /* time per tick in nsec */ unsigned long resolution; /* time per tick in nsec */
unsigned long fraction; /* current time per tick in nsec */ unsigned long fraction; /* current time per tick in nsec */
} seq_timer_tick_t; };
typedef struct { struct snd_seq_timer {
/* ... tempo / offset / running state */ /* ... tempo / offset / running state */
unsigned int running:1, /* running state of queue */ unsigned int running:1, /* running state of queue */
...@@ -40,12 +40,12 @@ typedef struct { ...@@ -40,12 +40,12 @@ typedef struct {
int ppq; /* time resolution, ticks/quarter */ int ppq; /* time resolution, ticks/quarter */
snd_seq_real_time_t cur_time; /* current time */ snd_seq_real_time_t cur_time; /* current time */
seq_timer_tick_t tick; /* current tick */ struct snd_seq_timer_tick tick; /* current tick */
int tick_updated; int tick_updated;
int type; /* timer type */ int type; /* timer type */
snd_timer_id_t alsa_id; /* ALSA's timer ID */ struct snd_timer_id alsa_id; /* ALSA's timer ID */
snd_timer_instance_t *timeri; /* timer instance */ struct snd_timer_instance *timeri; /* timer instance */
unsigned int ticks; unsigned int ticks;
unsigned long preferred_resolution; /* timer resolution, ticks/sec */ unsigned long preferred_resolution; /* timer resolution, ticks/sec */
...@@ -55,17 +55,18 @@ typedef struct { ...@@ -55,17 +55,18 @@ typedef struct {
struct timeval last_update; /* time of last clock update, used for interpolation */ struct timeval last_update; /* time of last clock update, used for interpolation */
spinlock_t lock; spinlock_t lock;
} seq_timer_t; };
/* create new timer (constructor) */ /* create new timer (constructor) */
extern seq_timer_t *snd_seq_timer_new(void); struct snd_seq_timer *snd_seq_timer_new(void);
/* delete timer (destructor) */ /* delete timer (destructor) */
extern void snd_seq_timer_delete(seq_timer_t **tmr); void snd_seq_timer_delete(struct snd_seq_timer **tmr);
/* */ /* */
static inline void snd_seq_timer_update_tick(seq_timer_tick_t *tick, unsigned long resolution) static inline void snd_seq_timer_update_tick(struct snd_seq_timer_tick *tick,
unsigned long resolution)
{ {
if (tick->resolution > 0) { if (tick->resolution > 0) {
tick->fraction += resolution; tick->fraction += resolution;
...@@ -119,21 +120,22 @@ static inline void snd_seq_inc_time_nsec(snd_seq_real_time_t *tm, unsigned long ...@@ -119,21 +120,22 @@ static inline void snd_seq_inc_time_nsec(snd_seq_real_time_t *tm, unsigned long
} }
/* called by timer isr */ /* called by timer isr */
int snd_seq_timer_open(queue_t *q); struct snd_seq_queue;
int snd_seq_timer_close(queue_t *q); int snd_seq_timer_open(struct snd_seq_queue *q);
int snd_seq_timer_midi_open(queue_t *q); int snd_seq_timer_close(struct snd_seq_queue *q);
int snd_seq_timer_midi_close(queue_t *q); int snd_seq_timer_midi_open(struct snd_seq_queue *q);
void snd_seq_timer_defaults(seq_timer_t *tmr); int snd_seq_timer_midi_close(struct snd_seq_queue *q);
void snd_seq_timer_reset(seq_timer_t *tmr); void snd_seq_timer_defaults(struct snd_seq_timer *tmr);
int snd_seq_timer_stop(seq_timer_t *tmr); void snd_seq_timer_reset(struct snd_seq_timer *tmr);
int snd_seq_timer_start(seq_timer_t *tmr); int snd_seq_timer_stop(struct snd_seq_timer *tmr);
int snd_seq_timer_continue(seq_timer_t *tmr); int snd_seq_timer_start(struct snd_seq_timer *tmr);
int snd_seq_timer_set_tempo(seq_timer_t *tmr, int tempo); int snd_seq_timer_continue(struct snd_seq_timer *tmr);
int snd_seq_timer_set_ppq(seq_timer_t *tmr, int ppq); int snd_seq_timer_set_tempo(struct snd_seq_timer *tmr, int tempo);
int snd_seq_timer_set_position_tick(seq_timer_t *tmr, snd_seq_tick_time_t position); int snd_seq_timer_set_ppq(struct snd_seq_timer *tmr, int ppq);
int snd_seq_timer_set_position_time(seq_timer_t *tmr, snd_seq_real_time_t position); int snd_seq_timer_set_position_tick(struct snd_seq_timer *tmr, snd_seq_tick_time_t position);
int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int base); int snd_seq_timer_set_position_time(struct snd_seq_timer *tmr, snd_seq_real_time_t position);
snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr); int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew, unsigned int base);
snd_seq_tick_time_t snd_seq_timer_get_cur_tick(seq_timer_t *tmr); snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr);
snd_seq_tick_time_t snd_seq_timer_get_cur_tick(struct snd_seq_timer *tmr);
#endif #endif
...@@ -56,7 +56,8 @@ MODULE_LICENSE("GPL"); ...@@ -56,7 +56,8 @@ MODULE_LICENSE("GPL");
/* /*
* initialize an event record * initialize an event record
*/ */
static void snd_virmidi_init_event(snd_virmidi_t *vmidi, snd_seq_event_t *ev) static void snd_virmidi_init_event(struct snd_virmidi *vmidi,
struct snd_seq_event *ev)
{ {
memset(ev, 0, sizeof(*ev)); memset(ev, 0, sizeof(*ev));
ev->source.port = vmidi->port; 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,16 +77,17 @@ static void snd_virmidi_init_event(snd_virmidi_t *vmidi, snd_seq_event_t *ev)
/* /*
* decode input event and put to read buffer of each opened file * decode input event and put to read buffer of each opened file
*/ */
static int snd_virmidi_dev_receive_event(snd_virmidi_dev_t *rdev, snd_seq_event_t *ev) static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,
struct snd_seq_event *ev)
{ {
snd_virmidi_t *vmidi; struct snd_virmidi *vmidi;
struct list_head *list; struct list_head *list;
unsigned char msg[4]; unsigned char msg[4];
int len; int len;
read_lock(&rdev->filelist_lock); read_lock(&rdev->filelist_lock);
list_for_each(list, &rdev->filelist) { list_for_each(list, &rdev->filelist) {
vmidi = list_entry(list, snd_virmidi_t, list); vmidi = list_entry(list, struct snd_virmidi, list);
if (!vmidi->trigger) if (!vmidi->trigger)
continue; continue;
if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { 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,9 +113,9 @@ static int snd_virmidi_dev_receive_event(snd_virmidi_dev_t *rdev, snd_seq_event_
* SNDRV_VIRMIDI_SEQ_ATTACH. * SNDRV_VIRMIDI_SEQ_ATTACH.
*/ */
#if 0 #if 0
int snd_virmidi_receive(snd_rawmidi_t *rmidi, snd_seq_event_t *ev) int snd_virmidi_receive(struct snd_rawmidi *rmidi, struct snd_seq_event *ev)
{ {
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
rdev = rmidi->private_data; rdev = rmidi->private_data;
return snd_virmidi_dev_receive_event(rdev, ev); 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,10 +125,10 @@ int snd_virmidi_receive(snd_rawmidi_t *rmidi, snd_seq_event_t *ev)
/* /*
* event handler of virmidi port * event handler of virmidi port
*/ */
static int snd_virmidi_event_input(snd_seq_event_t *ev, int direct, static int snd_virmidi_event_input(struct snd_seq_event *ev, int direct,
void *private_data, int atomic, int hop) void *private_data, int atomic, int hop)
{ {
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
rdev = private_data; rdev = private_data;
if (!(rdev->flags & SNDRV_VIRMIDI_USE)) if (!(rdev->flags & SNDRV_VIRMIDI_USE))
...@@ -137,9 +139,9 @@ static int snd_virmidi_event_input(snd_seq_event_t *ev, int direct, ...@@ -137,9 +139,9 @@ static int snd_virmidi_event_input(snd_seq_event_t *ev, int direct,
/* /*
* trigger rawmidi stream for input * trigger rawmidi stream for input
*/ */
static void snd_virmidi_input_trigger(snd_rawmidi_substream_t * substream, int up) static void snd_virmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
{ {
snd_virmidi_t *vmidi = substream->runtime->private_data; struct snd_virmidi *vmidi = substream->runtime->private_data;
if (up) { if (up) {
vmidi->trigger = 1; vmidi->trigger = 1;
...@@ -151,9 +153,9 @@ static void snd_virmidi_input_trigger(snd_rawmidi_substream_t * substream, int u ...@@ -151,9 +153,9 @@ static void snd_virmidi_input_trigger(snd_rawmidi_substream_t * substream, int u
/* /*
* trigger rawmidi stream for output * trigger rawmidi stream for output
*/ */
static void snd_virmidi_output_trigger(snd_rawmidi_substream_t * substream, int up) static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream, int up)
{ {
snd_virmidi_t *vmidi = substream->runtime->private_data; struct snd_virmidi *vmidi = substream->runtime->private_data;
int count, res; int count, res;
unsigned char buf[32], *pbuf; unsigned char buf[32], *pbuf;
...@@ -198,11 +200,11 @@ static void snd_virmidi_output_trigger(snd_rawmidi_substream_t * substream, int ...@@ -198,11 +200,11 @@ static void snd_virmidi_output_trigger(snd_rawmidi_substream_t * substream, int
/* /*
* open rawmidi handle for input * open rawmidi handle for input
*/ */
static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream) static int snd_virmidi_input_open(struct snd_rawmidi_substream *substream)
{ {
snd_virmidi_dev_t *rdev = substream->rmidi->private_data; struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
snd_virmidi_t *vmidi; struct snd_virmidi *vmidi;
unsigned long flags; unsigned long flags;
vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
...@@ -227,11 +229,11 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream) ...@@ -227,11 +229,11 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream)
/* /*
* open rawmidi handle for output * open rawmidi handle for output
*/ */
static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream) static int snd_virmidi_output_open(struct snd_rawmidi_substream *substream)
{ {
snd_virmidi_dev_t *rdev = substream->rmidi->private_data; struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
snd_virmidi_t *vmidi; struct snd_virmidi *vmidi;
vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
if (vmidi == NULL) if (vmidi == NULL)
...@@ -253,9 +255,9 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream) ...@@ -253,9 +255,9 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream)
/* /*
* close rawmidi handle for input * close rawmidi handle for input
*/ */
static int snd_virmidi_input_close(snd_rawmidi_substream_t * substream) static int snd_virmidi_input_close(struct snd_rawmidi_substream *substream)
{ {
snd_virmidi_t *vmidi = substream->runtime->private_data; struct snd_virmidi *vmidi = substream->runtime->private_data;
snd_midi_event_free(vmidi->parser); snd_midi_event_free(vmidi->parser);
list_del(&vmidi->list); list_del(&vmidi->list);
substream->runtime->private_data = NULL; substream->runtime->private_data = NULL;
...@@ -266,9 +268,9 @@ static int snd_virmidi_input_close(snd_rawmidi_substream_t * substream) ...@@ -266,9 +268,9 @@ static int snd_virmidi_input_close(snd_rawmidi_substream_t * substream)
/* /*
* close rawmidi handle for output * close rawmidi handle for output
*/ */
static int snd_virmidi_output_close(snd_rawmidi_substream_t * substream) static int snd_virmidi_output_close(struct snd_rawmidi_substream *substream)
{ {
snd_virmidi_t *vmidi = substream->runtime->private_data; struct snd_virmidi *vmidi = substream->runtime->private_data;
snd_midi_event_free(vmidi->parser); snd_midi_event_free(vmidi->parser);
substream->runtime->private_data = NULL; substream->runtime->private_data = NULL;
kfree(vmidi); kfree(vmidi);
...@@ -278,9 +280,10 @@ static int snd_virmidi_output_close(snd_rawmidi_substream_t * substream) ...@@ -278,9 +280,10 @@ static int snd_virmidi_output_close(snd_rawmidi_substream_t * substream)
/* /*
* subscribe callback - allow output to rawmidi device * subscribe callback - allow output to rawmidi device
*/ */
static int snd_virmidi_subscribe(void *private_data, snd_seq_port_subscribe_t *info) static int snd_virmidi_subscribe(void *private_data,
struct snd_seq_port_subscribe *info)
{ {
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
rdev = private_data; rdev = private_data;
if (!try_module_get(rdev->card->module)) 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,9 +295,10 @@ static int snd_virmidi_subscribe(void *private_data, snd_seq_port_subscribe_t *i
/* /*
* unsubscribe callback - disallow output to rawmidi device * unsubscribe callback - disallow output to rawmidi device
*/ */
static int snd_virmidi_unsubscribe(void *private_data, snd_seq_port_subscribe_t *info) static int snd_virmidi_unsubscribe(void *private_data,
struct snd_seq_port_subscribe *info)
{ {
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
rdev = private_data; rdev = private_data;
rdev->flags &= ~SNDRV_VIRMIDI_SUBSCRIBE; rdev->flags &= ~SNDRV_VIRMIDI_SUBSCRIBE;
...@@ -306,9 +310,10 @@ static int snd_virmidi_unsubscribe(void *private_data, snd_seq_port_subscribe_t ...@@ -306,9 +310,10 @@ static int snd_virmidi_unsubscribe(void *private_data, snd_seq_port_subscribe_t
/* /*
* use callback - allow input to rawmidi device * use callback - allow input to rawmidi device
*/ */
static int snd_virmidi_use(void *private_data, snd_seq_port_subscribe_t *info) static int snd_virmidi_use(void *private_data,
struct snd_seq_port_subscribe *info)
{ {
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
rdev = private_data; rdev = private_data;
if (!try_module_get(rdev->card->module)) 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,9 +325,10 @@ static int snd_virmidi_use(void *private_data, snd_seq_port_subscribe_t *info)
/* /*
* unuse callback - disallow input to rawmidi device * unuse callback - disallow input to rawmidi device
*/ */
static int snd_virmidi_unuse(void *private_data, snd_seq_port_subscribe_t *info) static int snd_virmidi_unuse(void *private_data,
struct snd_seq_port_subscribe *info)
{ {
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
rdev = private_data; rdev = private_data;
rdev->flags &= ~SNDRV_VIRMIDI_USE; rdev->flags &= ~SNDRV_VIRMIDI_USE;
...@@ -335,13 +341,13 @@ static int snd_virmidi_unuse(void *private_data, snd_seq_port_subscribe_t *info) ...@@ -335,13 +341,13 @@ static int snd_virmidi_unuse(void *private_data, snd_seq_port_subscribe_t *info)
* Register functions * Register functions
*/ */
static snd_rawmidi_ops_t snd_virmidi_input_ops = { static struct snd_rawmidi_ops snd_virmidi_input_ops = {
.open = snd_virmidi_input_open, .open = snd_virmidi_input_open,
.close = snd_virmidi_input_close, .close = snd_virmidi_input_close,
.trigger = snd_virmidi_input_trigger, .trigger = snd_virmidi_input_trigger,
}; };
static snd_rawmidi_ops_t snd_virmidi_output_ops = { static struct snd_rawmidi_ops snd_virmidi_output_ops = {
.open = snd_virmidi_output_open, .open = snd_virmidi_output_open,
.close = snd_virmidi_output_close, .close = snd_virmidi_output_close,
.trigger = snd_virmidi_output_trigger, .trigger = snd_virmidi_output_trigger,
...@@ -350,13 +356,13 @@ static snd_rawmidi_ops_t snd_virmidi_output_ops = { ...@@ -350,13 +356,13 @@ static snd_rawmidi_ops_t snd_virmidi_output_ops = {
/* /*
* create a sequencer client and a port * create a sequencer client and a port
*/ */
static int snd_virmidi_dev_attach_seq(snd_virmidi_dev_t *rdev) static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
{ {
int client; int client;
snd_seq_client_callback_t callbacks; struct snd_seq_client_callback callbacks;
snd_seq_port_callback_t pcallbacks; struct snd_seq_port_callback pcallbacks;
snd_seq_client_info_t *info; struct snd_seq_client_info *info;
snd_seq_port_info_t *pinfo; struct snd_seq_port_info *pinfo;
int err; int err;
if (rdev->client >= 0) if (rdev->client >= 0)
...@@ -426,7 +432,7 @@ static int snd_virmidi_dev_attach_seq(snd_virmidi_dev_t *rdev) ...@@ -426,7 +432,7 @@ static int snd_virmidi_dev_attach_seq(snd_virmidi_dev_t *rdev)
/* /*
* release the sequencer client * release the sequencer client
*/ */
static void snd_virmidi_dev_detach_seq(snd_virmidi_dev_t *rdev) static void snd_virmidi_dev_detach_seq(struct snd_virmidi_dev *rdev)
{ {
if (rdev->client >= 0) { if (rdev->client >= 0) {
snd_seq_delete_kernel_client(rdev->client); snd_seq_delete_kernel_client(rdev->client);
...@@ -437,9 +443,9 @@ static void snd_virmidi_dev_detach_seq(snd_virmidi_dev_t *rdev) ...@@ -437,9 +443,9 @@ static void snd_virmidi_dev_detach_seq(snd_virmidi_dev_t *rdev)
/* /*
* register the device * register the device
*/ */
static int snd_virmidi_dev_register(snd_rawmidi_t *rmidi) static int snd_virmidi_dev_register(struct snd_rawmidi *rmidi)
{ {
snd_virmidi_dev_t *rdev = rmidi->private_data; struct snd_virmidi_dev *rdev = rmidi->private_data;
int err; int err;
switch (rdev->seq_mode) { switch (rdev->seq_mode) {
...@@ -464,9 +470,9 @@ static int snd_virmidi_dev_register(snd_rawmidi_t *rmidi) ...@@ -464,9 +470,9 @@ static int snd_virmidi_dev_register(snd_rawmidi_t *rmidi)
/* /*
* unregister the device * unregister the device
*/ */
static int snd_virmidi_dev_unregister(snd_rawmidi_t *rmidi) static int snd_virmidi_dev_unregister(struct snd_rawmidi *rmidi)
{ {
snd_virmidi_dev_t *rdev = rmidi->private_data; struct snd_virmidi_dev *rdev = rmidi->private_data;
if (rdev->seq_mode == SNDRV_VIRMIDI_SEQ_DISPATCH) if (rdev->seq_mode == SNDRV_VIRMIDI_SEQ_DISPATCH)
snd_virmidi_dev_detach_seq(rdev); snd_virmidi_dev_detach_seq(rdev);
...@@ -476,7 +482,7 @@ static int snd_virmidi_dev_unregister(snd_rawmidi_t *rmidi) ...@@ -476,7 +482,7 @@ static int snd_virmidi_dev_unregister(snd_rawmidi_t *rmidi)
/* /*
* *
*/ */
static snd_rawmidi_global_ops_t snd_virmidi_global_ops = { static struct snd_rawmidi_global_ops snd_virmidi_global_ops = {
.dev_register = snd_virmidi_dev_register, .dev_register = snd_virmidi_dev_register,
.dev_unregister = snd_virmidi_dev_unregister, .dev_unregister = snd_virmidi_dev_unregister,
}; };
...@@ -484,9 +490,9 @@ static snd_rawmidi_global_ops_t snd_virmidi_global_ops = { ...@@ -484,9 +490,9 @@ static snd_rawmidi_global_ops_t snd_virmidi_global_ops = {
/* /*
* free device * free device
*/ */
static void snd_virmidi_free(snd_rawmidi_t *rmidi) static void snd_virmidi_free(struct snd_rawmidi *rmidi)
{ {
snd_virmidi_dev_t *rdev = rmidi->private_data; struct snd_virmidi_dev *rdev = rmidi->private_data;
kfree(rdev); kfree(rdev);
} }
...@@ -495,10 +501,10 @@ static void snd_virmidi_free(snd_rawmidi_t *rmidi) ...@@ -495,10 +501,10 @@ static void snd_virmidi_free(snd_rawmidi_t *rmidi)
* *
*/ */
/* exported */ /* exported */
int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi) int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
int err; int err;
*rrmidi = NULL; *rrmidi = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment