From patchwork Sat Sep 24 19:20:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 9349243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB2AF607F2 for ; Sat, 24 Sep 2016 19:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB9AC290A2 for ; Sat, 24 Sep 2016 19:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D9D529114; Sat, 24 Sep 2016 19:21:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ED538290A2 for ; Sat, 24 Sep 2016 19:21:39 +0000 (UTC) Received: from localhost ([::1]:35281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnsW3-00058P-3c for patchwork-qemu-devel@patchwork.kernel.org; Sat, 24 Sep 2016 15:21:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnsVX-00056M-Dg for qemu-devel@nongnu.org; Sat, 24 Sep 2016 15:21:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnsVR-0001qX-NG for qemu-devel@nongnu.org; Sat, 24 Sep 2016 15:21:06 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnsVR-0001qD-Fd for qemu-devel@nongnu.org; Sat, 24 Sep 2016 15:21:01 -0400 Received: by mail-pf0-f196.google.com with SMTP id 21so6885590pfy.1 for ; Sat, 24 Sep 2016 12:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i+hMGhUUKJ/uSW72uf7954oPcE+BltdjOsui8E8k5qE=; b=DepwR5DZ9WAoAjG3/3nFnvTroy5zWisuweIKqkMu+u0s2CtdFmI20GdwSPO8QgZeOW BVrgHPy8445MB91f8g6O7caRelM2ZNiGSarO6HMaKZ6sVgCCdfvRBioA36nygpI75X41 OFsuKgoNhIurOm59iO9ZbuCZ18TkrHiLEMX9fb8FqLr5qGro27z1gNVXQEblM7LDHd/O YBu9h7T9XmSeLeTsPW2Ohif8/Xlfp0ohmh3zI3LQAgFh/Q1KEjGSjIi1GSETjgifreGG VHj70OsCjlVvYjVTqyvATIwYf8/1qj18wqB/2iyeDQ9NMrxyaFBwlGFsmcgvLs4U7ks7 nEhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i+hMGhUUKJ/uSW72uf7954oPcE+BltdjOsui8E8k5qE=; b=TaBsX0YoPKuyDqyRIHnjq+kDp1oL+pSVAJY/x67u7RaaKsaqPIBGUT63m9MPj3wBbr aJa/F8c1SOjh9K31J7eWLjTVUzyaq1C4Urj5t/KEDeW2MeGm9Cchmj7HySZSAECMdZJh AX475NK06ABuRQZNU//2knguDnJvLPujcKPzkXppaSxSj2RYOzbO01iUa3YQo6dULffX pHCQYsN4PgcboO+eFDi0E58nhQnoit3ydAKDCGpqlC64XUwrYj6wtDTOfyxLskJRI62V BellsEFWTw547acI/EbUySMVDqnarJQXb0O7pz9BdHzWiJT7F7/AWmvwJFelUxXhSAJv MYQw== X-Gm-Message-State: AE9vXwMKntez8wZw6DA6Vf29lWc9QkVk1IBTRenTzTJ7sW9AwwVlRw/Va5uFV4dEFfMu8Q== X-Received: by 10.98.150.157 with SMTP id s29mr23532828pfk.3.1474744800983; Sat, 24 Sep 2016 12:20:00 -0700 (PDT) Received: from localhost ([2601:646:8581:937e:696f:1ffa:ab17:d7de]) by smtp.gmail.com with ESMTPSA id y11sm18335315pfa.4.2016.09.24.12.20.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Sep 2016 12:20:00 -0700 (PDT) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Sat, 24 Sep 2016 12:20:00 -0700 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.196 Subject: [Qemu-devel] [PATCH v8 1/8] STM32F205: Remove the individual device variables X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, konstanty@ieee.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cleanup the individual DeviceState and SysBusDevice variables to re-use the same variable for each device. Signed-off-by: Alistair Francis Reviewed-by: Peter Crosthwaite --- hw/arm/stm32f205_soc.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index de26b8c..5b6fa3b 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -62,8 +62,8 @@ static void stm32f205_soc_initfn(Object *obj) static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) { STM32F205State *s = STM32F205_SOC(dev_soc); - DeviceState *syscfgdev, *usartdev, *timerdev, *nvic; - SysBusDevice *syscfgbusdev, *usartbusdev, *timerbusdev; + DeviceState *dev, *nvic; + SysBusDevice *busdev; Error *err = NULL; int i; @@ -94,44 +94,43 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) s->kernel_filename, s->cpu_model); /* System configuration controller */ - syscfgdev = DEVICE(&s->syscfg); + dev = DEVICE(&s->syscfg); object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } - syscfgbusdev = SYS_BUS_DEVICE(syscfgdev); - sysbus_mmio_map(syscfgbusdev, 0, 0x40013800); - sysbus_connect_irq(syscfgbusdev, 0, qdev_get_gpio_in(nvic, 71)); + busdev = SYS_BUS_DEVICE(dev); + sysbus_mmio_map(busdev, 0, 0x40013800); + sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(nvic, 71)); /* Attach UART (uses USART registers) and USART controllers */ for (i = 0; i < STM_NUM_USARTS; i++) { - usartdev = DEVICE(&(s->usart[i])); - qdev_prop_set_chr(usartdev, "chardev", i < MAX_SERIAL_PORTS ? serial_hds[i] : NULL); + dev = DEVICE(&(s->usart[i])); + qdev_prop_set_chr(dev, "chardev", + i < MAX_SERIAL_PORTS ? serial_hds[i] : NULL); object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } - usartbusdev = SYS_BUS_DEVICE(usartdev); - sysbus_mmio_map(usartbusdev, 0, usart_addr[i]); - sysbus_connect_irq(usartbusdev, 0, - qdev_get_gpio_in(nvic, usart_irq[i])); + busdev = SYS_BUS_DEVICE(dev); + sysbus_mmio_map(busdev, 0, usart_addr[i]); + sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(nvic, usart_irq[i])); } /* Timer 2 to 5 */ for (i = 0; i < STM_NUM_TIMERS; i++) { - timerdev = DEVICE(&(s->timer[i])); - qdev_prop_set_uint64(timerdev, "clock-frequency", 1000000000); + dev = DEVICE(&(s->timer[i])); + qdev_prop_set_uint64(dev, "clock-frequency", 1000000000); object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } - timerbusdev = SYS_BUS_DEVICE(timerdev); - sysbus_mmio_map(timerbusdev, 0, timer_addr[i]); - sysbus_connect_irq(timerbusdev, 0, - qdev_get_gpio_in(nvic, timer_irq[i])); + busdev = SYS_BUS_DEVICE(dev); + sysbus_mmio_map(busdev, 0, timer_addr[i]); + sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(nvic, timer_irq[i])); } }