diff mbox series

[1/3] hw/ppc/prep: use TYPE_MC146818_RTC instead of a hardcoded string

Message ID 20190505152839.18650-2-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/ppc/40p: Move the MC146818 RTC to the board where it belongs | expand

Commit Message

Philippe Mathieu-Daudé May 5, 2019, 3:28 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/ppc/prep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Gibson May 6, 2019, 3:25 a.m. UTC | #1
On Sun, May 05, 2019 at 05:28:37PM +0200, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Certainly a good fix, but looks like there's places in
hw/timer/mc146818rtc.c itself and in vl.c which could also do with
this.

> ---
>  hw/ppc/prep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index b7f459d4754..ebee3211480 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -601,7 +601,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)
>      uint16_t checksum = *(uint16_t *)opaque;
>      ISADevice *rtc;
>  
> -    if (object_dynamic_cast(OBJECT(dev), "mc146818rtc")) {
> +    if (object_dynamic_cast(OBJECT(dev), TYPE_MC146818_RTC)) {
>          rtc = ISA_DEVICE(dev);
>          rtc_set_memory(rtc, 0x2e, checksum & 0xff);
>          rtc_set_memory(rtc, 0x3e, checksum & 0xff);
diff mbox series

Patch

diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index b7f459d4754..ebee3211480 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -601,7 +601,7 @@  static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)
     uint16_t checksum = *(uint16_t *)opaque;
     ISADevice *rtc;
 
-    if (object_dynamic_cast(OBJECT(dev), "mc146818rtc")) {
+    if (object_dynamic_cast(OBJECT(dev), TYPE_MC146818_RTC)) {
         rtc = ISA_DEVICE(dev);
         rtc_set_memory(rtc, 0x2e, checksum & 0xff);
         rtc_set_memory(rtc, 0x3e, checksum & 0xff);