From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuPn8-00011C-Fg for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:43:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RuPn2-0006EG-Dz for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:43:38 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:37016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuPn2-0006E6-2L for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:43:32 -0500 Received: by dadp14 with SMTP id p14so6500013dad.4 for ; Mon, 06 Feb 2012 06:43:31 -0800 (PST) Message-ID: <4F2FE70F.2070403@codemonkey.ws> Date: Mon, 06 Feb 2012 08:43:27 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> <1328342577-25732-28-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328342577-25732-28-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 27/27] omap: remove PROP_PTR properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , qemu-devel@nongnu.org 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 Regards, Anthony Liguori > > Cc: Peter Maydell > Signed-off-by: Paolo Bonzini > --- > 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)