[PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function

Philippe Mathieu-Daudé posted 21 patches 6 years, 3 months ago
Maintainers: KONRAD Frederic <frederic.konrad@adacore.com>, "Cédric Le Goater" <clg@kaod.org>, Artyom Tarasenko <atar4qemu@gmail.com>, Thomas Huth <huth@tuxfamily.org>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Beniamino Galvani <b.galvani@gmail.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Aleksandar Rikalo <arikalo@wavecomp.com>, Alistair Francis <alistair@alistair23.me>, Rob Herring <robh@kernel.org>, Andrzej Zaborowski <balrogg@gmail.com>, Leif Lindholm <leif.lindholm@linaro.org>, Aleksandar Markovic <amarkovic@wavecomp.com>, Andrew Jeffery <andrew@aj.id.au>, Richard Henderson <rth@twiddle.net>, Aurelien Jarno <aurelien@aurel32.net>, Antony Pavlov <antonynpavlov@gmail.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Jean-Christophe Dubois <jcd@tribudubois.net>, Peter Chubb <peter.chubb@nicta.com.au>, Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Joel Stanley <joel@jms.id.au>, Jan Kiszka <jan.kiszka@web.de>, Fabien Chouteau <chouteau@adacore.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Andrew Baumann <Andrew.Baumann@microsoft.com>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, Helge Deller <deller@gmx.de>, Michael Walle <michael@walle.cc>, Paul Burton <pburton@wavecomp.com>
[PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function
Posted by Philippe Mathieu-Daudé 6 years, 3 months ago
Having the RAM creation code in a separate function is not
very helpful. Move this code directly inside the board_init()
function, this will later allow the board to have the QOM
ownership of the RAM.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/arm/digic_boards.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 304e4d1a29..ef3fc2b6a5 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -53,12 +53,6 @@ typedef struct DigicBoard {
     const char *rom1_def_filename;
 } DigicBoard;
 
-static void digic4_board_setup_ram(DigicBoardState *s, hwaddr ram_size)
-{
-    memory_region_allocate_system_memory(&s->ram, NULL, "ram", ram_size);
-    memory_region_add_subregion(get_system_memory(), 0, &s->ram);
-}
-
 static void digic4_board_init(DigicBoard *board)
 {
     Error *err = NULL;
@@ -72,7 +66,8 @@ static void digic4_board_init(DigicBoard *board)
         exit(1);
     }
 
-    digic4_board_setup_ram(s, board->ram_size);
+    memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_size);
+    memory_region_add_subregion(get_system_memory(), 0, &s->ram);
 
     if (board->add_rom0) {
         board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename);
-- 
2.21.0


Re: [PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function
Posted by Richard Henderson 6 years, 3 months ago
On 10/20/19 3:56 PM, Philippe Mathieu-Daudé wrote:
> Having the RAM creation code in a separate function is not
> very helpful. Move this code directly inside the board_init()
> function, this will later allow the board to have the QOM
> ownership of the RAM.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/arm/digic_boards.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Re: [PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function
Posted by Alistair Francis 6 years, 3 months ago
On Sun, Oct 20, 2019 at 4:07 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Having the RAM creation code in a separate function is not
> very helpful. Move this code directly inside the board_init()
> function, this will later allow the board to have the QOM
> ownership of the RAM.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/arm/digic_boards.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
> index 304e4d1a29..ef3fc2b6a5 100644
> --- a/hw/arm/digic_boards.c
> +++ b/hw/arm/digic_boards.c
> @@ -53,12 +53,6 @@ typedef struct DigicBoard {
>      const char *rom1_def_filename;
>  } DigicBoard;
>
> -static void digic4_board_setup_ram(DigicBoardState *s, hwaddr ram_size)
> -{
> -    memory_region_allocate_system_memory(&s->ram, NULL, "ram", ram_size);
> -    memory_region_add_subregion(get_system_memory(), 0, &s->ram);
> -}
> -
>  static void digic4_board_init(DigicBoard *board)
>  {
>      Error *err = NULL;
> @@ -72,7 +66,8 @@ static void digic4_board_init(DigicBoard *board)
>          exit(1);
>      }
>
> -    digic4_board_setup_ram(s, board->ram_size);
> +    memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_size);
> +    memory_region_add_subregion(get_system_memory(), 0, &s->ram);
>
>      if (board->add_rom0) {
>          board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename);
> --
> 2.21.0
>
>