Skip to content

Commit f69c286

Browse files
committed
ALSA: pcm: Define snd_pcm_mmap_data_{open|close}() locally
snd_pcm_mmap_data_open() and _close() are defined as inline functions in the public sound/pcm.h, but those are used only locally in pcm_native.c, hence they should be better placed there. Also, those are referred as callbacks, the useless inline is dropped. Link: https://patch.msgid.link/20241113111628.17069-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 8f80f37 commit f69c286

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

include/sound/pcm.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,30 +1393,6 @@ snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
13931393
return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size);
13941394
}
13951395

1396-
/**
1397-
* snd_pcm_mmap_data_open - increase the mmap counter
1398-
* @area: VMA
1399-
*
1400-
* PCM mmap callback should handle this counter properly
1401-
*/
1402-
static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
1403-
{
1404-
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1405-
atomic_inc(&substream->mmap_count);
1406-
}
1407-
1408-
/**
1409-
* snd_pcm_mmap_data_close - decrease the mmap counter
1410-
* @area: VMA
1411-
*
1412-
* PCM mmap callback should handle this counter properly
1413-
*/
1414-
static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
1415-
{
1416-
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1417-
atomic_dec(&substream->mmap_count);
1418-
}
1419-
14201396
int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
14211397
struct vm_area_struct *area);
14221398
/* mmap for io-memory area */

sound/core/pcm_native.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,6 +3773,26 @@ static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file
37733773
}
37743774
#endif /* coherent mmap */
37753775

3776+
/*
3777+
* snd_pcm_mmap_data_open - increase the mmap counter
3778+
*/
3779+
static void snd_pcm_mmap_data_open(struct vm_area_struct *area)
3780+
{
3781+
struct snd_pcm_substream *substream = area->vm_private_data;
3782+
3783+
atomic_inc(&substream->mmap_count);
3784+
}
3785+
3786+
/*
3787+
* snd_pcm_mmap_data_close - decrease the mmap counter
3788+
*/
3789+
static void snd_pcm_mmap_data_close(struct vm_area_struct *area)
3790+
{
3791+
struct snd_pcm_substream *substream = area->vm_private_data;
3792+
3793+
atomic_dec(&substream->mmap_count);
3794+
}
3795+
37763796
/*
37773797
* fault callback for mmapping a RAM page
37783798
*/

0 commit comments

Comments
 (0)