[PATCH] qdev: Complete qdev_init_gpio_out() documentation

Philippe Mathieu-Daudé posted 1 patch 2 years, 8 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210819142731.2827912-1-philmd@redhat.com
include/hw/qdev-core.h | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] qdev: Complete qdev_init_gpio_out() documentation
Posted by Philippe Mathieu-Daudé 2 years, 8 months ago
qdev_init_gpio_out() states it "creates an array of anonymous
output GPIO lines" but doesn't document how this array is
released. Add a note that it is automatically free'd in qdev
instance_finalize().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/hw/qdev-core.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bafc311bfa1..555d4e444a5 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -597,6 +597,10 @@ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
  *
  * See qdev_connect_gpio_out() for how code that uses such a device
  * can connect to one of its output GPIO lines.
+ *
+ * There is no need to release the @pins allocated array because it
+ * will be automatically released when @dev calls its instance_finalize()
+ * handler.
  */
 void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);
 /**
-- 
2.31.1

Re: [PATCH] qdev: Complete qdev_init_gpio_out() documentation
Posted by Peter Maydell 2 years, 8 months ago
On Thu, 19 Aug 2021 at 15:27, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> qdev_init_gpio_out() states it "creates an array of anonymous
> output GPIO lines" but doesn't document how this array is
> released. Add a note that it is automatically free'd in qdev
> instance_finalize().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/hw/qdev-core.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index bafc311bfa1..555d4e444a5 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -597,6 +597,10 @@ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
>   *
>   * See qdev_connect_gpio_out() for how code that uses such a device
>   * can connect to one of its output GPIO lines.
> + *
> + * There is no need to release the @pins allocated array because it
> + * will be automatically released when @dev calls its instance_finalize()
> + * handler.
>   */
>  void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);
>  /**

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

Re: [PATCH] qdev: Complete qdev_init_gpio_out() documentation
Posted by Markus Armbruster 2 years, 8 months ago
Cc: qemu-trivial

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> qdev_init_gpio_out() states it "creates an array of anonymous
> output GPIO lines" but doesn't document how this array is
> released. Add a note that it is automatically free'd in qdev
> instance_finalize().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/hw/qdev-core.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index bafc311bfa1..555d4e444a5 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -597,6 +597,10 @@ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
>   *
>   * See qdev_connect_gpio_out() for how code that uses such a device
>   * can connect to one of its output GPIO lines.
> + *
> + * There is no need to release the @pins allocated array because it
> + * will be automatically released when @dev calls its instance_finalize()
> + * handler.
>   */
>  void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);
>  /**


Re: [PATCH] qdev: Complete qdev_init_gpio_out() documentation
Posted by Laurent Vivier 2 years, 7 months ago
Le 01/09/2021 à 13:19, Markus Armbruster a écrit :
> Cc: qemu-trivial
> 
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
>> qdev_init_gpio_out() states it "creates an array of anonymous
>> output GPIO lines" but doesn't document how this array is
>> released. Add a note that it is automatically free'd in qdev
>> instance_finalize().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  include/hw/qdev-core.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>> index bafc311bfa1..555d4e444a5 100644
>> --- a/include/hw/qdev-core.h
>> +++ b/include/hw/qdev-core.h
>> @@ -597,6 +597,10 @@ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
>>   *
>>   * See qdev_connect_gpio_out() for how code that uses such a device
>>   * can connect to one of its output GPIO lines.
>> + *
>> + * There is no need to release the @pins allocated array because it
>> + * will be automatically released when @dev calls its instance_finalize()
>> + * handler.
>>   */
>>  void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);
>>  /**
> 
> 

Applied to my trivial-patches branch.

Thanks,
Laurent