diff mbox

[1/3] media: v4l2-ctrls.h: better document the arguments for v4l2_ctrl_fill

Message ID 20170811061018.354590e3@vento.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab Aug. 11, 2017, 9:10 a.m. UTC
Em Fri, 11 Aug 2017 08:01:58 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> On 11/08/17 02:16, Mauro Carvalho Chehab wrote:
> > The arguments for this function are pointers. Make it clear at
> > its documentation.
> > 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> > ---
> >  include/media/v4l2-ctrls.h | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> > index 2d2aed56922f..6ba30acf06aa 100644
> > --- a/include/media/v4l2-ctrls.h
> > +++ b/include/media/v4l2-ctrls.h
> > @@ -339,18 +339,18 @@ struct v4l2_ctrl_config {
> >  /**
> >   * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
> >   *
> > - * @id: ID of the control
> > - * @name: name of the control
> > - * @type: type of the control
> > - * @min: minimum value for the control
> > - * @max: maximum value for the control
> > - * @step: control step
> > - * @def: default value for the control
> > - * @flags: flags to be used on the control
> > + * @id: pointer for storing the ID of the control  
> 
> id isn't a pointer, all other arguments are.
> 
> > + * @name: pointer for storing the name of the control  
> 
> This is a pointer to a pointer.

IMO, it is better to say that it is a pointer to a string.

> 
> > + * @type: pointer for storing the type of the control
> > + * @min: pointer for storing the minimum value for the control
> > + * @max: pointer for storing the maximum value for the control
> > + * @step: pointer for storing the control step
> > + * @def: pointer for storing the default value for the control
> > + * @flags: pointer for storing the flags to be used on the control
> >   *
> >   * This works for all standard V4L2 controls.
> >   * For non-standard controls it will only fill in the given arguments
> > - * and @name will be %NULL.
> > + * and @name content will be filled with %NULL.  
> 
> I'd say: 'set to %NULL'.
> 
> >   *
> >   * This function will overwrite the contents of @name, @type and @flags.
> >   * The contents of @min, @max, @step and @def may be modified depending on
> >   
> 
> Regards,
> 
> 	Hans

Thanks for reviewing. Version 2 follows.

---

[PATCH v2] media: v4l2-ctrls.h: better document the arguments for
 v4l2_ctrl_fill

The arguments for this function are pointers. Make it clear at
its documentation.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>



Thanks,
Mauro

Comments

Hans Verkuil Aug. 11, 2017, 9:35 a.m. UTC | #1
On 11/08/17 11:10, Mauro Carvalho Chehab wrote:
> Em Fri, 11 Aug 2017 08:01:58 +0200
> Hans Verkuil <hverkuil@xs4all.nl> escreveu:
> 
>> On 11/08/17 02:16, Mauro Carvalho Chehab wrote:
>>> The arguments for this function are pointers. Make it clear at
>>> its documentation.
>>>
>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
>>> ---
>>>  include/media/v4l2-ctrls.h | 18 +++++++++---------
>>>  1 file changed, 9 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
>>> index 2d2aed56922f..6ba30acf06aa 100644
>>> --- a/include/media/v4l2-ctrls.h
>>> +++ b/include/media/v4l2-ctrls.h
>>> @@ -339,18 +339,18 @@ struct v4l2_ctrl_config {
>>>  /**
>>>   * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
>>>   *
>>> - * @id: ID of the control
>>> - * @name: name of the control
>>> - * @type: type of the control
>>> - * @min: minimum value for the control
>>> - * @max: maximum value for the control
>>> - * @step: control step
>>> - * @def: default value for the control
>>> - * @flags: flags to be used on the control
>>> + * @id: pointer for storing the ID of the control  
>>
>> id isn't a pointer, all other arguments are.
>>
>>> + * @name: pointer for storing the name of the control  
>>
>> This is a pointer to a pointer.
> 
> IMO, it is better to say that it is a pointer to a string.
> 
>>
>>> + * @type: pointer for storing the type of the control
>>> + * @min: pointer for storing the minimum value for the control
>>> + * @max: pointer for storing the maximum value for the control
>>> + * @step: pointer for storing the control step
>>> + * @def: pointer for storing the default value for the control
>>> + * @flags: pointer for storing the flags to be used on the control
>>>   *
>>>   * This works for all standard V4L2 controls.
>>>   * For non-standard controls it will only fill in the given arguments
>>> - * and @name will be %NULL.
>>> + * and @name content will be filled with %NULL.  
>>
>> I'd say: 'set to %NULL'.
>>
>>>   *
>>>   * This function will overwrite the contents of @name, @type and @flags.
>>>   * The contents of @min, @max, @step and @def may be modified depending on
>>>   
>>
>> Regards,
>>
>> 	Hans
> 
> Thanks for reviewing. Version 2 follows.
> 
> ---
> 
> [PATCH v2] media: v4l2-ctrls.h: better document the arguments for
>  v4l2_ctrl_fill
> 
> The arguments for this function are pointers. Make it clear at
> its documentation.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> 
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index 2d2aed56922f..044ea9bc83a8 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -340,17 +340,19 @@ struct v4l2_ctrl_config {
>   * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
>   *
>   * @id: ID of the control
> - * @name: name of the control
> - * @type: type of the control
> - * @min: minimum value for the control
> - * @max: maximum value for the control
> - * @step: control step
> - * @def: default value for the control
> - * @flags: flags to be used on the control
> + * @name: pointer to be filled with a string with the name of the control
> + * @type: pointer for storing the type of the control
> + * @min: pointer for storing the minimum value for the control
> + * @max: pointer for storing the maximum value for the control
> + * @step: pointer for storing the control step
> + * @def: pointer for storing the default value for the control
> + * @flags: pointer for storing the flags to be used on the control
>   *
>   * This works for all standard V4L2 controls.
>   * For non-standard controls it will only fill in the given arguments
> - * and @name will be %NULL.
> + * and @name content will be set to %NULL.
> + *
> + * if @name is NULL, only the @type will be filled.

Not quite correct, I'd say:

* if @name is NULL, then @type is set to V4L2_CTRL_TYPE_INTEGER and @flags to 0.

Regards,

	Hans

>   *
>   * This function will overwrite the contents of @name, @type and @flags.
>   * The contents of @min, @max, @step and @def may be modified depending on
> 
> 
> Thanks,
> Mauro
>
diff mbox

Patch

diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 2d2aed56922f..044ea9bc83a8 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -340,17 +340,19 @@  struct v4l2_ctrl_config {
  * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
  *
  * @id: ID of the control
- * @name: name of the control
- * @type: type of the control
- * @min: minimum value for the control
- * @max: maximum value for the control
- * @step: control step
- * @def: default value for the control
- * @flags: flags to be used on the control
+ * @name: pointer to be filled with a string with the name of the control
+ * @type: pointer for storing the type of the control
+ * @min: pointer for storing the minimum value for the control
+ * @max: pointer for storing the maximum value for the control
+ * @step: pointer for storing the control step
+ * @def: pointer for storing the default value for the control
+ * @flags: pointer for storing the flags to be used on the control
  *
  * This works for all standard V4L2 controls.
  * For non-standard controls it will only fill in the given arguments
- * and @name will be %NULL.
+ * and @name content will be set to %NULL.
+ *
+ * if @name is NULL, only the @type will be filled.
  *
  * This function will overwrite the contents of @name, @type and @flags.
  * The contents of @min, @max, @step and @def may be modified depending on