]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ALSA: pcm: Define snd_pcm_mmap_data_{open|close}() locally
authorTakashi Iwai <tiwai@suse.de>
Wed, 13 Nov 2024 11:16:27 +0000 (12:16 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 13 Nov 2024 12:33:28 +0000 (13:33 +0100)
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>
include/sound/pcm.h
sound/core/pcm_native.c

index ef9cbeaf37849eb94c2ec8bc68142aa5a150227c..67c99ffbf51b9bd0f8a8493f55973c68621f189a 100644 (file)
@@ -1393,30 +1393,6 @@ snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
        return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size);
 }
 
-/**
- * snd_pcm_mmap_data_open - increase the mmap counter
- * @area: VMA
- *
- * PCM mmap callback should handle this counter properly
- */
-static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
-{
-       struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
-       atomic_inc(&substream->mmap_count);
-}
-
-/**
- * snd_pcm_mmap_data_close - decrease the mmap counter
- * @area: VMA
- *
- * PCM mmap callback should handle this counter properly
- */
-static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
-{
-       struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
-       atomic_dec(&substream->mmap_count);
-}
-
 int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
                             struct vm_area_struct *area);
 /* mmap for io-memory area */
index b465fb6e1f5f0da620c21724428ea7d6432db1ed..47027fa4eb2827cfa1ee2d99fdfcdb21c33e5150 100644 (file)
@@ -3773,6 +3773,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
  */