qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	afaerber@suse.de, agraf@suse.de
Subject: [Qemu-devel] [PATCH qom v4 01/13] qdev: gpio: Don't allow name share between I and O
Date: Fri, 17 Oct 2014 18:24:43 +0200	[thread overview]
Message-ID: <1413563095-27301-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1413563095-27301-1-git-send-email-pbonzini@redhat.com>

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Only allow a GPIO name to be one or the other. Inputs and outputs are
functionally different and should be in different namespaces. Prepares
support for the QOMification of IRQs as Links or Child objects.

The alternative is to munge names .e.g. with "-in" or "-out" suffixes
when giving QOM names. But that reduces clarity and if there are cases
out there where users want I and O with same name they can manually add
their own suffixes.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/qdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fcb1638..976e208 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -339,6 +339,7 @@ void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler,
 {
     NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
 
+    assert(gpio_list->num_out == 0 || !name);
     gpio_list->in = qemu_extend_irqs(gpio_list->in, gpio_list->num_in, handler,
                                      dev, n);
     gpio_list->num_in += n;
@@ -354,6 +355,7 @@ void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
 {
     NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
 
+    assert(gpio_list->num_in == 0 || !name);
     assert(gpio_list->num_out == 0);
     gpio_list->num_out = n;
     gpio_list->out = pins;
-- 
2.1.0

  reply	other threads:[~2014-10-17 16:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17 16:24 [Qemu-devel] [PATCH qom v4 00/13] GPIO/IRQ QOMification: Phase 2 - Getting rid of SYSBUS IRQs Paolo Bonzini
2014-10-17 16:24 ` Paolo Bonzini [this message]
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 02/13] qdev: gpio: Register GPIO inputs as child objects Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 03/13] qdev: gpio: Register GPIO outputs as QOM links Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 04/13] qom: Allow clearing of a Link property Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 05/13] qom: Demote already-has-a-parent to a regular error Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 06/13] qdev: gpio: Re-implement qdev_connect_gpio QOM style Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 07/13] qdev: gpio: Add API for intercepting a GPIO Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 08/13] qtest/irq: Rework IRQ interception Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 09/13] irq: Remove qemu_irq_intercept_out Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 10/13] qdev: gpio: delete NamedGPIOList::out Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 11/13] qdev: gpio: Remove qdev_init_gpio_out x1 restriction Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 12/13] qdev: gpio: Define qdev_pass_gpios() Paolo Bonzini
2014-10-17 16:24 ` [Qemu-devel] [PATCH qom v4 13/13] sysbus: Use TYPE_DEVICE GPIO functionality Paolo Bonzini
2014-10-20  0:46 ` [Qemu-devel] [PATCH qom v4 00/13] GPIO/IRQ QOMification: Phase 2 - Getting rid of SYSBUS IRQs Peter Crosthwaite

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=1413563095-27301-2-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@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).