Commit bb580602 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: pcm: Define snd_pcm_lib_preallocate_*() as returning void

Now all callers no longer check the return value from
snd_pcm_lib_preallocate_pages() and co, let's make them to return
void, so that any new code won't fall into the same pitfall.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 95d14640
...@@ -1185,12 +1185,12 @@ static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, ...@@ -1185,12 +1185,12 @@ static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
* Memory * Memory
*/ */
int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data, int type, struct device *data,
size_t size, size_t max); size_t size, size_t max);
int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
int type, void *data, int type, void *data,
size_t size, size_t max); size_t size, size_t max);
int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
......
...@@ -87,13 +87,10 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream ...@@ -87,13 +87,10 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream
* @substream: the pcm substream instance * @substream: the pcm substream instance
* *
* Releases the pre-allocated buffer of the given substream. * Releases the pre-allocated buffer of the given substream.
*
* Return: Zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
{ {
snd_pcm_lib_preallocate_dma_free(substream); snd_pcm_lib_preallocate_dma_free(substream);
return 0;
} }
/** /**
...@@ -101,10 +98,8 @@ int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) ...@@ -101,10 +98,8 @@ int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
* @pcm: the pcm instance * @pcm: the pcm instance
* *
* Releases all the pre-allocated buffers on the given pcm. * Releases all the pre-allocated buffers on the given pcm.
*
* Return: Zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm)
{ {
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
int stream; int stream;
...@@ -112,7 +107,6 @@ int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) ...@@ -112,7 +107,6 @@ int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm)
for (stream = 0; stream < 2; stream++) for (stream = 0; stream < 2; stream++)
for (substream = pcm->streams[stream].substream; substream; substream = substream->next) for (substream = pcm->streams[stream].substream; substream; substream = substream->next)
snd_pcm_lib_preallocate_free(substream); snd_pcm_lib_preallocate_free(substream);
return 0;
} }
EXPORT_SYMBOL(snd_pcm_lib_preallocate_free_for_all); EXPORT_SYMBOL(snd_pcm_lib_preallocate_free_for_all);
...@@ -214,7 +208,7 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream) ...@@ -214,7 +208,7 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
/* /*
* pre-allocate the buffer and create a proc file for the substream * pre-allocate the buffer and create a proc file for the substream
*/ */
static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, static void snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
size_t size, size_t max) size_t size, size_t max)
{ {
...@@ -225,7 +219,6 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, ...@@ -225,7 +219,6 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
substream->buffer_bytes_max = substream->dma_buffer.bytes; substream->buffer_bytes_max = substream->dma_buffer.bytes;
substream->dma_max = max; substream->dma_max = max;
preallocate_info_init(substream); preallocate_info_init(substream);
return 0;
} }
...@@ -238,16 +231,14 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, ...@@ -238,16 +231,14 @@ static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
* @max: the max. allowed pre-allocation size * @max: the max. allowed pre-allocation size
* *
* Do pre-allocation for the given DMA buffer type. * Do pre-allocation for the given DMA buffer type.
*
* Return: Zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data, int type, struct device *data,
size_t size, size_t max) size_t size, size_t max)
{ {
substream->dma_buffer.dev.type = type; substream->dma_buffer.dev.type = type;
substream->dma_buffer.dev.dev = data; substream->dma_buffer.dev.dev = data;
return snd_pcm_lib_preallocate_pages1(substream, size, max); snd_pcm_lib_preallocate_pages1(substream, size, max);
} }
EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages); EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages);
...@@ -261,21 +252,17 @@ EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages); ...@@ -261,21 +252,17 @@ EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages);
* *
* Do pre-allocation to all substreams of the given pcm for the * Do pre-allocation to all substreams of the given pcm for the
* specified DMA type. * specified DMA type.
*
* Return: Zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
int type, void *data, int type, void *data,
size_t size, size_t max) size_t size, size_t max)
{ {
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
int stream, err; int stream;
for (stream = 0; stream < 2; stream++) for (stream = 0; stream < 2; stream++)
for (substream = pcm->streams[stream].substream; substream; substream = substream->next) for (substream = pcm->streams[stream].substream; substream; substream = substream->next)
if ((err = snd_pcm_lib_preallocate_pages(substream, type, data, size, max)) < 0) snd_pcm_lib_preallocate_pages(substream, type, data, size, max);
return err;
return 0;
} }
EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages_for_all); EXPORT_SYMBOL(snd_pcm_lib_preallocate_pages_for_all);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment