diff mbox

[2/6] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct

Message ID 1341507652-22155-3-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell July 5, 2012, 5 p.m. UTC
Clean up the mix of getting the RAM size from the global ram_size
and from the ram_size field in the arm_boot_info structure, so
that we always use the structure field.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm_boot.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Peter A. G. Crosthwaite July 6, 2012, 2 a.m. UTC | #1
On Fri, Jul 6, 2012 at 3:00 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Clean up the mix of getting the RAM size from the global ram_size
> and from the ram_size field in the arm_boot_info structure, so
> that we always use the structure field.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>

> ---
>  hw/arm_boot.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm_boot.c b/hw/arm_boot.c
> index a1e6ddb..29ae324 100644
> --- a/hw/arm_boot.c
> +++ b/hw/arm_boot.c
> @@ -357,7 +357,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
>      if (kernel_size < 0) {
>          entry = info->loader_start + KERNEL_LOAD_ADDR;
>          kernel_size = load_image_targphys(info->kernel_filename, entry,
> -                                          ram_size - KERNEL_LOAD_ADDR);
> +                                          info->ram_size - KERNEL_LOAD_ADDR);
>          is_linux = 1;
>      }
>      if (kernel_size < 0) {
> @@ -371,7 +371,8 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
>              initrd_size = load_image_targphys(info->initrd_filename,
>                                                info->loader_start
>                                                + INITRD_LOAD_ADDR,
> -                                              ram_size - INITRD_LOAD_ADDR);
> +                                              info->ram_size
> +                                              - INITRD_LOAD_ADDR);

No blocker, but can we de-indent one or two tabs, to not have to have
this arg split this across so many lines?

>              if (initrd_size < 0) {
>                  fprintf(stderr, "qemu: could not load initrd '%s'\n",
>                          info->initrd_filename);
> --
> 1.7.1
>
Peter Maydell July 6, 2012, 7:23 a.m. UTC | #2
On 6 July 2012 03:00, Peter Crosthwaite <peter.crosthwaite@petalogix.com> wrote:
> On Fri, Jul 6, 2012 at 3:00 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> @@ -371,7 +371,8 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
>>              initrd_size = load_image_targphys(info->initrd_filename,
>>                                                info->loader_start
>>                                                + INITRD_LOAD_ADDR,
>> -                                              ram_size - INITRD_LOAD_ADDR);
>> +                                              info->ram_size
>> +                                              - INITRD_LOAD_ADDR);
>
> No blocker, but can we de-indent one or two tabs, to not have to have
> this arg split this across so many lines?

The general style at least in ARM related QEMU code is that function
arguments always line up (ie indent to just after the opening paren).
This is what the older code written by Paul does and it's also what
my editor does. I prefor not to break that convention. (I agree this
looks a little ugly, but that's what 80-column restrictions get you.)

-- PMM
diff mbox

Patch

diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index a1e6ddb..29ae324 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -357,7 +357,7 @@  void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
     if (kernel_size < 0) {
         entry = info->loader_start + KERNEL_LOAD_ADDR;
         kernel_size = load_image_targphys(info->kernel_filename, entry,
-                                          ram_size - KERNEL_LOAD_ADDR);
+                                          info->ram_size - KERNEL_LOAD_ADDR);
         is_linux = 1;
     }
     if (kernel_size < 0) {
@@ -371,7 +371,8 @@  void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
             initrd_size = load_image_targphys(info->initrd_filename,
                                               info->loader_start
                                               + INITRD_LOAD_ADDR,
-                                              ram_size - INITRD_LOAD_ADDR);
+                                              info->ram_size
+                                              - INITRD_LOAD_ADDR);
             if (initrd_size < 0) {
                 fprintf(stderr, "qemu: could not load initrd '%s'\n",
                         info->initrd_filename);