diff mbox series

[v2,05/22] hw/ppc/pnv: Determine ns16550's IRQ number from QOM property

Message ID 20220222193446.156717-6-shentey@gmail.com (mailing list archive)
State New, archived
Headers show
Series isa: Resolve unneeded IRQ attributes from ISADevice | expand

Commit Message

Bernhard Beschow Feb. 22, 2022, 7:34 p.m. UTC
Determine the IRQ number in the same way as for isa-ipmi-bt. This resolves
the last usage of ISADevice::isairq[] which allows it to be removed.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/ppc/pnv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Cédric Le Goater Feb. 26, 2022, 11:24 a.m. UTC | #1
Hello,

On 2/22/22 20:34, Bernhard Beschow wrote:
> Determine the IRQ number in the same way as for isa-ipmi-bt. This resolves
> the last usage of ISADevice::isairq[] which allows it to be removed.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>

I can take this patch in the ppc stream if you prefer. Anyhow,

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   hw/ppc/pnv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 837146a2fb..1e9f6b0690 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -380,9 +380,12 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>           cpu_to_be32(io_base),
>           cpu_to_be32(8)
>       };
> +    uint32_t irq;
>       char *name;
>       int node;
>   
> +    irq = object_property_get_int(OBJECT(d), "irq", &error_fatal);
> +
>       name = g_strdup_printf("%s@i%x", qdev_fw_name(DEVICE(d)), io_base);
>       node = fdt_add_subnode(fdt, lpc_off, name);
>       _FDT(node);
> @@ -394,7 +397,7 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>   
>       _FDT((fdt_setprop_cell(fdt, node, "clock-frequency", 1843200)));
>       _FDT((fdt_setprop_cell(fdt, node, "current-speed", 115200)));
> -    _FDT((fdt_setprop_cell(fdt, node, "interrupts", d->isairq[0])));
> +    _FDT((fdt_setprop_cell(fdt, node, "interrupts", irq)));
>       _FDT((fdt_setprop_cell(fdt, node, "interrupt-parent",
>                              fdt_get_phandle(fdt, lpc_off))));
>
BB Feb. 26, 2022, 11:27 a.m. UTC | #2
Hi Cédric,

Am 26. Februar 2022 11:24:03 UTC schrieb "Cédric Le Goater" <clg@kaod.org>:
>Hello,
>
>On 2/22/22 20:34, Bernhard Beschow wrote:
>> Determine the IRQ number in the same way as for isa-ipmi-bt. This resolves
>> the last usage of ISADevice::isairq[] which allows it to be removed.
>> 
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>
>I can take this patch in the ppc stream if you prefer.

Good idea. I think that's going to be faster.

Thanks,
Bernhard

> Anyhow,
>
>Reviewed-by: Cédric Le Goater <clg@kaod.org>
>
>Thanks,
>
>C.
>
>
>> ---
>>   hw/ppc/pnv.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
>> index 837146a2fb..1e9f6b0690 100644
>> --- a/hw/ppc/pnv.c
>> +++ b/hw/ppc/pnv.c
>> @@ -380,9 +380,12 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>>           cpu_to_be32(io_base),
>>           cpu_to_be32(8)
>>       };
>> +    uint32_t irq;
>>       char *name;
>>       int node;
>>   
>> +    irq = object_property_get_int(OBJECT(d), "irq", &error_fatal);
>> +
>>       name = g_strdup_printf("%s@i%x", qdev_fw_name(DEVICE(d)), io_base);
>>       node = fdt_add_subnode(fdt, lpc_off, name);
>>       _FDT(node);
>> @@ -394,7 +397,7 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>>   
>>       _FDT((fdt_setprop_cell(fdt, node, "clock-frequency", 1843200)));
>>       _FDT((fdt_setprop_cell(fdt, node, "current-speed", 115200)));
>> -    _FDT((fdt_setprop_cell(fdt, node, "interrupts", d->isairq[0])));
>> +    _FDT((fdt_setprop_cell(fdt, node, "interrupts", irq)));
>>       _FDT((fdt_setprop_cell(fdt, node, "interrupt-parent",
>>                              fdt_get_phandle(fdt, lpc_off))));
>>   
>
Philippe Mathieu-Daudé Feb. 27, 2022, 10:17 p.m. UTC | #3
On 22/2/22 20:34, Bernhard Beschow wrote:
> Determine the IRQ number in the same way as for isa-ipmi-bt. This resolves
> the last usage of ISADevice::isairq[] which allows it to be removed.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/ppc/pnv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 837146a2fb..1e9f6b0690 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -380,9 +380,12 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>           cpu_to_be32(io_base),
>           cpu_to_be32(8)
>       };
> +    uint32_t irq;
>       char *name;
>       int node;
>   
> +    irq = object_property_get_int(OBJECT(d), "irq", &error_fatal);

