All of lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH 0/2] ALSA: pcm: minor enhancements
@ 2019-11-05 19:10 Takashi Iwai
  2019-11-05 19:10 ` [alsa-devel] [PATCH 1/2] ALSA: pcm: Warn if doubly preallocated Takashi Iwai
  2019-11-05 19:10 ` [alsa-devel] [PATCH 2/2] ALSA: pcm: Create proc files only for non-empty preallocations Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Takashi Iwai @ 2019-11-05 19:10 UTC (permalink / raw)
  To: alsa-devel

Hi,

here are a couple of more small enhnacements on PCM memory allocation
stuff.


Takashi

===

Takashi Iwai (2):
  ALSA: pcm: Warn if doubly preallocated
  ALSA: pcm: Create proc files only for non-empty preallocations

 sound/core/pcm_memory.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [alsa-devel] [PATCH 1/2] ALSA: pcm: Warn if doubly preallocated
  2019-11-05 19:10 [alsa-devel] [PATCH 0/2] ALSA: pcm: minor enhancements Takashi Iwai
@ 2019-11-05 19:10 ` Takashi Iwai
  2019-11-05 19:10 ` [alsa-devel] [PATCH 2/2] ALSA: pcm: Create proc files only for non-empty preallocations Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2019-11-05 19:10 UTC (permalink / raw)
  To: alsa-devel

Warn if snd_pcm_lib_preallocate_pages*() is applied to the stream that
has already the preallocated buffers and skip the allocation.  It's a
clearly a driver bug.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/pcm_memory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 7600dcdf5fd4..19407f79b638 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -221,6 +221,8 @@ void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
 				  int type, struct device *data,
 				  size_t size, size_t max)
 {
+	if (snd_BUG_ON(substream->dma_buffer.dev.type))
+		return;
 	substream->dma_buffer.dev.type = type;
 	substream->dma_buffer.dev.dev = data;
 	snd_pcm_lib_preallocate_pages1(substream, size, max);
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [alsa-devel] [PATCH 2/2] ALSA: pcm: Create proc files only for non-empty preallocations
  2019-11-05 19:10 [alsa-devel] [PATCH 0/2] ALSA: pcm: minor enhancements Takashi Iwai
  2019-11-05 19:10 ` [alsa-devel] [PATCH 1/2] ALSA: pcm: Warn if doubly preallocated Takashi Iwai
@ 2019-11-05 19:10 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2019-11-05 19:10 UTC (permalink / raw)
  To: alsa-devel

It makes little sense to create prealloc proc files for streams that
have the zero max size, which is a typical case for vmalloc buffers.
Skip the proc file creations to save resources in such a case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/pcm_memory.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 19407f79b638..17ee361ce791 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -203,7 +203,8 @@ static void snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
 	if (substream->dma_buffer.bytes > 0)
 		substream->buffer_bytes_max = substream->dma_buffer.bytes;
 	substream->dma_max = max;
-	preallocate_info_init(substream);
+	if (max > 0)
+		preallocate_info_init(substream);
 }
 
 
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-05 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 19:10 [alsa-devel] [PATCH 0/2] ALSA: pcm: minor enhancements Takashi Iwai
2019-11-05 19:10 ` [alsa-devel] [PATCH 1/2] ALSA: pcm: Warn if doubly preallocated Takashi Iwai
2019-11-05 19:10 ` [alsa-devel] [PATCH 2/2] ALSA: pcm: Create proc files only for non-empty preallocations Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.