From patchwork Mon Dec 19 20:33:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 5889 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id ACC9523E01 for ; Mon, 19 Dec 2011 20:34:10 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 90AE2A187F0 for ; Mon, 19 Dec 2011 20:34:10 +0000 (UTC) Received: by eaac11 with SMTP id c11so2433411eaa.11 for ; Mon, 19 Dec 2011 12:34:10 -0800 (PST) Received: by 10.205.120.14 with SMTP id fw14mr2020237bkc.53.1324326850254; Mon, 19 Dec 2011 12:34:10 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs16750bkc; Mon, 19 Dec 2011 12:34:09 -0800 (PST) Received: by 10.216.139.155 with SMTP id c27mr7618945wej.37.1324326848535; Mon, 19 Dec 2011 12:34:08 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id e1si11307547wbh.45.2011.12.19.12.34.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Dec 2011 12:34:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RcjuJ-0007Wo-TN; Mon, 19 Dec 2011 20:33:59 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Beno=C3=AEt=20Canet?= , Anthony Liguori Subject: =?UTF-8?q?=5BPATCH=5D=20hw/sysbus=2Ec=3A=20Remove=20unnecessary=20conditionals?= Date: Mon, 19 Dec 2011 20:33:59 +0000 Message-Id: <1324326839-28915-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 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 --- 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); }