Re: [Qemu-devel] [PATCH 1/3] hw/ppc/prep: use TYPE_MC146818_RTC instead of a hardcoded string

2019-05-05 Thread David Gibson
On Sun, May 05, 2019 at 05:28:37PM +0200, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 

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);

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


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

2019-05-05 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 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);
-- 
2.20.1