diff mbox series

[1/2] hw/i386/microvm-dt: Determine mc146818rtc's IRQ number from QOM property

Message ID 20220520174537.5827-2-shentey@gmail.com (mailing list archive)
State New, archived
Headers show
Series QOM improvements for rtc/mc146818rtc | expand

Commit Message

Bernhard Beschow May 20, 2022, 5:45 p.m. UTC
Since commit 3b004a16540aa41f2aa6a1ceb0bf306716766914 'hw/rtc/
mc146818rtc: QOM'ify IRQ number' mc146818rtc's IRQ number is
configurable. Fix microvm-dt to respect its value.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i386/microvm-dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Cave-Ayland May 21, 2022, 9:19 a.m. UTC | #1
On 20/05/2022 18:45, Bernhard Beschow wrote:

> Since commit 3b004a16540aa41f2aa6a1ceb0bf306716766914 'hw/rtc/
> mc146818rtc: QOM'ify IRQ number' mc146818rtc's IRQ number is
> configurable. Fix microvm-dt to respect its value.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/i386/microvm-dt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
> index 9c3c4995b4..a5db9e4e5a 100644
> --- a/hw/i386/microvm-dt.c
> +++ b/hw/i386/microvm-dt.c
> @@ -208,7 +208,7 @@ static void dt_add_isa_serial(MicrovmMachineState *mms, ISADevice *dev)
>   static void dt_add_isa_rtc(MicrovmMachineState *mms, ISADevice *dev)
>   {
>       const char compat[] = "motorola,mc146818";
> -    uint32_t irq = RTC_ISA_IRQ;
> +    uint32_t irq = object_property_get_uint(OBJECT(dev), "irq", NULL);
>       hwaddr base = RTC_ISA_BASE;
>       hwaddr size = 8;
>       char *nodename;

Rather than using NULL as the last parameter to object_property_get_uint() I think 
using &error_abort to force an explicit failure if the irq property doesn't exist 
would be better.

Otherwise:

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
Bernhard Beschow May 22, 2022, 8:56 a.m. UTC | #2
On Sat, May 21, 2022 at 11:20 AM Mark Cave-Ayland <
mark.cave-ayland@ilande.co.uk> wrote:

> On 20/05/2022 18:45, Bernhard Beschow wrote:
>
> > Since commit 3b004a16540aa41f2aa6a1ceb0bf306716766914 'hw/rtc/
> > mc146818rtc: QOM'ify IRQ number' mc146818rtc's IRQ number is
> > configurable. Fix microvm-dt to respect its value.
> >
> > Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> > ---
> >   hw/i386/microvm-dt.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
> > index 9c3c4995b4..a5db9e4e5a 100644
> > --- a/hw/i386/microvm-dt.c
> > +++ b/hw/i386/microvm-dt.c
> > @@ -208,7 +208,7 @@ static void dt_add_isa_serial(MicrovmMachineState
> *mms, ISADevice *dev)
> >   static void dt_add_isa_rtc(MicrovmMachineState *mms, ISADevice *dev)
> >   {
> >       const char compat[] = "motorola,mc146818";
> > -    uint32_t irq = RTC_ISA_IRQ;
> > +    uint32_t irq = object_property_get_uint(OBJECT(dev), "irq", NULL);
> >       hwaddr base = RTC_ISA_BASE;
> >       hwaddr size = 8;
> >       char *nodename;
>
> Rather than using NULL as the last parameter to object_property_get_uint()
> I think
> using &error_abort to force an explicit failure if the irq property
> doesn't exist
> would be better.
>

Ack. I'll then also fix dt_add_isa_serial() in a dedicated commit for
consistency.

Otherwise:
>
> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>
>
> ATB,
>
> Mark.
>
diff mbox series

Patch

diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
index 9c3c4995b4..a5db9e4e5a 100644
--- a/hw/i386/microvm-dt.c
+++ b/hw/i386/microvm-dt.c
@@ -208,7 +208,7 @@  static void dt_add_isa_serial(MicrovmMachineState *mms, ISADevice *dev)
 static void dt_add_isa_rtc(MicrovmMachineState *mms, ISADevice *dev)
 {
     const char compat[] = "motorola,mc146818";
-    uint32_t irq = RTC_ISA_IRQ;
+    uint32_t irq = object_property_get_uint(OBJECT(dev), "irq", NULL);
     hwaddr base = RTC_ISA_BASE;
     hwaddr size = 8;
     char *nodename;