From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK6By-0004c4-0u for qemu-devel@nongnu.org; Fri, 15 Jan 2016 10:21:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK6Bx-0000ZD-3y for qemu-devel@nongnu.org; Fri, 15 Jan 2016 10:21:33 -0500 Received: from mail-vk0-x233.google.com ([2607:f8b0:400c:c05::233]:34968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK6Bx-0000Yv-0B for qemu-devel@nongnu.org; Fri, 15 Jan 2016 10:21:33 -0500 Received: by mail-vk0-x233.google.com with SMTP id k1so299970769vkb.2 for ; Fri, 15 Jan 2016 07:21:32 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <27dea50e71d768db3752dcad34be0f4c4234fd21.1450570397.git.crosthwaite.peter@gmail.com> From: Peter Maydell Date: Fri, 15 Jan 2016 15:21:12 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v6 5/6] xlnx-zynqmp: Connect the SPI devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Paolo Bonzini , Peter Crosthwaite , qemu-arm , QEMU Developers , Alistair Francis On 7 January 2016 at 15:55, Peter Maydell wrote: > On 20 December 2015 at 05:43, Peter Crosthwaite > wrote: >> + for (i = 0; i < XLNX_ZYNQMP_NUM_SPIS; i++) { >> + char bus_name[6]; >> + >> + object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err); >> + >> + sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]); >> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, >> + gic_spi[spi_intr[i]]); >> + >> + /* Alias controller SPI bus to the SoC itself */ >> + snprintf(bus_name, 6, "spi%d", i); > > I don't much like these hard coded 6s. This is in init which > isn't a hot path, so the simplest thing is to use g_strdup_printf() > and then g_free() it when we're done. > > Similarly in patch 6. > > Otherwise I like this; I did a quick tweak to my sd card patchset > to use this approach and it seems to at least compile and do > the right thing in info qtree (I don't have a xilinx test image > to do more). > > Haven't looked at the detail of how we're doing this in patch 1 yet. Hi Peter (and/or Alistair) -- do you have time to do a quick respin of this patchset to use g_strdup_printf() in these cases? It would be nice to get this series into the tree, because my sd card rework patchset depends on it... thanks -- PMM