Skip to content

Commit eb7c06e

Browse files
ybelkaditiwai
authored andcommitted
ALSA: add/change some comments describing function return values
script/kernel-doc reports the following type of warnings (when run in verbose mode): Warning(sound/core/init.c:152): No description found for return value of 'snd_card_create' To fix that: - add missing descriptions of function return values - use "Return:" sections to describe those return values Along the way: - complete some descriptions - fix some typos Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent a817650 commit eb7c06e

24 files changed

Lines changed: 221 additions & 126 deletions

‎include/sound/control.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
189189
*
190190
* Add a virtual slave control to the given master element created via
191191
* snd_ctl_create_virtual_master() beforehand.
192-
* Returns zero if successful or a negative error code.
193192
*
194193
* All slaves must be the same type (returning the same information
195194
* via info callback). The function doesn't check it, so it's your
@@ -199,6 +198,8 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
199198
* at most two channels,
200199
* logarithmic volume control (dB level) thus no linear volume,
201200
* master can only attenuate the volume without gain
201+
*
202+
* Return: Zero if successful or a negative error code.
202203
*/
203204
static inline int
204205
snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
@@ -219,6 +220,8 @@ snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
219220
* When the control peeks the hardware values directly and the value
220221
* can be changed by other means than the put callback of the element,
221222
* this function should be used to keep the value always up-to-date.
223+
*
224+
* Return: Zero if successful or a negative error code.
222225
*/
223226
static inline int
224227
snd_ctl_add_slave_uncached(struct snd_kcontrol *master,

‎include/sound/core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card,
229229
* This function uses the card's device pointer to link to the
230230
* correct &struct device.
231231
*
232-
* Returns zero if successful, or a negative error code on failure.
232+
* Return: Zero if successful, or a negative error code on failure.
233233
*/
234234
static inline int snd_register_device(int type, struct snd_card *card, int dev,
235235
const struct file_operations *f_ops,

‎include/sound/pcm.h‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime
659659
*
660660
* Checks whether enough free space is available on the playback buffer.
661661
*
662-
* Returns non-zero if available, or zero if not.
662+
* Return: Non-zero if available, or zero if not.
663663
*/
664664
static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
665665
{
@@ -673,7 +673,7 @@ static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
673673
*
674674
* Checks whether enough capture data is available on the capture buffer.
675675
*
676-
* Returns non-zero if available, or zero if not.
676+
* Return: Non-zero if available, or zero if not.
677677
*/
678678
static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
679679
{
@@ -685,10 +685,10 @@ static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
685685
* snd_pcm_playback_data - check whether any data exists on the playback buffer
686686
* @substream: the pcm substream instance
687687
*
688-
* Checks whether any data exists on the playback buffer. If stop_threshold
689-
* is bigger or equal to boundary, then this function returns always non-zero.
688+
* Checks whether any data exists on the playback buffer.
690689
*
691-
* Returns non-zero if exists, or zero if not.
690+
* Return: Non-zero if any data exists, or zero if not. If stop_threshold
691+
* is bigger or equal to boundary, then this function returns always non-zero.
692692
*/
693693
static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
694694
{
@@ -705,7 +705,7 @@ static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
705705
*
706706
* Checks whether the playback buffer is empty.
707707
*
708-
* Returns non-zero if empty, or zero if not.
708+
* Return: Non-zero if empty, or zero if not.
709709
*/
710710
static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
711711
{
@@ -719,7 +719,7 @@ static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
719719
*
720720
* Checks whether the capture buffer is empty.
721721
*
722-
* Returns non-zero if empty, or zero if not.
722+
* Return: Non-zero if empty, or zero if not.
723723
*/
724724
static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
725725
{
@@ -852,7 +852,7 @@ int snd_pcm_format_big_endian(snd_pcm_format_t format);
852852
* snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
853853
* @format: the format to check
854854
*
855-
* Returns 1 if the given PCM format is CPU-endian, 0 if
855+
* Return: 1 if the given PCM format is CPU-endian, 0 if
856856
* opposite, or a negative error code if endian not specified.
857857
*/
858858
int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
@@ -963,7 +963,7 @@ struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
963963
* contiguous in kernel virtual space, but not in physical memory. Use this
964964
* if the buffer is accessed by kernel code but not by device DMA.
965965
*
966-
* Returns 1 if the buffer was changed, 0 if not changed, or a negative error
966+
* Return: 1 if the buffer was changed, 0 if not changed, or a negative error
967967
* code.
968968
*/
969969
static int snd_pcm_lib_alloc_vmalloc_buffer
@@ -975,6 +975,9 @@ static int snd_pcm_lib_alloc_vmalloc_buffer
975975
*
976976
* This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses
977977
* vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory.
978+
*
979+
* Return: 1 if the buffer was changed, 0 if not changed, or a negative error
980+
* code.
978981
*/
979982
static int snd_pcm_lib_alloc_vmalloc_32_buffer
980983
(struct snd_pcm_substream *substream, size_t size);
@@ -1070,6 +1073,8 @@ const char *snd_pcm_format_name(snd_pcm_format_t format);
10701073
/**
10711074
* snd_pcm_stream_str - Get a string naming the direction of a stream
10721075
* @substream: the pcm substream instance
1076+
*
1077+
* Return: A string naming the direction of the stream.
10731078
*/
10741079
static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
10751080
{

‎sound/core/control.c‎

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ EXPORT_SYMBOL(snd_ctl_notify);
190190
* Allocates a new struct snd_kcontrol instance and copies the given template
191191
* to the new instance. It does not copy volatile data (access).
192192
*
193-
* Returns the pointer of the new instance, or NULL on failure.
193+
* Return: The pointer of the new instance, or %NULL on failure.
194194
*/
195195
static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
196196
unsigned int access)
@@ -224,7 +224,7 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
224224
* template. When the access field of ncontrol is 0, it's assumed as
225225
* READWRITE access. When the count field is 0, it's assumes as one.
226226
*
227-
* Returns the pointer of the newly generated instance, or NULL on failure.
227+
* Return: The pointer of the newly generated instance, or %NULL on failure.
228228
*/
229229
struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
230230
void *private_data)
@@ -322,9 +322,10 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
322322
* snd_ctl_new1() to the given card. Assigns also an unique
323323
* numid used for fast search.
324324
*
325-
* Returns zero if successful, or a negative error code on failure.
326-
*
327325
* It frees automatically the control which cannot be added.
326+
*
327+
* Return: Zero if successful, or a negative error code on failure.
328+
*
328329
*/
329330
int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
330331
{
@@ -380,9 +381,9 @@ EXPORT_SYMBOL(snd_ctl_add);
380381
* and the add_on_replace flag is set, the control is added. If the
381382
* control exists, it is destroyed first.
382383
*
383-
* Returns zero if successful, or a negative error code on failure.
384-
*
385384
* It frees automatically the control which cannot be added or replaced.
385+
*
386+
* Return: Zero if successful, or a negative error code on failure.
386387
*/
387388
int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol,
388389
bool add_on_replace)
@@ -442,8 +443,8 @@ EXPORT_SYMBOL(snd_ctl_replace);
442443
* Removes the control from the card and then releases the instance.
443444
* You don't need to call snd_ctl_free_one(). You must be in
444445
* the write lock - down_write(&card->controls_rwsem).
445-
*
446-
* Returns 0 if successful, or a negative error code on failure.
446+
*
447+
* Return: 0 if successful, or a negative error code on failure.
447448
*/
448449
int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol)
449450
{
@@ -470,8 +471,8 @@ EXPORT_SYMBOL(snd_ctl_remove);
470471
*
471472
* Finds the control instance with the given id, removes it from the
472473
* card list and releases it.
473-
*
474-
* Returns 0 if successful, or a negative error code on failure.
474+
*
475+
* Return: 0 if successful, or a negative error code on failure.
475476
*/
476477
int snd_ctl_remove_id(struct snd_card *card, struct snd_ctl_elem_id *id)
477478
{
@@ -498,8 +499,8 @@ EXPORT_SYMBOL(snd_ctl_remove_id);
498499
*
499500
* Finds the control instance with the given id, removes it from the
500501
* card list and releases it.
501-
*
502-
* Returns 0 if successful, or a negative error code on failure.
502+
*
503+
* Return: 0 if successful, or a negative error code on failure.
503504
*/
504505
static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file,
505506
struct snd_ctl_elem_id *id)
@@ -541,7 +542,7 @@ static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file,
541542
* Finds the control instance with the given id, and activate or
542543
* inactivate the control together with notification, if changed.
543544
*
544-
* Returns 0 if unchanged, 1 if changed, or a negative error code on failure.
545+
* Return: 0 if unchanged, 1 if changed, or a negative error code on failure.
545546
*/
546547
int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id,
547548
int active)
@@ -587,7 +588,7 @@ EXPORT_SYMBOL_GPL(snd_ctl_activate_id);
587588
* Finds the control with the old id from the card, and replaces the
588589
* id with the new one.
589590
*
590-
* Returns zero if successful, or a negative error code on failure.
591+
* Return: Zero if successful, or a negative error code on failure.
591592
*/
592593
int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id,
593594
struct snd_ctl_elem_id *dst_id)
@@ -616,10 +617,11 @@ EXPORT_SYMBOL(snd_ctl_rename_id);
616617
*
617618
* Finds the control instance with the given number-id from the card.
618619
*
619-
* Returns the pointer of the instance if found, or NULL if not.
620-
*
621620
* The caller must down card->controls_rwsem before calling this function
622621
* (if the race condition can happen).
622+
*
623+
* Return: The pointer of the instance if found, or %NULL if not.
624+
*
623625
*/
624626
struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid)
625627
{
@@ -643,10 +645,11 @@ EXPORT_SYMBOL(snd_ctl_find_numid);
643645
*
644646
* Finds the control instance with the given id from the card.
645647
*
646-
* Returns the pointer of the instance if found, or NULL if not.
647-
*
648648
* The caller must down card->controls_rwsem before calling this function
649649
* (if the race condition can happen).
650+
*
651+
* Return: The pointer of the instance if found, or %NULL if not.
652+
*
650653
*/
651654
struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card,
652655
struct snd_ctl_elem_id *id)
@@ -1710,6 +1713,8 @@ EXPORT_SYMBOL(snd_ctl_boolean_stereo_info);
17101713
* Sets all required fields in @info to their appropriate values.
17111714
* If the control's accessibility is not the default (readable and writable),
17121715
* the caller has to fill @info->access.
1716+
*
1717+
* Return: Zero.
17131718
*/
17141719
int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
17151720
unsigned int items, const char *const names[])

‎sound/core/device.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* The data pointer plays a role as the identifier, too, so the
4040
* pointer address must be unique and unchanged.
4141
*
42-
* Returns zero if successful, or a negative error code on failure.
42+
* Return: Zero if successful, or a negative error code on failure.
4343
*/
4444
int snd_device_new(struct snd_card *card, snd_device_type_t type,
4545
void *device_data, struct snd_device_ops *ops)
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(snd_device_new);
7373
* callbacks, dev_disconnect and dev_free, corresponding to the state.
7474
* Then release the device.
7575
*
76-
* Returns zero if successful, or a negative error code on failure or if the
76+
* Return: Zero if successful, or a negative error code on failure or if the
7777
* device not found.
7878
*/
7979
int snd_device_free(struct snd_card *card, void *device_data)
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(snd_device_free);
116116
*
117117
* Usually called from snd_card_disconnect().
118118
*
119-
* Returns zero if successful, or a negative error code on failure or if the
119+
* Return: Zero if successful, or a negative error code on failure or if the
120120
* device not found.
121121
*/
122122
int snd_device_disconnect(struct snd_card *card, void *device_data)
@@ -151,7 +151,7 @@ int snd_device_disconnect(struct snd_card *card, void *device_data)
151151
* but it can be called later if any new devices are created after
152152
* invocation of snd_card_register().
153153
*
154-
* Returns zero if successful, or a negative error code on failure or if the
154+
* Return: Zero if successful, or a negative error code on failure or if the
155155
* device not found.
156156
*/
157157
int snd_device_register(struct snd_card *card, void *device_data)

‎sound/core/hwdep.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static const struct file_operations snd_hwdep_f_ops =
356356
* The callbacks (hwdep->ops) must be set on the returned instance
357357
* after this call manually by the caller.
358358
*
359-
* Returns zero if successful, or a negative error code on failure.
359+
* Return: Zero if successful, or a negative error code on failure.
360360
*/
361361
int snd_hwdep_new(struct snd_card *card, char *id, int device,
362362
struct snd_hwdep **rhwdep)

‎sound/core/info.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int resize_info_buffer(struct snd_info_buffer *buffer,
105105
*
106106
* Outputs the string on the procfs buffer just like printf().
107107
*
108-
* Returns the size of output string.
108+
* Return: The size of output string, or a negative error code.
109109
*/
110110
int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...)
111111
{
@@ -694,7 +694,7 @@ int snd_info_card_free(struct snd_card *card)
694694
*
695695
* Reads one line from the buffer and stores the string.
696696
*
697-
* Returns zero if successful, or 1 if error or EOF.
697+
* Return: Zero if successful, or 1 if error or EOF.
698698
*/
699699
int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len)
700700
{
@@ -735,7 +735,7 @@ EXPORT_SYMBOL(snd_info_get_line);
735735
* Parses the original string and copy a token to the given
736736
* string buffer.
737737
*
738-
* Returns the updated pointer of the original string so that
738+
* Return: The updated pointer of the original string so that
739739
* it can be used for the next call.
740740
*/
741741
const char *snd_info_get_str(char *dest, const char *src, int len)
@@ -774,7 +774,7 @@ EXPORT_SYMBOL(snd_info_get_str);
774774
* Usually called from other functions such as
775775
* snd_info_create_card_entry().
776776
*
777-
* Returns the pointer of the new instance, or NULL on failure.
777+
* Return: The pointer of the new instance, or %NULL on failure.
778778
*/
779779
static struct snd_info_entry *snd_info_create_entry(const char *name)
780780
{
@@ -803,7 +803,7 @@ static struct snd_info_entry *snd_info_create_entry(const char *name)
803803
*
804804
* Creates a new info entry and assigns it to the given module.
805805
*
806-
* Returns the pointer of the new instance, or NULL on failure.
806+
* Return: The pointer of the new instance, or %NULL on failure.
807807
*/
808808
struct snd_info_entry *snd_info_create_module_entry(struct module * module,
809809
const char *name,
@@ -827,7 +827,7 @@ EXPORT_SYMBOL(snd_info_create_module_entry);
827827
*
828828
* Creates a new info entry and assigns it to the given card.
829829
*
830-
* Returns the pointer of the new instance, or NULL on failure.
830+
* Return: The pointer of the new instance, or %NULL on failure.
831831
*/
832832
struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
833833
const char *name,
@@ -893,7 +893,7 @@ static int snd_info_dev_register_entry(struct snd_device *device)
893893
* For releasing this entry, use snd_device_free() instead of
894894
* snd_info_free_entry().
895895
*
896-
* Returns zero if successful, or a negative error code on failure.
896+
* Return: Zero if successful, or a negative error code on failure.
897897
*/
898898
int snd_card_proc_new(struct snd_card *card, const char *name,
899899
struct snd_info_entry **entryp)
@@ -949,7 +949,7 @@ EXPORT_SYMBOL(snd_info_free_entry);
949949
*
950950
* Registers the proc info entry.
951951
*
952-
* Returns zero if successful, or a negative error code on failure.
952+
* Return: Zero if successful, or a negative error code on failure.
953953
*/
954954
int snd_info_register(struct snd_info_entry * entry)
955955
{

0 commit comments

Comments
 (0)