qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] hw/core/qdev: Make qdev_pass_gpios() arguments self-desc


From: Peter Maydell
Subject: Re: [PATCH 1/2] hw/core/qdev: Make qdev_pass_gpios() arguments self-describing
Date: Tue, 25 Aug 2020 16:00:24 +0100

On Tue, 18 Aug 2020 at 15:38, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Make the direction qdev_pass_gpios() pass the GPIOs more obvious
> by renaming its arguments as 'from_dev' and 'to_container'.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/qdev-core.h | 10 +++++-----
>  hw/core/qdev.c         | 14 +++++++-------
>  2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index ea3f73a282d..c72d4db2d26 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -643,8 +643,8 @@ static inline void qdev_init_gpio_in_named(DeviceState 
> *dev,
>
>  /**
>   * qdev_pass_gpios: create GPIO lines on container which pass through to 
> device

In the line above we say that the pass through is from the container
to the device...

> - * @dev: Device which has GPIO lines
> - * @container: Container device which needs to expose them
> + * @from_dev: Device which has GPIO lines
> + * @to_container: Container device which needs to expose them

...but here we say that it is from the device to the container.

You could make an argument for either convention of from/to,
but we should be consistent. The most useful part of the name
is the part we already have, because 'dev' vs 'container'
is unambiguous, whereas 'to' vs 'from' depends on your
point of view and doesn't really help in working out which
way round the arguments should go.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]