From patchwork Wed Feb 15 16:16:39 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: 653717 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp431784wrr; Wed, 15 Feb 2023 08:19:18 -0800 (PST) X-Google-Smtp-Source: AK7set+5tybZkg25ptWssRC9iW5bN/ob7duRVLGABtsfAodKgcwHgqLGM5Y3K0H8glkglgQlXBGK X-Received: by 2002:a05:622a:4d4:b0:3b9:e683:23d with SMTP id q20-20020a05622a04d400b003b9e683023dmr4203887qtx.38.1676477958469; Wed, 15 Feb 2023 08:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676477958; cv=none; d=google.com; s=arc-20160816; b=GoDw7kbPcl8uCwm05FXS3OnZSJagn1U+4EX0O402E0Hc6nYbEENW4Oz5qFhcja3Yyq CYHtRTFtmolRLwOuelp8tQxTue6cSdFwm2O98SkEgxYgy3I5p5E5ISBREqLTEmlWBuaF ToEjjkM6s/Avv1dWlcLyPQEmttwpA1wS+Bf3fFZjYKc9nicPQcFdEBLTVQr8TMh75IP0 oBxIRIlEO3v3icRKF+S4XMZVPrm0cqjkiUL8uOFNLK3dNdpK8T2uCIquhcRdPL/gnJUJ /pBp/cJQr+Mrc0q4eQ8BXeIqE6hiQ9O8/EA9pxmS/RTy0/TcOavvm8UuvNSbPHXRSMwW FDtA== 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=5fxrywMmBKVXBb0mf5wiJ7U1A4VldYjXsfGNyFlwAQ0=; b=GDi52ChxA+0HJTFnZcXX+UtmpSWTZRH3wsATHNOqnlNsm/r1fabVtLWew7zi32wIZ1 Y4w9sq6+BBEWbp4nS7pnfbhCdpY/HcMnbyuV8/unCEuIi4jlKbSlQGt+oTYd/fzdHYaM rpYyc2wKV6KAUEItyG4rk227LaPX3/PlUw2wIo3blXxTAXQrp6YyGTDbtoPii6RvMbbc r5HuXEbHOSvA+NDt3LlqOOV8ChfDNESxoPM5Q4EuojIjjBxY+QMSDFf2fZPvWYjhoH6W VNcDWI5VXkE56lF12RGoNBNVm4u2iuPUhQq26ugy3Lyi9+Ial8AwK3urW0XCystYAQM+ w+eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i869EaJR; 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 p7-20020a05622a13c700b003baff037de4si14742517qtk.449.2023.02.15.08.19.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 08:19:18 -0800 (PST) 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=i869EaJR; 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 1pSKUe-0001dl-UL; Wed, 15 Feb 2023 11:18:52 -0500 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 1pSKU1-0000Ad-LD for qemu-devel@nongnu.org; Wed, 15 Feb 2023 11:18:15 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSKU0-0008Sj-1n for qemu-devel@nongnu.org; Wed, 15 Feb 2023 11:18:13 -0500 Received: by mail-wr1-x42a.google.com with SMTP id a2so19725347wrd.6 for ; Wed, 15 Feb 2023 08:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=5fxrywMmBKVXBb0mf5wiJ7U1A4VldYjXsfGNyFlwAQ0=; b=i869EaJR7lzLgkV61QLdpaCpz+WXW0PrZzeZjuZzzfVdfFur7cFg8W3RnbIH7LrWuE GWeVtkvMcApqDjL0YZfhRJIbOVq2q3+QG6qYCDI3oYpGNcNW/I1oSO6xNhJToUnXVRFx hcaGCUIXPg9kyqt2P3mlmir6w8FBU4kffEHHj6UOjrb+EmL2tojWMS3UjEC9ILB5diOa CpjHs9DHQOk227ogdDkba2+GFUuVGbjpi3vwKNZTaSGYs1j6K1lo0OONF74Id92osYAa +BrL36HqBW2xcFXt/WP3E/R8L3WE1yBng6mzTUoq0EcNgQrzzSJkDJQAp30AKBfcqH6M AoXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=5fxrywMmBKVXBb0mf5wiJ7U1A4VldYjXsfGNyFlwAQ0=; b=FldVSxH1slZ9JuMMSYrRctA3yZ8wKxzgrNCejZjy3YfTJO/lTiHaEiKUAv4fzJBH57 6H+QCdVDyfKwPlZE4YlZGOFBOVamcAJXheZpgkJQIE0+mTgXo4kNscVXXok1+HAkOZ+A KM8quYf+zwMUlatKevV8708cOgP1beMrj4KXEZRnwxpIbcxfJ3q76zhrK0aV2EvdLCOo PvULMLYWsUKM82D3wnxa5VHL6NGWvZ9wGehQ0sI+27j+MibhbwUvNk5b8hrcgqBhLYBF DxAT+BjEBK7iQInFmlIgd1QufO3/Sxenbrs+Z11y396ftA47jZmS9mkVMciU/fIFiAjU O5aA== X-Gm-Message-State: AO0yUKWVp8kzClzBvGFuM7SGd0eMBJRJjZuUtbazZ5IjJT77dA+M6F5t 0PWv5A6js2tk3JjsEV9ITvtilDTL+RA3DVgw X-Received: by 2002:a05:6000:1050:b0:2c5:5936:16db with SMTP id c16-20020a056000105000b002c5593616dbmr1821468wrx.42.1676477891194; Wed, 15 Feb 2023 08:18:11 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id k16-20020adfe8d0000000b002c54536c662sm14461986wrn.34.2023.02.15.08.18.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Feb 2023 08:18:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, John Snow , Eduardo Habkost , Paolo Bonzini , Kevin Wolf , qemu-ppc@nongnu.org, Hanna Reitz , "Michael S. Tsirkin" , Richard Henderson , Gerd Hoffmann Subject: [PATCH v2 16/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new() Date: Wed, 15 Feb 2023 17:16:39 +0100 Message-Id: <20230215161641.32663-17-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230215161641.32663-1-philmd@linaro.org> References: <20230215161641.32663-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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 Previous commit ensured when entering isa_register_portio_list(), 'dev' is not NULL. Being a TYPE_ISA_DEVICE, the device must sit on a ISA bus. This means isa_bus_new() as already been called and 'isabus' can not be NULL. Simplify by removing the 'isabus' NULL check in isa_register_portio_list(). 'isabus' is now only used in isa_bus_new(). Reduce its scope by only declaring it the function using it (this will allows us to create multiple ISA buses later). Signed-off-by: Philippe Mathieu-Daudé --- hw/isa/isa-bus.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 59f98472d1..719f2e96f2 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -25,8 +25,6 @@ #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -static ISABus *isabus; - static char *isabus_get_fw_dev_path(DeviceState *dev); static void isa_bus_class_init(ObjectClass *klass, void *data) @@ -52,6 +50,8 @@ static const TypeInfo isa_bus_info = { ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space, MemoryRegion *address_space_io, Error **errp) { + static ISABus *isabus; + if (isabus) { error_setg(errp, "Can't create a second ISA bus"); return NULL; @@ -132,10 +132,6 @@ int isa_register_portio_list(ISADevice *dev, assert(dev); assert(piolist && !piolist->owner); - if (!isabus) { - return -ENODEV; - } - /* START is how we should treat DEV, regardless of the actual contents of the portio array. This is how the old code actually handled e.g. the FDC device. */