-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Audio: Fix bad docs for codec helper functions #81799
Conversation
@@ -845,9 +845,9 @@ int bt_audio_codec_cfg_freq_hz_to_freq(uint32_t freq_hz); | |||
* @param codec_cfg The codec configuration to extract data from. | |||
* | |||
* @retval A @ref bt_audio_codec_cfg_freq value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this one
@@ -890,9 +890,9 @@ int bt_audio_codec_cfg_frame_dur_us_to_frame_dur(uint32_t frame_dur_us); | |||
* @param codec_cfg The codec configuration to extract data from. | |||
* | |||
* @retval A @ref bt_audio_codec_cfg_frame_dur value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
* @retval -EINVAL if arguments are invalid. | ||
* @retval The converted frequency value in Hz. | ||
* @retval -EINVAL Arguments are invalid. | ||
* @retval frequency The converted frequency value in Hz. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want this one listed first I think, i.e. the most likely return value first (applies throughout the PR)
Related, and since we don't have guidelines just yet and I very much value your thoughts on this topic and the fact we can use this PR as a way to settle on best practices for documenting return values, how about the "non-distinctive" value be described using @return
? Basically, this: https://docs.rtems.org/branches/master/eng/coding-doxygen.html#function-declarations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I take it you're not in favor of using @return
then? Or maybe there was too much info in my comment and you missed that part :)
* @retval frequency The converted frequency value in Hz. | |
* @return The converted frequency value in Hz. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about the "non-distinctive" value be described using @return
So this is suggesting to use @retval
for specific values, and @return
for values that may range?
So in this example this would be something like
* @retval -EINVAL Arguments are invalid.
*
* @return The converted frequency value in Hz.
I'm not opposed to it, depending on how it would render in the built docs :) It does make sense to only use @retval
for specific values. Speaking of, should we use - @ref EINVAL
? or add something like a @errno{EINVAL}
?
I think it makes sense to propose an RFC to discuss this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Speaking of, should we use
- @ref EINVAL
? or add something like a@errno{EINVAL}
?
Good question. Given that retval accepts ONE token representing the return value, the former likely won't work, and not sure about the latter either. That being said, I like the idea as making it easier to navigate to the list of available errnos can only be goodness.
+1 to address the next iteration (combining usage of @return
and @retval
) in a follow-up RFC
db24524
to
45b37e9
Compare
* @retval -EINVAL if arguments are invalid. | ||
* @retval The converted frequency value in Hz. | ||
* @retval -EINVAL Arguments are invalid. | ||
* @retval frequency The converted frequency value in Hz. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Speaking of, should we use
- @ref EINVAL
? or add something like a@errno{EINVAL}
?
Good question. Given that retval accepts ONE token representing the return value, the former likely won't work, and not sure about the latter either. That being said, I like the idea as making it easier to navigate to the list of available errnos can only be goodness.
+1 to address the next iteration (combining usage of @return
and @retval
) in a follow-up RFC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some nitpicks
@@ -869,8 +869,8 @@ int bt_audio_codec_cfg_set_freq(struct bt_audio_codec_cfg *codec_cfg, | |||
* | |||
* @param frame_dur The assigned numbers frame duration to convert. | |||
* | |||
* @retval -EINVAL if arguments are invalid. | |||
* @retval The converted frame duration value in microseconds. | |||
* @retval duraction The converted frame duration value in microseconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @retval duraction The converted frame duration value in microseconds. | |
* @retval duration The converted frame duration value in microseconds. |
* @retval -ENOMEM if the new value could not set or added due to memory | ||
* @retval data_len The data_len of @p codec_cfg on success | ||
* @retval -EINVAL Arguments are invalid | ||
* @retval -ENOMEM The new value could not set or added due to memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @retval -ENOMEM The new value could not set or added due to memory | |
* @retval -ENOMEM The new value could not be set or added due to lack of memory |
Same text change for the other places where -ENOMEM
is returned
@@ -777,8 +777,8 @@ int bt_audio_data_parse(const uint8_t ltv[], size_t size, | |||
* Any found data will be little endian. | |||
* | |||
* @retval Length The length of found @p data (may be 0). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not part of this PR, but using a lowercase l
is consistent with the parameter description in the other
fucntions
* @retval Length The length of found @p data (may be 0). | |
* @retval length The length of found @p data (may be 0). |
* @retval The data_len of @p codec_cfg on success | ||
* @retval -EINVAL if arguments are invalid | ||
* @retval -ENOMEM if the new value could not set or added due to memory | ||
* @retval data_len The data_len of @p codec_cfg on success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some other functions where the return value is len
the description says length of ...
, maybe the same should be done for data_len
and meta_len
, here and in other functions
* @retval data_len The data_len of @p codec_cfg on success | |
* @retval data_len The data length of @p codec_cfg on success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I get your point. data_len
length here refer to the data_len
field of codec_cfg
. Will rewrite a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, this too caught my eye fwiw :)
45b37e9
to
8cef66b
Compare
8cef66b
to
8d3e70e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nitpick, but nothing blocking
* @retval The meta_len of @p codec_cfg on success | ||
* @retval -EINVAL if arguments are invalid | ||
* @retval -ENOMEM if the new value could not set or added due to memory | ||
* @retval meta_len The meta_len of @p codec_cfg on success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we do the same as for the data_len field of codec_cfg?
* @retval meta_len The meta_len of @p codec_cfg on success | |
* @retval meta_len The @p codec_cfg.meta_len on success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, will update
@@ -1099,8 +1099,8 @@ int bt_audio_codec_cfg_meta_set_val(struct bt_audio_codec_cfg *codec_cfg, | |||
* @param codec_cfg The codec data to set the value in. | |||
* @param type The type id to unset. | |||
* | |||
* @retval The meta_len of @p codec_cfg on success | |||
* @retval -EINVAL if arguments are invalid | |||
* @retval meta_len The meta_len of @p codec_cfg on success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @retval meta_len The meta_len of @p codec_cfg on success | |
* @retval meta_len The @p codec_cfg.meta_len on success |
Several of the codec helper functions used @RetVal incorrectly Several functions referenced @ccid_list incorrectly Signed-off-by: Emil Gydesen <[email protected]>
8d3e70e
to
d4c6ee4
Compare
Several of the codec helper functions used @RetVal incorrectly Several functions referenced @ccid_list incorrectly