From patchwork Tue Oct 24 08:30:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 737527 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1916730wrl; Tue, 24 Oct 2023 01:31:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjhC130GuvBIM1poL76fuJHbAdriEpXCOPBCe/9hznCkwS46FDVNN82HerDzliMfpg+lOw X-Received: by 2002:a05:620a:288c:b0:76c:df5d:13a9 with SMTP id j12-20020a05620a288c00b0076cdf5d13a9mr12267313qkp.58.1698136272379; Tue, 24 Oct 2023 01:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698136272; cv=none; d=google.com; s=arc-20160816; b=wl/2zdfatv8FHiAcwv/I4GQIi8O26ykHQ5m62VSj9p+S+5uO0l8S0CAyJDlvqhR5UA BWBZpSHvlcb0dUsZssVyW4/2X5uP11eRVoovAIrF+rMYLtLp57ibuWhqrxLqiPxIlJ7r Q1lN00hXegwHnXdF0l/BxzRCLVG4a/KREisFlvYzxa3oTH3MtQK6YO9u5c5VEbY9t2Z9 lM8MGH5poDx9gJsDldi17mr9glhU7Z67LD9veaPsEFhwkc5lFeNOQ/cTkov13j4+f3hJ r09kyYqAa+G9lliCOYLlyFe3cPRprtHlFrinYF/EQ/1El9E3WGpdyu7rcl8a3a/hPttm bQGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZlPzf4Ab5QFLnbSPHtWGOn/3d8rqF62sEucKv3iijfs=; fh=JCpky7niHyNvgZITwflAzKrQ1Rp2zJoC9GCk/Ap1/EE=; b=OhPZaBtbPHgFNquXXLSEJgT07lqa8Lz24v6X2nbZCuTd2BlmFlojwznmci8bBHKpjR unKW2m/ImK77SgK40Su8CsefYG82Clj8e0kgrnQuaoQ0VmeC4sbRs/1G2dYNm+4sPjao FfEZKDJWRkn9tAUN6zKAbraU4ysjCl+FvYtU4EiSpnClbqqGCqhDwrJctg2qCmvragQr SbYWlZVaWTUvFGBCzMI0sUAh0GBpJRINetUb+El9/Ep82qWZbcB2quFsg+6Soa1k+7oM Z/LHERBi6VU83512dJXgyVanpY/NdYUPDhW6wvJIKVdRmmY4jLPbEHaIevnLZ5wut2N/ g7Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lf52840P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i22-20020a05620a0a1600b007742129e1ebsi6665554qka.118.2023.10.24.01.31.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Oct 2023 01:31:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lf52840P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvCoJ-0001en-0Y; Tue, 24 Oct 2023 04:30:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvCoG-0001eF-LW for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:44 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvCoE-0001Bk-Tp for qemu-devel@nongnu.org; Tue, 24 Oct 2023 04:30:44 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5079f3f3d7aso6626579e87.1 for ; Tue, 24 Oct 2023 01:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698136241; x=1698741041; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZlPzf4Ab5QFLnbSPHtWGOn/3d8rqF62sEucKv3iijfs=; b=Lf52840PvQDuGWRF/of9bSUajlk4h+l9NZiQr8szwmL+g35GA9CUXyWAyUpPaQ6rEC 6yV9WP631G2iuCzF4lSPlEbKQFY86606MZLB7mY5cR4yLFF47vwhBHuWSv4jYYksGrPN QD5o5h9m4Eay2hvG4/HCSoVNwjCtjHL5g9DKPEJqMuplCnTlQRxHOMj/uv47JkEFtz/L w8Mc63NgppMiJMT8BotQ3uQSN1/Pqk8wQMwQ9e3DKsBr1ZajhOOOj8CIhmzSbvg6y0W2 jQWWMFZlCZ85DHNoVmCuiPdwIfkwaISXWgN0+jCiIqRwwXS923mwV+TZ0S8uNbMpWI5Z 4LnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698136241; x=1698741041; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZlPzf4Ab5QFLnbSPHtWGOn/3d8rqF62sEucKv3iijfs=; b=BjvwYJVa+aRAm/cWPUEfToR+4QBVR1OxR5ARd1dT0DjzJM8J4rSMSSGowEhvBwv32s 9isgQOlEGiqymg0I/pWqW0uRAFD0cnoNnJpbAeZd52Ai4X8E3cpmhUYE5m6f/qZMyGeR DxKz8A11pEHhArmH8/yKVe0+r2xKlfY2JPy+Vq8m4m+m7yhz0Brvii/bU4pIWQgFnO5u 17VBlh1auWJ0GM8JOyqC0YC3Ae1qWEssSpI3P8AS/wlzWYlx/clxmSTkDhUtqY3RwKKs CS8NoTGgz3Lszh9lzSMMSb0URV4JNIMHyUcpAaNxMe95hWLlwi9GwRzyColFHjOVBGF2 F/Ag== X-Gm-Message-State: AOJu0YzImUkaaQIo/tx/V2l13F5eGuHCUjCmvp3WLxzvoarYZVbn43Y8 zIyIPMm0fzj7il5+q6hQ5Y0S1zSlzj45NShLxJM= X-Received: by 2002:ac2:5f54:0:b0:507:9b93:274b with SMTP id 20-20020ac25f54000000b005079b93274bmr7675505lfz.26.1698136241029; Tue, 24 Oct 2023 01:30:41 -0700 (PDT) Received: from m1x-phil.lan (sem44-h01-176-172-55-165.dsl.sta.abo.bbox.fr. [176.172.55.165]) by smtp.gmail.com with ESMTPSA id k12-20020a5d518c000000b0031f82743e25sm9383775wrv.67.2023.10.24.01.30.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Oct 2023 01:30:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 5/6] hw/m68k/next-cube: Do not open-code sysbus_create_simple() Date: Tue, 24 Oct 2023 10:30:08 +0200 Message-ID: <20231024083010.12453-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024083010.12453-1-philmd@linaro.org> References: <20231024083010.12453-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Mechanical change using the following coccinelle script: @@ identifier dev; identifier sbd; expression qom_type; expression addr; @@ - dev = qdev_new(qom_type); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr); + dev = sysbus_create_simple(qom_type, addr, NULL); then manually removing the 'dev' variable to avoid: error: variable 'dev' set but not used [-Werror,-Wunused-but-set-variable] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- hw/m68k/next-cube.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 5d244b3b95..d17e6be8e1 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -950,7 +950,6 @@ static void next_cube_init(MachineState *machine) MemoryRegion *bmapm2 = g_new(MemoryRegion, 1); MemoryRegion *sysmem = get_system_memory(); const char *bios_name = machine->firmware ?: ROM_FILE; - DeviceState *dev; DeviceState *pcdev; /* Initialize the cpu core */ @@ -974,9 +973,7 @@ static void next_cube_init(MachineState *machine) memory_region_add_subregion(sysmem, 0x04000000, machine->ram); /* Framebuffer */ - dev = qdev_new(TYPE_NEXTFB); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0B000000); + sysbus_create_simple(TYPE_NEXTFB, 0x0B000000, NULL); /* MMIO */ sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 0, 0x02000000); @@ -993,9 +990,7 @@ static void next_cube_init(MachineState *machine) memory_region_add_subregion(sysmem, 0x820c0000, bmapm2); /* KBD */ - dev = qdev_new(TYPE_NEXTKBD); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0200e000); + sysbus_create_simple(TYPE_NEXTKBD, 0x0200e000, NULL); /* Load ROM here */ /* still not sure if the rom should also be mapped at 0x0*/