qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "QEMU Trivial" <qemu-trivial@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Eduardo Habkost" <ehabkost@redhat.com>
Subject: Re: [PATCH 2/2] hw/core/sysbus: Make sysbus_pass_irq() arguments self-describing
Date: Tue, 25 Aug 2020 16:04:39 +0100	[thread overview]
Message-ID: <CAFEAcA8fbA0XKEHzMtTOmkzHCN7ji__wB+22uKTAp0-UAgEjEg@mail.gmail.com> (raw)
In-Reply-To: <20200818143825.691110-3-f4bug@amsat.org>

On Tue, 18 Aug 2020 at 15:38, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Make the direction sysbus_pass_irq() pass the GPIOs more obvious
> by renaming its arguments as 'from_dev' and 'to_dev'.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/sysbus.h | 7 ++++++-
>  hw/core/sysbus.c    | 5 ++---
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
> index da9f85c58ce..65de6f6b062 100644
> --- a/include/hw/sysbus.h
> +++ b/include/hw/sysbus.h
> @@ -73,7 +73,12 @@ typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
>  void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
>  MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
>  void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
> -void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
> +/**
> + * sysbus_pass_irq: Pass through IRQ/GPIO lines from one to another device
> + * @to_dev: Device which needs to expose IRQ/GPIO lines
> + * @from_dev: Device which has the IRQ/GPIO lines
> + */
> +void sysbus_pass_irq(SysBusDevice *to_dev, SysBusDevice *from_dev);

I think this is less good than what we had before, because (as
per comments on patch 1) "to" vs "from" is ambiguous.
The 'before' here is not as good as the qdev_pass_gpios()
choice of "dev" vs "container", though, so I guess we should
make this function match that one.

> -/* Pass IRQs from a target device.  */
> -void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target)
> +void sysbus_pass_irq(SysBusDevice *to_dev, SysBusDevice *from_dev)
>  {
> -    qdev_pass_gpios(DEVICE(target), DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ);
> +    qdev_pass_gpios(DEVICE(from_dev), DEVICE(to_dev), SYSBUS_DEVICE_GPIO_IRQ);
>  }

Having these two functions pass the container and target in
opposite orders seems unnecessarily confusing. We should
make them use the same order, at least...

thanks
-- PMM


      reply	other threads:[~2020-08-25 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 14:38 [PATCH 0/2] hw/core: Make qdev_pass_gpios/sysbus_pass_irq arguments self-describing Philippe Mathieu-Daudé
2020-08-18 14:38 ` [PATCH 1/2] hw/core/qdev: Make qdev_pass_gpios() " Philippe Mathieu-Daudé
2020-08-25 15:00   ` Peter Maydell
2020-08-18 14:38 ` [PATCH 2/2] hw/core/sysbus: Make sysbus_pass_irq() " Philippe Mathieu-Daudé
2020-08-25 15:04   ` Peter Maydell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA8fbA0XKEHzMtTOmkzHCN7ji__wB+22uKTAp0-UAgEjEg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).