[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
From: |
Zhao Liu |
Subject: |
Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style |
Date: |
Thu, 22 Feb 2024 17:12:20 +0800 |
Hi Philippe,
On Fri, Feb 16, 2024 at 12:02:52PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:52 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
> X-Mailer: git-send-email 2.41.0
>
> QEMU's coding style generally forbids C99 mixed declarations.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/i386/pc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 196827531a..3c00a87317 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1227,6 +1227,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
> */
> if (pcms->hpet_enabled) {
> qemu_irq rtc_irq;
> + uint8_t compat;
>
> hpet = qdev_try_new(TYPE_HPET);
> if (!hpet) {
> @@ -1238,8 +1239,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
> * use IRQ16~23, IRQ8 and IRQ2. If the user has already set
> * the property, use whatever mask they specified.
> */
> - uint8_t compat = object_property_get_uint(OBJECT(hpet),
> - HPET_INTCAP, NULL);
> + compat = object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL);
> if (!compat) {
> qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
> }
"compat" is only used here to check. So, what about getting rid of this
variable?
if (!object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL)) {
qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
}
- [PATCH 00/21] hw: More QDev cleanups, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style, Philippe Mathieu-Daudé, 2024/02/16
- Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style,
Zhao Liu <=
- [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 03/21] hw/ppc/spapr_cpu: Use qdev_is_realized() instead of QOM API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API, Philippe Mathieu-Daudé, 2024/02/16
- [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new(), Philippe Mathieu-Daudé, 2024/02/16