[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/5] hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 1/5] hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' |
Date: |
Wed, 23 Mar 2022 18:23:05 +0000 |
On Wed, 23 Mar 2022 at 17:36, Zongyuan Li <zongyuan.li@smartx.com> wrote:
>
> Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com>
> ---
> hw/arm/realview.c | 41 ++++++++++++++++++++++++++++++++---------
> 1 file changed, 32 insertions(+), 9 deletions(-)
>
> diff --git a/hw/arm/realview.c b/hw/arm/realview.c
> index 7b424e94a5..97ace560bf 100644
> --- a/hw/arm/realview.c
> +++ b/hw/arm/realview.c
> @@ -13,9 +13,11 @@
> #include "hw/sysbus.h"
> #include "hw/arm/boot.h"
> #include "hw/arm/primecell.h"
> +#include "hw/core/split-irq.h"
> #include "hw/net/lan9118.h"
> #include "hw/net/smc91c111.h"
> #include "hw/pci/pci.h"
> +#include "hw/qdev-core.h"
> #include "net/net.h"
> #include "sysemu/sysemu.h"
> #include "hw/boards.h"
> @@ -53,6 +55,24 @@ static const int realview_board_id[] = {
> 0x76d
> };
>
> +static bool split_irq_from_named(DeviceState *src, const char* outname,
> + qemu_irq out1, qemu_irq out2) {
> + DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ);
> +
> + qdev_prop_set_uint32(splitter, "num-lines", 2);
> +
> + if (!qdev_realize_and_unref(splitter, NULL, &error_fatal)) {
> + return false;
If you pass &error_fatal the function will never return a failure,
so you don't need the if(), and the function as a whole doesn't
need to return a true/false indication.
thanks
-- PMM