object_property_get_[u]int(), otherwise:

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>       name = g_strdup_printf("%s@i%x", qdev_fw_name(DEVICE(d)), io_base);
>       node = fdt_add_subnode(fdt, lpc_off, name);
>       _FDT(node);
> @@ -394,7 +397,7 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>   
>       _FDT((fdt_setprop_cell(fdt, node, "clock-frequency", 1843200)));
>       _FDT((fdt_setprop_cell(fdt, node, "current-speed", 115200)));
> -    _FDT((fdt_setprop_cell(fdt, node, "interrupts", d->isairq[0])));
> +    _FDT((fdt_setprop_cell(fdt, node, "interrupts", irq)));
>       _FDT((fdt_setprop_cell(fdt, node, "interrupt-parent",
>                              fdt_get_phandle(fdt, lpc_off))));
>
Cédric Le Goater March 1, 2022, 8:31 a.m. UTC | #4
On 2/27/22 23:17, Philippe Mathieu-Daudé wrote:
> On 22/2/22 20:34, Bernhard Beschow wrote:
>> Determine the IRQ number in the same way as for isa-ipmi-bt. This resolves
>> the last usage of ISADevice::isairq[] which allows it to be removed.
>>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>>   hw/ppc/pnv.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
>> index 837146a2fb..1e9f6b0690 100644
>> --- a/hw/ppc/pnv.c
>> +++ b/hw/ppc/pnv.c
>> @@ -380,9 +380,12 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>>           cpu_to_be32(io_base),
>>           cpu_to_be32(8)
>>       };
>> +    uint32_t irq;
>>       char *name;
>>       int node;
>> +    irq = object_property_get_int(OBJECT(d), "irq", &error_fatal);
> 
> object_property_get_[u]int(), otherwise:

Fixed it.
  
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Applied to ppc-7.0.

Thanks,

C.

> 
>>       name = g_strdup_printf("%s@i%x", qdev_fw_name(DEVICE(d)), io_base);
>>       node = fdt_add_subnode(fdt, lpc_off, name);
>>       _FDT(node);
>> @@ -394,7 +397,7 @@ static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
>>       _FDT((fdt_setprop_cell(fdt, node, "clock-frequency", 1843200)));
>>       _FDT((fdt_setprop_cell(fdt, node, "current-speed", 115200)));
>> -    _FDT((fdt_setprop_cell(fdt, node, "interrupts", d->isairq[0])));
>> +    _FDT((fdt_setprop_cell(fdt, node, "interrupts", irq)));
>>       _FDT((fdt_setprop_cell(fdt, node, "interrupt-parent",
>>                              fdt_get_phandle(fdt, lpc_off))));
>
diff mbox series

Patch

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 837146a2fb..1e9f6b0690 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -380,9 +380,12 @@  static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
         cpu_to_be32(io_base),
         cpu_to_be32(8)
     };
+    uint32_t irq;
     char *name;
     int node;
 
+    irq = object_property_get_int(OBJECT(d), "irq", &error_fatal);
+
     name = g_strdup_printf("%s@i%x", qdev_fw_name(DEVICE(d)), io_base);
     node = fdt_add_subnode(fdt, lpc_off, name);
     _FDT(node);
@@ -394,7 +397,7 @@  static void pnv_dt_serial(ISADevice *d, void *fdt, int lpc_off)
 
     _FDT((fdt_setprop_cell(fdt, node, "clock-frequency", 1843200)));
     _FDT((fdt_setprop_cell(fdt, node, "current-speed", 115200)));
-    _FDT((fdt_setprop_cell(fdt, node, "interrupts", d->isairq[0])));
+    _FDT((fdt_setprop_cell(fdt, node, "interrupts", irq)));
     _FDT((fdt_setprop_cell(fdt, node, "interrupt-parent",
                            fdt_get_phandle(fdt, lpc_off))));