{"id":808009,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808009/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170831035306.29170-6-f4bug@amsat.org>","date":"2017-08-31T03:53:04","name":"[5/7] hw/char/exynos4210_uart: use serial_chr_nonnull()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"69165d01f52da68c30b0d963edd46c2a6d4dee48","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/1.0/people/70924/?format=json","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170831035306.29170-6-f4bug@amsat.org/mbox/","series":[{"id":736,"url":"http://patchwork.ozlabs.org/api/1.0/series/736/?format=json","date":"2017-08-31T03:52:59","name":"serial: add serial_chr_nonnull()","version":1,"mbox":"http://patchwork.ozlabs.org/series/736/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808009/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jpPwTEQ7\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjTDb2Fj0z9s71\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 14:00:31 +1000 (AEST)","from localhost ([::1]:53815 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnGeb-00065w-GF\n\tfor incoming@patchwork.ozlabs.org; Thu, 31 Aug 2017 00:00:29 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55575)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dnGXq-0000kU-E8\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 23:53:34 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dnGXo-0006ay-Uo\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 23:53:30 -0400","from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:34960)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dnGXo-0006aq-QC; Wed, 30 Aug 2017 23:53:28 -0400","by mail-qk0-x244.google.com with SMTP id p67so6720135qkd.2;\n\tWed, 30 Aug 2017 20:53:28 -0700 (PDT)","from yoga.offpageads.com ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tx20sm5072398qtb.5.2017.08.30.20.53.25\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 30 Aug 2017 20:53:27 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=uAZVgqVk/IJrL2WN49KZ/EeyKG6Gdk+6kpmck+4Aqas=;\n\tb=jpPwTEQ7gcwxj2aCwXoWc9p+BSuoa+Lv92dlf3cZ2Ol4tnh/ILR4bM/k60MzB2SjCB\n\tgvRVMsPLitzlVTLoopVXN2/7EEbA/A+5nbp2tbVw2SF/fD+oPho0HHR1zpgnxTgLHzt1\n\t2YtOwj6zJag/1bCh+ekxeuWrO/zVy5sE6lkaqAtx8gx6EOivXxln8xOYEOo9AodhKf2k\n\trOkXyih6RSGMIkC0K4y0CO0kxCDf2TF00h1VrTRnkFDePMtxf/j98ADkJ2KB8LkxJg7o\n\tzUWDO8q/HiAPDsFUdG8ZjdBLcXF8HFM1JC2bjAsbGbtTB5SfmsKPixfUzGflRTWSVLRO\n\tDWpw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=uAZVgqVk/IJrL2WN49KZ/EeyKG6Gdk+6kpmck+4Aqas=;\n\tb=sKg274HwBU8IJp+jjAWZf2BDdwE4F9zI09o13jLO1AsckQfQ30s7sl1dyvRQpNYptt\n\t8Im8VkvVh1zt7oMkCRQG35WC4BqE4K05+sFRs82Ve+TiGBlTu2t2BrQQ4MbRC3WxRmLR\n\tIyaLOUU2axCtbbXNPpJUhnGnstNQT8XBic6q4WOf8AL2wFMwyH7Q0bbewupfaddvaFO0\n\t3/thU2mLQ44N0f5o6BaUsISn0whdkz6Di+mMNH1HtfSdjwBrg83DvTfesqWTFFE8U4J0\n\te7YosOYocBHvRcWW5wS4NF3Dh3y5Pc/+xJO5oarsc7IWda9bviPKn9Oo82TX1KDSgufx\n\tLkVg==","X-Gm-Message-State":"AHPjjUh1D70nq8VldbuOsRcU6r0ivJFb/cbtnvoQYhwKJkwYqNtX/38l\n\tA+B9mchJ5m22SQ==","X-Received":"by 10.55.4.1 with SMTP id 1mr1983512qke.325.1504151608268;\n\tWed, 30 Aug 2017 20:53:28 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","To":"Paolo Bonzini <pbonzini@redhat.com>,\n\tPeter Maydell <peter.maydell@linaro.org>,\n\tIgor Mitsyanko <i.mitsyanko@gmail.com>","Date":"Thu, 31 Aug 2017 00:53:04 -0300","Message-Id":"<20170831035306.29170-6-f4bug@amsat.org>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170831035306.29170-1-f4bug@amsat.org>","References":"<20170831035306.29170-1-f4bug@amsat.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::244","Subject":"[Qemu-devel] [PATCH 5/7] hw/char/exynos4210_uart: use\n\tserial_chr_nonnull()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?=\n\t<f4bug@amsat.org>, \tqemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n---\nThis ARRAY_SIZE() first surprised me but was valid :)\n\n hw/char/exynos4210_uart.c | 14 ++------------\n 1 file changed, 2 insertions(+), 12 deletions(-)","diff":"diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c\nindex 3957e78abf..b6cdfc3006 100644\n--- a/hw/char/exynos4210_uart.c\n+++ b/hw/char/exynos4210_uart.c\n@@ -27,6 +27,7 @@\n #include \"chardev/char-serial.h\"\n \n #include \"hw/arm/exynos4210.h\"\n+#include \"hw/char/serial.h\"\n \n #undef DEBUG_UART\n #undef DEBUG_UART_EXTEND\n@@ -589,9 +590,6 @@ DeviceState *exynos4210_uart_create(hwaddr addr,\n     DeviceState  *dev;\n     SysBusDevice *bus;\n \n-    const char chr_name[] = \"serial\";\n-    char label[ARRAY_SIZE(chr_name) + 1];\n-\n     dev = qdev_create(NULL, TYPE_EXYNOS4210_UART);\n \n     if (!chr) {\n@@ -600,15 +598,7 @@ DeviceState *exynos4210_uart_create(hwaddr addr,\n                          MAX_SERIAL_PORTS);\n             exit(1);\n         }\n-        chr = serial_hds[channel];\n-        if (!chr) {\n-            snprintf(label, ARRAY_SIZE(label), \"%s%d\", chr_name, channel);\n-            chr = qemu_chr_new(label, \"null\");\n-            if (!(chr)) {\n-                error_report(\"Can't assign serial port to UART%d\", channel);\n-                exit(1);\n-            }\n-        }\n+        chr = serial_chr_nonnull(serial_hds[channel]);\n     }\n \n     qdev_prop_set_chr(dev, \"chardev\", chr);\n","prefixes":["5/7"]}