summaryrefslogtreecommitdiffstats
path: root/sound/core/seq/seq_queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/seq/seq_queue.c')
-rw-r--r--sound/core/seq/seq_queue.c108
1 files changed, 59 insertions, 49 deletions
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 5f5c3cb37cb..9cf20f04554 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -29,7 +29,7 @@
* Aug. 30, 2000 Takashi Iwai
* - Queues are managed in static array again, but with better way.
* 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
* queuefree(ptr).
* - Addition of experimental sync support.
@@ -48,7 +48,7 @@
#include "seq_info.h"
/* 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);
/* number of queues allocated */
static int num_queues;
@@ -61,7 +61,7 @@ int snd_seq_queue_get_cur_queues(void)
/*----------------------------------------------------------------*/
/* 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;
unsigned long flags;
@@ -80,9 +80,9 @@ static int queue_list_add(queue_t *q)
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;
spin_lock_irqsave(&queue_list_lock, flags);
@@ -107,9 +107,9 @@ static queue_t *queue_list_remove(int id, int client)
/*----------------------------------------------------------------*/
/* 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);
if (q == NULL) {
@@ -142,7 +142,7 @@ static queue_t *queue_new(int owner, int locked)
}
/* delete queue (destructor) */
-static void queue_delete(queue_t *q)
+static void queue_delete(struct snd_seq_queue *q)
{
/* stop and release the timer */
snd_seq_timer_stop(q->timer);
@@ -187,7 +187,7 @@ void __exit snd_seq_queues_delete(void)
*/
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);
if (q == NULL)
@@ -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 */
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)
return -EINVAL;
@@ -218,9 +218,9 @@ int snd_seq_queue_delete(int client, int queueid)
/* 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;
if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES)
@@ -234,10 +234,10 @@ queue_t *queueptr(int queueid)
}
/* 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;
- queue_t *q;
+ struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) != NULL) {
@@ -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;
- snd_seq_event_cell_t *cell;
+ struct snd_seq_event_cell *cell;
if (q == NULL)
return;
@@ -273,7 +273,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
__again:
/* Process tick queue... */
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);
if (cell)
snd_seq_dispatch_event(cell, atomic, hop);
@@ -286,7 +287,8 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
/* Process time queue... */
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);
if (cell)
snd_seq_dispatch_event(cell, atomic, hop);
@@ -309,10 +311,10 @@ void snd_seq_check_queue(queue_t *q, int atomic, int hop)
/* 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;
- queue_t *q;
+ struct snd_seq_queue *q;
snd_assert(cell != NULL, return -EINVAL);
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)
break;
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;
}
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)
/*----------------------------------------------------------------*/
-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);
}
@@ -369,7 +372,7 @@ static inline int check_access(queue_t *q, int client)
/* check if the client has permission to modify queue parameters.
* 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;
int access_ok;
@@ -383,7 +386,7 @@ static int queue_access_lock(queue_t *q, int client)
}
/* 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;
@@ -395,7 +398,7 @@ static inline void queue_access_unlock(queue_t *q)
/* exported - only checking permission */
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;
unsigned long flags;
@@ -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)
{
- queue_t *q = queueptr(queueid);
+ struct snd_seq_queue *q = queueptr(queueid);
if (q == NULL)
return -EINVAL;
@@ -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 result = 0;
- queue_t *queue;
- seq_timer_t *tmr;
+ struct snd_seq_queue *queue;
+ struct snd_seq_timer *tmr;
queue = queueptr(queueid);
if (queue == NULL)
@@ -463,8 +466,8 @@ int snd_seq_queue_timer_open(int queueid)
*/
int snd_seq_queue_timer_close(int queueid)
{
- queue_t *queue;
- seq_timer_t *tmr;
+ struct snd_seq_queue *queue;
+ struct snd_seq_timer *tmr;
int result = 0;
queue = queueptr(queueid);
@@ -477,9 +480,10 @@ int snd_seq_queue_timer_close(int queueid)
}
/* 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;
if (q == NULL)
@@ -493,7 +497,8 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t
if (result >= 0)
result = snd_seq_timer_set_ppq(q->timer, info->ppq);
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);
queuefree(q);
return result;
@@ -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)
{
- queue_t *queue;
+ struct snd_seq_queue *queue;
queue = queueptr(queueid);
if (queue == NULL)
@@ -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)
{
- queue_t *q;
+ struct snd_seq_queue *q;
int result;
q = queueptr(queueid);
@@ -559,7 +564,7 @@ void snd_seq_queue_client_termination(int client)
{
unsigned long flags;
int i;
- queue_t *q;
+ struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL)
@@ -584,7 +589,7 @@ void snd_seq_queue_client_termination(int client)
void snd_seq_queue_client_leave(int client)
{
int i;
- queue_t *q;
+ struct snd_seq_queue *q;
/* delete own queues from queue list */
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
@@ -615,7 +620,7 @@ void snd_seq_queue_client_leave(int client)
void snd_seq_queue_client_leave_cells(int client)
{
int i;
- queue_t *q;
+ struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL)
@@ -627,10 +632,10 @@ void snd_seq_queue_client_leave_cells(int client)
}
/* 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;
- queue_t *q;
+ struct snd_seq_queue *q;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL)
@@ -650,9 +655,10 @@ void snd_seq_queue_remove_cells(int client, snd_seq_remove_events_t *info)
/*
* 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;
@@ -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.
* 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)
{
switch (ev->type) {
@@ -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:
* 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);
q = queueptr(ev->data.queue.queue);
@@ -749,13 +756,14 @@ int snd_seq_control_queue(snd_seq_event_t *ev, int atomic, int hop)
/*----------------------------------------------------------------*/
+#ifdef CONFIG_PROC_FS
/* exported to seq_info.c */
-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 i, bpm;
- queue_t *q;
- seq_timer_t *tmr;
+ struct snd_seq_queue *q;
+ struct snd_seq_timer *tmr;
for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
if ((q = queueptr(i)) == NULL)
@@ -782,3 +790,5 @@ void snd_seq_info_queues_read(snd_info_entry_t *entry,
queuefree(q);
}
}
+#endif /* CONFIG_PROC_FS */
+