From: Igor Mammedov <imammedo@redhat.com>
To: Marek Vasut <marex@denx.de>
Cc: qemu-devel@nongnu.org, Jeff Da Silva <jdasilva@altera.com>,
Chris Wulff <crwulff@gmail.com>, Alexander Graf <agraf@suse.de>,
Markus Armbruster <armbru@redhat.com>,
Sandra Loosemore <sandra@codesourcery.com>,
Yves Vandervennet <yvanderv@altera.com>,
Ley Foon Tan <lftan@altera.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] nios2: iic: Convert CPU prop to qom link
Date: Mon, 27 Feb 2017 13:37:13 +0100 [thread overview]
Message-ID: <20170227133713.3ae9d820@nial.brq.redhat.com> (raw)
In-Reply-To: <20170226164815.26799-1-marex@denx.de>
On Sun, 26 Feb 2017 17:48:15 +0100
Marek Vasut <marex@denx.de> wrote:
> Add a const qom link between the CPU and the IIC instead
> of passing the CPU link through a qom property.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Chris Wulff <crwulff@gmail.com>
> Cc: Jeff Da Silva <jdasilva@altera.com>
> Cc: Ley Foon Tan <lftan@altera.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Sandra Loosemore <sandra@codesourcery.com>
> Cc: Yves Vandervennet <yvanderv@altera.com>
> ---
> hw/intc/nios2_iic.c | 13 ++++---------
> hw/nios2/10m50_devboard.c | 3 ++-
> 2 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/hw/intc/nios2_iic.c b/hw/intc/nios2_iic.c
> index 818ab1b315..70550ef8c1 100644
> --- a/hw/intc/nios2_iic.c
> +++ b/hw/intc/nios2_iic.c
> @@ -62,17 +62,15 @@ static void altera_iic_init(Object *obj)
> sysbus_init_irq(SYS_BUS_DEVICE(obj), &pv->parent_irq);
> }
>
> -static Property altera_iic_properties[] = {
> - DEFINE_PROP_PTR("cpu", AlteraIIC, cpu),
> - DEFINE_PROP_END_OF_LIST(),
> -};
> -
> static void altera_iic_realize(DeviceState *dev, Error **errp)
> {
> struct AlteraIIC *pv = ALTERA_IIC(dev);
> + Error *err = NULL;
>
> + pv->cpu = object_property_get_link(OBJECT(dev), "cpu", &err);
> if (!pv->cpu) {
> - error_setg(errp, "altera,iic: CPU not connected");
> + error_setg(errp, "altera,iic: CPU link not found: %s",
> + error_get_pretty(err));
> return;
> }
> }
> @@ -81,9 +79,6 @@ static void altera_iic_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> - dc->props = altera_iic_properties;
> - /* Reason: pointer property "cpu" */
> - dc->cannot_instantiate_with_device_add_yet = true;
this device is still not device_add creatable
since object_property_add_const_link() is basically the same
as DEFINE_PROP_PTR("cpu", AlteraIIC, cpu), so drop this hunk.
otherwise patch is still improvement as it removes an instance
of obsoleted DEFINE_PROP_PTR
> dc->realize = altera_iic_realize;
> }
>
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index 0d8b9aa58f..c18e0b2a17 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -83,7 +83,8 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
>
> /* Register: Internal Interrupt Controller (IIC) */
> dev = qdev_create(NULL, "altera,iic");
> - qdev_prop_set_ptr(dev, "cpu", cpu);
> + object_property_add_const_link(OBJECT(dev), "cpu", OBJECT(cpu),
> + &error_abort);
> qdev_init_nofail(dev);
> sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]);
> for (i = 0; i < 32; i++) {
next prev parent reply other threads:[~2017-02-27 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-26 16:48 [Qemu-devel] [PATCH] nios2: iic: Convert CPU prop to qom link Marek Vasut
2017-02-27 12:37 ` Igor Mammedov [this message]
2017-02-27 19:39 ` Marek Vasut
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=20170227133713.3ae9d820@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=crwulff@gmail.com \
--cc=jdasilva@altera.com \
--cc=lftan@altera.com \
--cc=marex@denx.de \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sandra@codesourcery.com \
--cc=yvanderv@altera.com \
/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).