qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Benoît Canet" <benoit.canet@gmail.com>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] hw/sysbus.c: Remove unnecessary conditionals
Date: Tue, 20 Dec 2011 16:17:16 -0600	[thread overview]
Message-ID: <4EF1096C.9030303@us.ibm.com> (raw)
In-Reply-To: <1324326839-28915-1-git-send-email-peter.maydell@linaro.org>

On 12/19/2011 02:33 PM, Peter Maydell wrote:
> Now that all sysbus MMIO regions are MemoryRegions, mmio[n].memory
> is never NULL, and we can remove some unnecessary conditionals.
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
> A minor tidyup following Benoît's now-applied patches to remove
> sysbus_init_mmio_cb2().
>
>   hw/sysbus.c |   18 +++++-------------
>   1 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/hw/sysbus.c b/hw/sysbus.c
> index 81a57bd..24f619f 100644
> --- a/hw/sysbus.c
> +++ b/hw/sysbus.c
> @@ -50,17 +50,12 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr)
>       }
>       if (dev->mmio[n].addr != (target_phys_addr_t)-1) {
>           /* Unregister previous mapping.  */
> -        if (dev->mmio[n].memory) {
> -            memory_region_del_subregion(get_system_memory(),
> -                                        dev->mmio[n].memory);
> -        }
> +        memory_region_del_subregion(get_system_memory(), dev->mmio[n].memory);
>       }
>       dev->mmio[n].addr = addr;
> -    if (dev->mmio[n].memory) {
> -        memory_region_add_subregion(get_system_memory(),
> -                                    addr,
> -                                    dev->mmio[n].memory);
> -    }
> +    memory_region_add_subregion(get_system_memory(),
> +                                addr,
> +                                dev->mmio[n].memory);
>   }
>
>
> @@ -206,10 +201,7 @@ static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
>
>       monitor_printf(mon, "%*sirq %d\n", indent, "", s->num_irq);
>       for (i = 0; i<  s->num_mmio; i++) {
> -        size = 0;
> -        if (s->mmio[i].memory) {
> -            size = memory_region_size(s->mmio[i].memory);
> -        }
> +        size = memory_region_size(s->mmio[i].memory);
>           monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",
>                          indent, "", s->mmio[i].addr, size);
>       }

      reply	other threads:[~2011-12-20 22:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 20:33 [Qemu-devel] [PATCH] hw/sysbus.c: Remove unnecessary conditionals Peter Maydell
2011-12-20 22:17 ` Anthony Liguori [this message]

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=4EF1096C.9030303@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=benoit.canet@gmail.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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).