qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
To: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Cc: "pburton@wavecomp.com" <pburton@wavecomp.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"hpoussin@reactos.org" <hpoussin@reactos.org>,
	"amarkovic@wavecomp.com" <amarkovic@wavecomp.com>,
	"aleksandar.rikalo@rt-rk.com" <aleksandar.rikalo@rt-rk.com>,
	"aurelien@aurel32.net" <aurelien@aurel32.net>
Subject: Re: [PATCH 4/5] mips: r4000: Renovate coding style
Date: Mon, 2 Dec 2019 01:08:12 +0100	[thread overview]
Message-ID: <CAL1e-=jo6xYCR6epJHQZmJOMsXNm2K8TaieGv2ZcqDU2g3DHBA@mail.gmail.com> (raw)
In-Reply-To: <1574687098-26689-5-git-send-email-Filip.Bozuta@rt-rk.com>

[-- Attachment #1: Type: text/plain, Size: 6594 bytes --]

On Monday, November 25, 2019, Filip Bozuta <Filip.Bozuta@rt-rk.com> wrote:

> The script checkpatch.pl located in scripts folder was
> used to detect all errors and warrnings in file:
>     hw/mips/mips_r4k.c
>
> This mips r4000 machine file was edited and
> all the errors and warrings generated by the checkpatch.pl
> script were corrected and then the script was
> ran again to make sure there are no more errors and warnings.
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
> ---
>  hw/mips/mips_r4k.c | 55 ++++++++++++++++++++++++++++++
> +++---------------------
>  1 file changed, 34 insertions(+), 21 deletions(-)
>
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index 7002423..d638358 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -6,7 +6,7 @@
>   * ISA memory at the 0x10000000 (PHYS, 16Mb in size).
>   * All peripherial devices are attached to this "bus" with
>   * the standard PC ISA addresses.
> -*/
> + */
>
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
> @@ -54,17 +54,18 @@ static struct _loaderparams {
>      const char *initrd_filename;
>  } loaderparams;
>
> -static void mips_qemu_write (void *opaque, hwaddr addr,
> -                             uint64_t val, unsigned size)
> +static void mips_qemu_write(void *opaque, hwaddr addr,
> +                            uint64_t val, unsigned size)
>  {
> -    if ((addr & 0xffff) == 0 && val == 42)
> +    if ((addr & 0xffff) == 0 && val == 42) {
>          qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
> -    else if ((addr & 0xffff) == 4 && val == 42)
> +    } else if ((addr & 0xffff) == 4 && val == 42) {
>          qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
> +    }
>  }
>
> -static uint64_t mips_qemu_read (void *opaque, hwaddr addr,
> -                                unsigned size)
> +static uint64_t mips_qemu_read(void *opaque, hwaddr addr,
> +                               unsigned size)
>  {
>      return 0;
>  }
> @@ -100,8 +101,9 @@ static int64_t load_kernel(void)
>                             (uint64_t *)&kernel_high, big_endian,
>                             EM_MIPS, 1, 0);
>      if (kernel_size >= 0) {
> -        if ((entry & ~0x7fffffffULL) == 0x80000000)
> +        if ((entry & ~0x7fffffffULL) == 0x80000000) {
>              entry = (int32_t)entry;
> +        }
>      } else {
>          error_report("could not load kernel '%s': %s",
>                       loaderparams.kernel_filename,
> @@ -113,9 +115,10 @@ static int64_t load_kernel(void)
>      initrd_size = 0;
>      initrd_offset = 0;
>      if (loaderparams.initrd_filename) {
> -        initrd_size = get_image_size (loaderparams.initrd_filename);
> +        initrd_size = get_image_size(loaderparams.initrd_filename);
>          if (initrd_size > 0) {
> -            initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) &
> INITRD_PAGE_MASK;
> +            initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) &
> +            INITRD_PAGE_MASK;


"INITRD_PAGE_MASK" should be aligned vertically with  "(kernel_high".
Otherwise:

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>



>              if (initrd_offset + initrd_size > ram_size) {
>                  error_report("memory too small for initial ram disk '%s'",
>                               loaderparams.initrd_filename);
> @@ -139,11 +142,13 @@ static int64_t load_kernel(void)
>      params_buf[1] = tswap32(0x12345678);
>
>      if (initrd_size > 0) {
> -        snprintf((char *)params_buf + 8, 256, "rd_start=0x%" PRIx64 "
> rd_size=%" PRId64 " %s",
> +        snprintf((char *)params_buf + 8, 256,
> +                 "rd_start=0x%" PRIx64 " rd_size=%" PRId64 " %s",
>                   cpu_mips_phys_to_kseg0(NULL, initrd_offset),
>                   initrd_size, loaderparams.kernel_cmdline);
>      } else {
> -        snprintf((char *)params_buf + 8, 256, "%s",
> loaderparams.kernel_cmdline);
> +        snprintf((char *)params_buf + 8, 256,
> +        "%s", loaderparams.kernel_cmdline);
>      }
>
>      rom_add_blob_fixed("params", params_buf, params_size,
> @@ -207,15 +212,21 @@ void mips_r4k_init(MachineState *machine)
>
>      memory_region_add_subregion(address_space_mem, 0, ram);
>
> -    memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, "mips-qemu",
> 0x10000);
> +    memory_region_init_io(iomem, NULL, &mips_qemu_ops,
> +                          NULL, "mips-qemu", 0x10000);
> +
>      memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem);
>
> -    /* Try to load a BIOS image. If this fails, we continue regardless,
> -       but initialize the hardware ourselves. When a kernel gets
> -       preloaded we also initialize the hardware, since the BIOS wasn't
> -       run. */
> -    if (bios_name == NULL)
> +    /*
> +     * Try to load a BIOS image. If this fails, we continue regardless,
> +     * but initialize the hardware ourselves. When a kernel gets
> +     * preloaded we also initialize the hardware, since the BIOS wasn't
> +     * run.
> +     */
> +
> +    if (bios_name == NULL) {
>          bios_name = BIOS_FILENAME;
> +    }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>      if (filename) {
>          bios_size = get_image_size(filename);
> @@ -227,6 +238,7 @@ void mips_r4k_init(MachineState *machine)
>  #else
>      be = 0;
>  #endif
> +    dinfo = drive_get(IF_PFLASH, 0, 0);
>      if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
>          bios = g_new(MemoryRegion, 1);
>          memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
> @@ -235,7 +247,7 @@ void mips_r4k_init(MachineState *machine)
>          memory_region_add_subregion(get_system_memory(), 0x1fc00000,
> bios);
>
>          load_image_targphys(filename, 0x1fc00000, BIOS_SIZE);
> -    } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) {
> +    } else if (dinfo != NULL) {
>          uint32_t mips_rom = 0x00400000;
>          if (!pflash_cfi01_register(0x1fc00000, "mips_r4k.bios", mips_rom,
>                                     blk_by_legacy_dinfo(dinfo),
> @@ -280,11 +292,12 @@ void mips_r4k_init(MachineState *machine)
>
>      isa_vga_init(isa_bus);
>
> -    if (nd_table[0].used)
> +    if (nd_table[0].used) {
>          isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]);
> +    }
>
>      ide_drive_get(hd, ARRAY_SIZE(hd));
> -    for(i = 0; i < MAX_IDE_BUS; i++)
> +    for (i = 0; i < MAX_IDE_BUS; i++)
>          isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i],
>                       hd[MAX_IDE_DEVS * i],
>                       hd[MAX_IDE_DEVS * i + 1]);
> --
> 2.7.4
>
>
>

[-- Attachment #2: Type: text/html, Size: 8756 bytes --]

  reply	other threads:[~2019-12-02  0:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 13:04 [PATCH 0/5] mips: machines: Renovate coding style Filip Bozuta
2019-11-25 13:04 ` [PATCH 1/5] mips: jazz: " Filip Bozuta
2019-12-06  8:07   ` Aleksandar Markovic
2019-11-25 13:04 ` [PATCH 2/5] mips: malta: " Filip Bozuta
2019-11-30 23:46   ` Aleksandar Markovic
2019-12-02 20:49     ` Eduardo Habkost
2019-12-05 21:27       ` Cleber Rosa
2019-12-06  8:24         ` Aleksandar Markovic
2019-12-01  0:00   ` Aleksandar Markovic
2019-12-01 20:20   ` Philippe Mathieu-Daudé
2019-12-06  8:21     ` Aleksandar Markovic
2019-11-25 13:04 ` [PATCH 3/5] mips: mipssim: " Filip Bozuta
2019-12-06  8:03   ` Aleksandar Markovic
2019-11-25 13:04 ` [PATCH 4/5] mips: r4000: " Filip Bozuta
2019-12-02  0:08   ` Aleksandar Markovic [this message]
2019-11-25 13:04 ` [PATCH 5/5] mips: fulong 2e: " Filip Bozuta
2019-12-01 23:49   ` Aleksandar Markovic
2019-12-06 13:58 [PATCH 0/5] mips: machines: " Filip Bozuta
2019-12-06 13:58 ` [PATCH 4/5] mips: r4000: " Filip Bozuta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL1e-=jo6xYCR6epJHQZmJOMsXNm2K8TaieGv2ZcqDU2g3DHBA@mail.gmail.com' \
    --to=aleksandar.m.mail@gmail.com \
    --cc=Filip.Bozuta@rt-rk.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=hpoussin@reactos.org \
    --cc=pburton@wavecomp.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).