Skip to content

Commit d0c8308

Browse files
committed
ALSA: seq: Treat snd_seq_client object directly in client drivers
Introduce the new helpers, snd_seq_kernel_client_get() and _put() for kernel client drivers to treat the snd_seq_client more directly. This allows us to reduce the exported symbols and APIs at each time we need to access some field in future. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-20-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ea46f79 commit d0c8308

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

sound/core/seq/seq_clientmgr.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,6 +2390,21 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table
23902390
}
23912391
EXPORT_SYMBOL(snd_seq_kernel_client_write_poll);
23922392

2393+
/* get a sequencer client object; for internal use from a kernel client */
2394+
struct snd_seq_client *snd_seq_kernel_client_get(int id)
2395+
{
2396+
return snd_seq_client_use_ptr(id);
2397+
}
2398+
EXPORT_SYMBOL_GPL(snd_seq_kernel_client_get);
2399+
2400+
/* put a sequencer client object; for internal use from a kernel client */
2401+
void snd_seq_kernel_client_put(struct snd_seq_client *cptr)
2402+
{
2403+
if (cptr)
2404+
snd_seq_client_unlock(cptr);
2405+
}
2406+
EXPORT_SYMBOL_GPL(snd_seq_kernel_client_put);
2407+
23932408
/*---------------------------------------------------------------------------*/
23942409

23952410
#ifdef CONFIG_SND_PROC_FS

sound/core/seq/seq_clientmgr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,8 @@ void snd_seq_client_ioctl_unlock(int clientid);
8888

8989
extern int seq_client_load[15];
9090

91+
/* for internal use between kernel sequencer clients */
92+
struct snd_seq_client *snd_seq_kernel_client_get(int client);
93+
void snd_seq_kernel_client_put(struct snd_seq_client *cptr);
94+
9195
#endif

0 commit comments

Comments
 (0)