[PATCH 1/3] hw/core: Tidy up unnecessary casting away of const

Markus Armbruster posted 3 patches 3 years, 4 months ago
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, "Michael S. Tsirkin" <mst@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Igor Mitsyanko <i.mitsyanko@gmail.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Luc Michel <luc@lmichel.fr>, Damien Hedde <damien.hedde@greensocs.com>, "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alistair Francis <alistair@alistair23.me>, Jason Wang <jasowang@redhat.com>, Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>, Yuval Shaia <yuval.shaia.ml@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>, Eric Auger <eric.auger@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Wenchao Wang <wenchao.wang@intel.com>, Marcelo Tosatti <mtosatti@redhat.com>, Sunil Muthuswamy <sunilmut@microsoft.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>
[PATCH 1/3] hw/core: Tidy up unnecessary casting away of const
Posted by Markus Armbruster 3 years, 4 months ago
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/core/sysbus-fdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
index edb0c49b19..eebcd28f9a 100644
--- a/hw/core/sysbus-fdt.c
+++ b/hw/core/sysbus-fdt.c
@@ -299,7 +299,8 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
     void *guest_fdt = data->fdt, *host_fdt;
     const void *r;
     int i, prop_len;
-    uint32_t *irq_attr, *reg_attr, *host_clock_phandles;
+    uint32_t *irq_attr, *reg_attr;
+    const uint32_t *host_clock_phandles;
     uint64_t mmio_base, irq_number;
     uint32_t guest_clock_phandles[2];
 
@@ -339,7 +340,7 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
         error_report("%s clocks property should contain 2 handles", __func__);
         exit(1);
     }
-    host_clock_phandles = (uint32_t *)r;
+    host_clock_phandles = r;
     guest_clock_phandles[0] = qemu_fdt_alloc_phandle(guest_fdt);
     guest_clock_phandles[1] = qemu_fdt_alloc_phandle(guest_fdt);
 
-- 
2.37.2
Re: [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const
Posted by Laurent Vivier 3 years, 3 months ago
Le 23/09/2022 à 14:00, Markus Armbruster a écrit :
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   hw/core/sysbus-fdt.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
> index edb0c49b19..eebcd28f9a 100644
> --- a/hw/core/sysbus-fdt.c
> +++ b/hw/core/sysbus-fdt.c
> @@ -299,7 +299,8 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
>       void *guest_fdt = data->fdt, *host_fdt;
>       const void *r;
>       int i, prop_len;
> -    uint32_t *irq_attr, *reg_attr, *host_clock_phandles;
> +    uint32_t *irq_attr, *reg_attr;
> +    const uint32_t *host_clock_phandles;
>       uint64_t mmio_base, irq_number;
>       uint32_t guest_clock_phandles[2];
>   
> @@ -339,7 +340,7 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
>           error_report("%s clocks property should contain 2 handles", __func__);
>           exit(1);
>       }
> -    host_clock_phandles = (uint32_t *)r;
> +    host_clock_phandles = r;
>       guest_clock_phandles[0] = qemu_fdt_alloc_phandle(guest_fdt);
>       guest_clock_phandles[1] = qemu_fdt_alloc_phandle(guest_fdt);
>   

Applied to my trivial-patches branch.

Thanks,
Laurent



Re: [PATCH 1/3] hw/core: Tidy up unnecessary casting away of const
Posted by Philippe Mathieu-Daudé via 3 years, 4 months ago
On Fri, Sep 23, 2022 at 2:30 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/core/sysbus-fdt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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