From: Anthony Liguori <anthony@codemonkey.ws>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 27/27] omap: remove PROP_PTR properties
Date: Mon, 06 Feb 2012 08:43:27 -0600 [thread overview]
Message-ID: <4F2FE70F.2070403@codemonkey.ws> (raw)
In-Reply-To: <1328342577-25732-28-git-send-email-pbonzini@redhat.com>
On 02/04/2012 02:02 AM, Paolo Bonzini wrote:
> Everything is already in place to turn the clock properties into links.
w00t!
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Regards,
Anthony Liguori
>
> Cc: Peter Maydell<peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
> hw/omap_clk.c | 2 +-
> hw/omap_gpio.c | 46 ++++++++++++++++++++++++----------------------
> hw/omap_intc.c | 26 +++++++++++++++++++++-----
> 3 files changed, 46 insertions(+), 28 deletions(-)
>
> diff --git a/hw/omap_clk.c b/hw/omap_clk.c
> index c4c2b80..4723ac1 100644
> --- a/hw/omap_clk.c
> +++ b/hw/omap_clk.c
> @@ -1305,7 +1305,7 @@ void omap_prop_set_clk(struct omap_mpu_state_s *s, DeviceState *dev,
> const char *name, const char *clk)
> {
> struct clk *target = omap_findclk(s, clk);
> - qdev_prop_set_ptr(dev, name, target);
> + object_property_set_link(OBJECT(dev), OBJECT(target), name, NULL);
> }
>
> static void omap_clk_register(void)
> diff --git a/hw/omap_gpio.c b/hw/omap_gpio.c
> index 9a9a8e1..e9a0cdb 100644
> --- a/hw/omap_gpio.c
> +++ b/hw/omap_gpio.c
> @@ -39,7 +39,7 @@ struct omap_gpif_s {
> SysBusDevice busdev;
> MemoryRegion iomem;
> int mpu_model;
> - void *clk;
> + struct clk *clk;
> struct omap_gpio_s omap1;
> };
>
> @@ -207,8 +207,8 @@ struct omap2_gpif_s {
> SysBusDevice busdev;
> MemoryRegion iomem;
> int mpu_model;
> - void *iclk;
> - void *fclk[6];
> + struct clk *iclk;
> + struct clk *fclk[6];
> int modulecount;
> struct omap2_gpio_s *modules;
> qemu_irq *handler;
> @@ -719,21 +719,15 @@ static int omap2_gpio_init(SysBusDevice *dev)
> return 0;
> }
>
> -/* Using qdev pointer properties for the clocks is not ideal.
> - * qdev should support a generic means of defining a 'port' with
> - * an arbitrary interface for connecting two devices. Then we
> - * could reframe the omap clock API in terms of clock ports,
> - * and get some type safety. For now the best qdev provides is
> - * passing an arbitrary pointer.
> - * (It's not possible to pass in the string which is the clock
> - * name, because this device does not have the necessary information
> - * (ie the struct omap_mpu_state_s*) to do the clockname to pointer
> - * translation.)
> - */
> +static void omap_gpio_initfn(Object *obj)
> +{
> + struct omap_gpif_s *s = FROM_SYSBUS(struct omap_gpif_s, SYS_BUS_DEVICE(obj));
> +
> + object_property_add_link(obj, "clk", TYPE_OMAP_CLK, (Object **)&s->clk, NULL);
> +}
>
> static Property omap_gpio_properties[] = {
> DEFINE_PROP_INT32("mpu_model", struct omap_gpif_s, mpu_model, 0),
> - DEFINE_PROP_PTR("clk", struct omap_gpif_s, clk),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> @@ -752,17 +746,24 @@ static TypeInfo omap_gpio_info = {
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(struct omap_gpif_s),
> .class_init = omap_gpio_class_init,
> + .instance_init = omap_gpio_initfn,
> };
>
> +static void omap2_gpio_initfn(Object *obj)
> +{
> + struct omap2_gpif_s *s = FROM_SYSBUS(struct omap2_gpif_s, SYS_BUS_DEVICE(obj));
> +
> + object_property_add_link(obj, "iclk", TYPE_OMAP_CLK, (Object **)&s->iclk, NULL);
> + object_property_add_link(obj, "fclk0", TYPE_OMAP_CLK, (Object **)&s->fclk[0], NULL);
> + object_property_add_link(obj, "fclk1", TYPE_OMAP_CLK, (Object **)&s->fclk[1], NULL);
> + object_property_add_link(obj, "fclk2", TYPE_OMAP_CLK, (Object **)&s->fclk[2], NULL);
> + object_property_add_link(obj, "fclk3", TYPE_OMAP_CLK, (Object **)&s->fclk[3], NULL);
> + object_property_add_link(obj, "fclk4", TYPE_OMAP_CLK, (Object **)&s->fclk[4], NULL);
> + object_property_add_link(obj, "fclk5", TYPE_OMAP_CLK, (Object **)&s->fclk[5], NULL);
> +}
> +
> static Property omap2_gpio_properties[] = {
> DEFINE_PROP_INT32("mpu_model", struct omap2_gpif_s, mpu_model, 0),
> - DEFINE_PROP_PTR("iclk", struct omap2_gpif_s, iclk),
> - DEFINE_PROP_PTR("fclk0", struct omap2_gpif_s, fclk[0]),
> - DEFINE_PROP_PTR("fclk1", struct omap2_gpif_s, fclk[1]),
> - DEFINE_PROP_PTR("fclk2", struct omap2_gpif_s, fclk[2]),
> - DEFINE_PROP_PTR("fclk3", struct omap2_gpif_s, fclk[3]),
> - DEFINE_PROP_PTR("fclk4", struct omap2_gpif_s, fclk[4]),
> - DEFINE_PROP_PTR("fclk5", struct omap2_gpif_s, fclk[5]),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> @@ -781,6 +782,7 @@ static TypeInfo omap2_gpio_info = {
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(struct omap2_gpif_s),
> .class_init = omap2_gpio_class_init,
> + .instance_init = omap2_gpio_initfn,
> };
>
> static void omap_gpio_register_device(void)
> diff --git a/hw/omap_intc.c b/hw/omap_intc.c
> index 5aa98a8..cc263ef 100644
> --- a/hw/omap_intc.c
> +++ b/hw/omap_intc.c
> @@ -37,8 +37,8 @@ struct omap_intr_handler_s {
> qemu_irq *pins;
> qemu_irq parent_intr[2];
> MemoryRegion mmio;
> - void *iclk;
> - void *fclk;
> + struct clk *iclk;
> + struct clk *fclk;
> unsigned char nbanks;
> int level_only;
> uint32_t size;
> @@ -373,9 +373,16 @@ static int omap_intc_init(SysBusDevice *dev)
> return 0;
> }
>
> +static void omap_intc_initfn(Object *obj)
> +{
> + struct omap_intr_handler_s *s = FROM_SYSBUS(struct omap_intr_handler_s,
> + SYS_BUS_DEVICE(obj));
> +
> + object_property_add_link(obj, "clk", TYPE_OMAP_CLK, (Object **)&s->iclk, NULL);
> +}
> +
> static Property omap_intc_properties[] = {
> DEFINE_PROP_UINT32("size", struct omap_intr_handler_s, size, 0x100),
> - DEFINE_PROP_PTR("clk", struct omap_intr_handler_s, iclk),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> @@ -394,6 +401,7 @@ static TypeInfo omap_intc_info = {
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(struct omap_intr_handler_s),
> .class_init = omap_intc_class_init,
> + .instance_init = omap_intc_initfn,
> };
>
> static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
> @@ -615,11 +623,18 @@ static int omap2_intc_init(SysBusDevice *dev)
> return 0;
> }
>
> +static void omap2_intc_initfn(Object *obj)
> +{
> + struct omap_intr_handler_s *s = FROM_SYSBUS(struct omap_intr_handler_s,
> + SYS_BUS_DEVICE(obj));
> +
> + object_property_add_link(obj, "iclk", TYPE_OMAP_CLK, (Object **)&s->iclk, NULL);
> + object_property_add_link(obj, "fclk", TYPE_OMAP_CLK, (Object **)&s->fclk, NULL);
> +}
> +
> static Property omap2_intc_properties[] = {
> DEFINE_PROP_UINT8("revision", struct omap_intr_handler_s,
> revision, 0x21),
> - DEFINE_PROP_PTR("iclk", struct omap_intr_handler_s, iclk),
> - DEFINE_PROP_PTR("fclk", struct omap_intr_handler_s, fclk),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> @@ -638,6 +653,7 @@ static TypeInfo omap2_intc_info = {
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(struct omap_intr_handler_s),
> .class_init = omap2_intc_class_init,
> + .instance_init = omap2_intc_initfn,
> };
>
> static void omap_intc_register_device(void)
next prev parent reply other threads:[~2012-02-06 14:43 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 8:02 [Qemu-devel] [PATCH v2 00/27] next steps for qdev & QOM Paolo Bonzini
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 01/27] qom: clean up cast macros Paolo Bonzini
2012-02-06 14:03 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 02/27] qom: more documentation on subclassing Paolo Bonzini
2012-02-06 14:04 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 03/27] qom: clean up/optimize object_dynamic_cast Paolo Bonzini
2012-02-06 14:10 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 04/27] qom: avoid useless conversions from string to type Paolo Bonzini
2012-02-06 14:14 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 05/27] qom: do not include qdev header file Paolo Bonzini
2012-02-06 14:15 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 06/27] qom: add QObject-based property get/set wrappers Paolo Bonzini
2012-02-06 14:16 ` Anthony Liguori
2012-02-07 9:12 ` Paolo Bonzini
2012-02-08 12:29 ` Luiz Capitulino
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 07/27] qom: add property get/set wrappers for C types Paolo Bonzini
2012-02-06 14:17 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 08/27] qom: fix off-by-one Paolo Bonzini
2012-02-06 14:19 ` Anthony Liguori
2012-02-07 9:13 ` Paolo Bonzini
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 09/27] qom: add object_resolve_path_type Paolo Bonzini
2012-02-06 14:21 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 10/27] qom: use object_resolve_path_type for links Paolo Bonzini
2012-02-06 14:24 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 11/27] qom: fix canonical paths vs. interfaces Paolo Bonzini
2012-02-06 14:24 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 12/27] qom: add property get/set wrappers for links Paolo Bonzini
2012-02-06 14:27 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 13/27] qdev: remove direct calls to print/parse Paolo Bonzini
2012-02-06 14:30 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 14/27] qdev: allow reusing get/set for legacy property Paolo Bonzini
2012-02-06 14:31 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 15/27] qdev: remove parse method for string properties Paolo Bonzini
2012-02-06 14:31 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 16/27] qdev: remove print/parse methods from LostTickPolicy properties Paolo Bonzini
2012-02-06 14:32 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 17/27] qdev: remove parse/print methods for mac properties Paolo Bonzini
2012-02-06 14:32 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 18/27] qdev: make the non-legacy pci address property accept an integer Paolo Bonzini
2012-02-06 14:33 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 19/27] qdev: remove parse/print methods for pointer properties Paolo Bonzini
2012-02-06 14:34 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 20/27] qdev: let QOM free properties Paolo Bonzini
2012-02-06 14:35 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 21/27] qdev: fix off-by-one Paolo Bonzini
2012-02-06 14:35 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 22/27] qdev: access properties via QOM Paolo Bonzini
2012-02-06 14:36 ` Anthony Liguori
2012-02-11 15:46 ` Blue Swirl
2012-02-13 7:53 ` Paolo Bonzini
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 23/27] qdev: inline qdev_prop_set into qdev_prop_set_ptr Paolo Bonzini
2012-02-06 14:37 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 24/27] qdev: initialize properties via QOM Paolo Bonzini
2012-02-06 14:38 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 25/27] qdev: remove unused fields from PropertyInfo Paolo Bonzini
2012-02-06 14:39 ` Anthony Liguori
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 26/27] omap_clk: convert to QOM Paolo Bonzini
2012-02-06 14:42 ` Anthony Liguori
2012-02-06 16:32 ` Peter Maydell
2012-02-04 8:02 ` [Qemu-devel] [PATCH v2 27/27] omap: remove PROP_PTR properties Paolo Bonzini
2012-02-06 14:43 ` Anthony Liguori [this message]
2012-02-07 13:20 ` [Qemu-devel] [PATCH v2 00/27] next steps for qdev & QOM Paolo Bonzini
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=4F2FE70F.2070403@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).