summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-11-13 12:16:27 +0100
committerTakashi Iwai <tiwai@suse.de>2024-11-13 13:33:28 +0100
commitf69c2861b05e29c69abed6aafe0cefd224d9d4db (patch)
treece5843608d2682dd76613db6ff47d82217558af3 /sound/core
parent8f80f378e77eafdcdb7ea9a76cc645ecd04fb4e5 (diff)
downloadlinux-stable-f69c2861b05e29c69abed6aafe0cefd224d9d4db.tar.gz
linux-stable-f69c2861b05e29c69abed6aafe0cefd224d9d4db.tar.bz2
linux-stable-f69c2861b05e29c69abed6aafe0cefd224d9d4db.zip
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>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_native.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index b465fb6e1f5f..47027fa4eb28 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3774,6 +3774,26 @@ static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file
#endif /* coherent mmap */
/*
+ * snd_pcm_mmap_data_open - increase the mmap counter
+ */
+static void snd_pcm_mmap_data_open(struct vm_area_struct *area)
+{
+ struct snd_pcm_substream *substream = area->vm_private_data;
+
+ atomic_inc(&substream->mmap_count);
+}
+
+/*
+ * snd_pcm_mmap_data_close - decrease the mmap counter
+ */
+static void snd_pcm_mmap_data_close(struct vm_area_struct *area)
+{
+ struct snd_pcm_substream *substream = area->vm_private_data;
+
+ atomic_dec(&substream->mmap_count);
+}
+
+/*
* fault callback for mmapping a RAM page
*/
static vm_fault_t snd_pcm_mmap_data_fault(struct vm_fault *vmf)