From: Corey Minyard <cminyard@mvista.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org,
"KONRAD Frederic" <frederic.konrad@adacore.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Aleksandar Rikalo" <arikalo@wavecomp.com>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Fabien Chouteau" <chouteau@adacore.com>,
qemu-arm@nongnu.org, "Richard Henderson" <rth@twiddle.net>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-ppc@nongnu.org,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH 11/14] omap-i2c: remove PROP_PTR
Date: Mon, 21 Oct 2019 10:03:51 -0500 [thread overview]
Message-ID: <20191021150351.GJ25427@t560> (raw)
In-Reply-To: <20191018154212.13458-12-marcandre.lureau@redhat.com>
On Fri, Oct 18, 2019 at 05:42:09PM +0200, Marc-André Lureau wrote:
> Since clock are not QOM objects, replace PROP_PTR of clocks with
> setters methods.
I agree with Peter's comment, a clock framework might be something
useful someday (not sure), a comment might be nice.
Other than that, looks good to me.
Reviewed-by: Corey Minyard <cminyard@mvista.com>
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> hw/arm/omap1.c | 2 +-
> hw/arm/omap2.c | 8 ++++----
> hw/i2c/omap_i2c.c | 19 ++++++++++++-------
> include/hw/arm/omap.h | 9 +++++++++
> 4 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
> index c5583b10e0..fe55c44c7e 100644
> --- a/hw/arm/omap1.c
> +++ b/hw/arm/omap1.c
> @@ -4032,7 +4032,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
>
> s->i2c[0] = qdev_create(NULL, "omap_i2c");
> qdev_prop_set_uint8(s->i2c[0], "revision", 0x11);
> - qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "mpuper_ck"));
> + omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "mpuper_ck"));
> qdev_init_nofail(s->i2c[0]);
> busdev = SYS_BUS_DEVICE(s->i2c[0]);
> sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C));
> diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
> index 726a628e64..046fb6ffb5 100644
> --- a/hw/arm/omap2.c
> +++ b/hw/arm/omap2.c
> @@ -2428,8 +2428,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
>
> s->i2c[0] = qdev_create(NULL, "omap_i2c");
> qdev_prop_set_uint8(s->i2c[0], "revision", 0x34);
> - qdev_prop_set_ptr(s->i2c[0], "iclk", omap_findclk(s, "i2c1.iclk"));
> - qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "i2c1.fclk"));
> + omap_i2c_set_iclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.iclk"));
> + omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.fclk"));
> qdev_init_nofail(s->i2c[0]);
> busdev = SYS_BUS_DEVICE(s->i2c[0]);
> sysbus_connect_irq(busdev, 0,
> @@ -2440,8 +2440,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
>
> s->i2c[1] = qdev_create(NULL, "omap_i2c");
> qdev_prop_set_uint8(s->i2c[1], "revision", 0x34);
> - qdev_prop_set_ptr(s->i2c[1], "iclk", omap_findclk(s, "i2c2.iclk"));
> - qdev_prop_set_ptr(s->i2c[1], "fclk", omap_findclk(s, "i2c2.fclk"));
> + omap_i2c_set_iclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.iclk"));
> + omap_i2c_set_fclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.fclk"));
> qdev_init_nofail(s->i2c[1]);
> busdev = SYS_BUS_DEVICE(s->i2c[1]);
> sysbus_connect_irq(busdev, 0,
> diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c
> index 3ba965a58f..3ccbd5cc2c 100644
> --- a/hw/i2c/omap_i2c.c
> +++ b/hw/i2c/omap_i2c.c
> @@ -28,10 +28,7 @@
> #include "qemu/error-report.h"
> #include "qapi/error.h"
>
> -#define TYPE_OMAP_I2C "omap_i2c"
> -#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
> -
> -typedef struct OMAPI2CState {
> +struct OMAPI2CState {
> SysBusDevice parent_obj;
>
> MemoryRegion iomem;
> @@ -56,7 +53,7 @@ typedef struct OMAPI2CState {
> uint8_t divider;
> uint8_t times[2];
> uint16_t test;
> -} OMAPI2CState;
> +};
>
> #define OMAP2_INTR_REV 0x34
> #define OMAP2_GC_REV 0x34
> @@ -504,10 +501,18 @@ static void omap_i2c_realize(DeviceState *dev, Error **errp)
> }
> }
>
> +void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk)
> +{
> + i2c->iclk = clk;
> +}
> +
> +void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk)
> +{
> + i2c->fclk = clk;
> +}
> +
> static Property omap_i2c_properties[] = {
> DEFINE_PROP_UINT8("revision", OMAPI2CState, revision, 0),
> - DEFINE_PROP_PTR("iclk", OMAPI2CState, iclk),
> - DEFINE_PROP_PTR("fclk", OMAPI2CState, fclk),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
> index 6b7897ba27..08ee0c7702 100644
> --- a/include/hw/arm/omap.h
> +++ b/include/hw/arm/omap.h
> @@ -77,6 +77,15 @@ typedef struct omap_intr_handler_s omap_intr_handler;
> void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk);
> void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk);
>
> +/* omap_i2c.c */
> +#define TYPE_OMAP_I2C "omap_i2c"
> +#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
> +
> +typedef struct OMAPI2CState OMAPI2CState;
> +
> +void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk);
> +void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk);
> +
> /* OMAP2 l4 Interconnect */
> struct omap_l4_s;
> struct omap_l4_region_s {
> --
> 2.23.0.606.g08da6496b6
>
next prev parent reply other threads:[~2019-10-21 15:06 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 15:41 [PATCH 00/14] Clean-ups: remove QDEV_PROP_PTR Marc-André Lureau
2019-10-18 15:41 ` [PATCH 01/14] sm501: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-18 16:22 ` Peter Maydell
2019-10-18 16:36 ` Marc-André Lureau
2019-10-18 16:50 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 02/14] vmmouse: " Marc-André Lureau
2019-10-21 10:10 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 03/14] lance: " Marc-André Lureau
2019-10-21 10:05 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 04/14] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-10-18 15:59 ` Peter Maydell
2019-10-18 16:11 ` Marc-André Lureau
2019-10-18 16:34 ` Peter Maydell
2019-10-21 10:41 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 05/14] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-18 17:49 ` Peter Maydell
2019-10-18 18:14 ` Aleksandar Markovic
2019-10-18 15:42 ` [PATCH 06/14] leon3: " Marc-André Lureau
2019-10-18 17:45 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 07/14] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-10-18 17:04 ` Philippe Mathieu-Daudé
2019-10-18 17:42 ` Aleksandar Markovic
2019-10-18 15:42 ` [PATCH 08/14] cris: replace PROP_PTR with PROP_LINK for interrupt vector Marc-André Lureau
2019-10-18 17:37 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 09/14] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-10-18 17:20 ` Peter Maydell
2019-10-21 14:52 ` Corey Minyard
2019-10-21 21:28 ` Marc-André Lureau
2019-10-18 15:42 ` [PATCH 10/14] omap-intc: " Marc-André Lureau
2019-10-18 16:55 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 11/14] omap-i2c: " Marc-André Lureau
2019-10-18 16:56 ` Peter Maydell
2019-10-21 15:03 ` Corey Minyard [this message]
2019-10-18 15:42 ` [PATCH 12/14] omap-gpio: " Marc-André Lureau
2019-10-18 16:58 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 13/14] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-10-18 16:58 ` Peter Maydell
2019-10-18 15:42 ` [PATCH 14/14] Remove QDEV_PROP_PTR Marc-André Lureau
2019-10-18 16:59 ` Peter Maydell
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=20191021150351.GJ25427@t560 \
--to=cminyard@mvista.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=chouteau@adacore.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=frederic.konrad@adacore.com \
--cc=hpoussin@reactos.org \
--cc=jasowang@redhat.com \
--cc=magnus.damm@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
/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).