Skip to content

Commit 6740ea6

Browse files
committed
ALSA: seq: Simplify snd_seq_kernel_client_enqueue() helper
We have two helpers for queuing a sequencer event from the kernel client, and both are used only from OSS sequencer layer without any hop and atomic set. Let's simplify and unify two helpers into one. No functional change, just a call pattern change. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 7c32ae3 commit 6740ea6

5 files changed

Lines changed: 14 additions & 43 deletions

File tree

‎include/sound/seq_kernel.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ __printf(3, 4)
7373
int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
7474
const char *name_fmt, ...);
7575
int snd_seq_delete_kernel_client(int client);
76-
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
76+
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
77+
struct file *file, bool blocking);
7778
int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
7879
int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
7980

‎sound/core/seq/oss/seq_oss_rw.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,11 @@ insert_queue(struct seq_oss_devinfo *dp, union evrec *rec, struct file *opt)
180180
return 0; /* invalid event - no need to insert queue */
181181

182182
event.time.tick = snd_seq_oss_timer_cur_tick(dp->timer);
183-
if (dp->timer->realtime || !dp->timer->running) {
183+
if (dp->timer->realtime || !dp->timer->running)
184184
snd_seq_oss_dispatch(dp, &event, 0, 0);
185-
} else {
186-
if (is_nonblock_mode(dp->file_mode))
187-
rc = snd_seq_kernel_client_enqueue(dp->cseq, &event, 0, 0);
188-
else
189-
rc = snd_seq_kernel_client_enqueue_blocking(dp->cseq, &event, opt, 0, 0);
190-
}
185+
else
186+
rc = snd_seq_kernel_client_enqueue(dp->cseq, &event, opt,
187+
!is_nonblock_mode(dp->file_mode));
191188
return rc;
192189
}
193190

‎sound/core/seq/oss/seq_oss_writeq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ snd_seq_oss_writeq_sync(struct seq_oss_writeq *q)
116116
rec->t.code = SEQ_SYNCTIMER;
117117
rec->t.time = time;
118118
q->sync_event_put = 1;
119-
snd_seq_kernel_client_enqueue_blocking(dp->cseq, &ev, NULL, 0, 0);
119+
snd_seq_kernel_client_enqueue(dp->cseq, &ev, NULL, true);
120120
}
121121

122122
wait_event_interruptible_timeout(q->sync_sleep, ! q->sync_event_put, HZ);

‎sound/core/seq/seq_clientmgr.c‎

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,12 +2218,13 @@ int snd_seq_delete_kernel_client(int client)
22182218
}
22192219
EXPORT_SYMBOL(snd_seq_delete_kernel_client);
22202220

2221-
/* skeleton to enqueue event, called from snd_seq_kernel_client_enqueue
2222-
* and snd_seq_kernel_client_enqueue_blocking
2221+
/*
2222+
* exported, called by kernel clients to enqueue events (w/o blocking)
2223+
*
2224+
* RETURN VALUE: zero if succeed, negative if error
22232225
*/
2224-
static int kernel_client_enqueue(int client, struct snd_seq_event *ev,
2225-
struct file *file, int blocking,
2226-
int atomic, int hop)
2226+
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
2227+
struct file *file, bool blocking)
22272228
{
22282229
struct snd_seq_client *cptr;
22292230
int result;
@@ -2250,37 +2251,13 @@ static int kernel_client_enqueue(int client, struct snd_seq_event *ev,
22502251
result = -EPERM;
22512252
else /* send it */
22522253
result = snd_seq_client_enqueue_event(cptr, ev, file, blocking,
2253-
atomic, hop, NULL);
2254+
false, 0, NULL);
22542255

22552256
snd_seq_client_unlock(cptr);
22562257
return result;
22572258
}
2258-
2259-
/*
2260-
* exported, called by kernel clients to enqueue events (w/o blocking)
2261-
*
2262-
* RETURN VALUE: zero if succeed, negative if error
2263-
*/
2264-
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event * ev,
2265-
int atomic, int hop)
2266-
{
2267-
return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop);
2268-
}
22692259
EXPORT_SYMBOL(snd_seq_kernel_client_enqueue);
22702260

2271-
/*
2272-
* exported, called by kernel clients to enqueue events (with blocking)
2273-
*
2274-
* RETURN VALUE: zero if succeed, negative if error
2275-
*/
2276-
int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
2277-
struct file *file,
2278-
int atomic, int hop)
2279-
{
2280-
return kernel_client_enqueue(client, ev, file, 1, atomic, hop);
2281-
}
2282-
EXPORT_SYMBOL(snd_seq_kernel_client_enqueue_blocking);
2283-
22842261
/*
22852262
* exported, called by kernel clients to dispatch events directly to other
22862263
* clients, bypassing the queues. Event time-stamp will be updated.

‎sound/core/seq/seq_clientmgr.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
9393
/* dispatch event to client(s) */
9494
int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
9595

96-
/* exported to other modules */
97-
int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
98-
int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
99-
struct file *file, int atomic, int hop);
10096
int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
10197
int snd_seq_client_notify_subscription(int client, int port,
10298
struct snd_seq_port_subscribe *info, int evtype);

0 commit comments

Comments
 (0)