From patchwork Tue Feb 27 08:39:28 2024 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: 776167 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp51844wro; Tue, 27 Feb 2024 00:42:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXdawWCXQTVJZXFk8zuM6A5YwmWJ1WbGc9rROxKuB2hIh3PHqVd1BTtJcNfKcBWmUKdxsMxSKrP43QQ5neRH8Mq X-Google-Smtp-Source: AGHT+IEV9P25JLlIdR+lKQrL3cJcOajd9uYTnXifgfxx8FDQMoqpa4uH4JIMwjGZQWpNh7HgxK/k X-Received: by 2002:a37:c204:0:b0:787:28b1:f25e with SMTP id i4-20020a37c204000000b0078728b1f25emr1471706qkm.31.1709023323301; Tue, 27 Feb 2024 00:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709023323; cv=none; d=google.com; s=arc-20160816; b=ajHns3Qrb6qbagpy1ehAwApj8LTJpCQYaGI7ZrrTbO8tFERcDaN6wtfc8lN/FfiIqL 11x2ICMfY/jrvl3WWkoH5IODxm5vqGBdeLXCLLq/i27HzArMPnYCa43kMamr5dttVonp hMJFZKjPhSwHZq9Xw0STa1USrLnoAkqgGQeTRjzrgLyugSxdsaPA5ae8Wt4LkT5RLjU8 jVvOx4EZT9V9R7CP4LExaGQmAHvJHa9aQdlXBW1FLNs95HvatApxGOU9uOdqe38FhaEN /WKX6ZnpFgMjv+269vAHeNjIINpmxDqoZv3vtvMTpRUledUYk47eWPQceXDCD7ptazZr Grvw== 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=rHGNJ1XUlxhgdMpKga7hKHkmc9UPr7ny3TDpRoUFz4k=; fh=t0oDkAaexSpU2iAZ8rUYY3qErkmE8YJGVrjJRcgtKO8=; b=GDj/Cu1cBSv+ADcqfCF3Y2AZpTQqIkuYv7pFwW518XmKAkAKuVGEVtW/103q6UGLtn IhmgLvD+JmMLN20z6qUM/NMECUEkHFIYf8Qz/PKZ7tHMHNc/FseqZJK0suxkZ5zo6MQu XqPNbogDnhvi2hIYdXD01mKtDHKcZBcH2sGhbbvWfYpwW5wvxWNCNFmTdGMB0vYsZqjl DCPV1Otx2V3Yn4CrYq8qRTT7rVq3YtjcXzteT1Lb4fjH8gTqaU+QPxrVOSnnhewqe3+B +KshCfkKJJ33oOraVwS/eN/clmb4x470PZ7pYwjihYHpZc1t5pIPr81F82dTjsR+/Q77 pbIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ScGUZdQ+; 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 u5-20020a05620a120500b00787d1b9fb38si4238100qkj.276.2024.02.27.00.42.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 00:42:03 -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=ScGUZdQ+; 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 1ret1o-0007Wt-9h; Tue, 27 Feb 2024 03:41:35 -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 1ret1X-0007Pq-OD for qemu-devel@nongnu.org; Tue, 27 Feb 2024 03:41:18 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ret1P-0007xX-HV for qemu-devel@nongnu.org; Tue, 27 Feb 2024 03:41:12 -0500 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a3e72ec566aso505139666b.2 for ; Tue, 27 Feb 2024 00:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709023264; x=1709628064; 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=rHGNJ1XUlxhgdMpKga7hKHkmc9UPr7ny3TDpRoUFz4k=; b=ScGUZdQ+xhNJsXb9uZijJaVK7ZxRWmkvdWfUa5hpz5lg8ELpZqoI9pSpqp+tX2qkko 0zUx8vv7IxOkCCLgmb6qYCcYvi5ge+roO+vZL9+oqspwXJ4doWXmLT59tdvts9v8OdrT mwXj1ymQxs1UQ/Clqfohsfz/9fDIdwVN4Sd48JFe7r/938fE6wwgQMur21XAmsHRj1EN escNXI0nlBDnM5G2TX0r5Uhd/8KdI9uuakmey+TGtLQ8uCHKevBeMB/Q/sPiXLRhfruv I4EHrUSXkfcHheJiLoxH7KhqlLvOgtAwJyLw5dPbLayt2k6NkO60neVZZK24IlP3WhaP lYrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709023264; x=1709628064; 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=rHGNJ1XUlxhgdMpKga7hKHkmc9UPr7ny3TDpRoUFz4k=; b=ScL5gXsUnWM/k1VJrgQ4D7YZXs/FGo7qMwRZpuWxwZ+WK0lUdVjCCvOFSCN+cWUKxj BPaDz3Ujgnz0B7YqIHYD09Clq797jElWsr9xMmmMtWWkAEVofS33XDqyIctjqHrRwxV/ S73kpsWRgD+X+QCZOhlDf0UFhGe1ha7WL+esSDMIyK1R7yfkKPUHjTKV9YR6ltwXLNht pBD5TbJkTKGKbJeXrWB7DflNgz5WzymgQePtTo1i1vNLt3RBTLQbnepOSD7+zq0QnYVS fLW2ZM3YSfHBYrRFZ37PuGpJm3WjAdiL8AcMduSGwNTyWyQKQbRV6tH4Z/7Nuhz29fwC s4zQ== X-Gm-Message-State: AOJu0Yw+Y2phVNl2jZCdAvP3CjeWm7etH1APKwT91XHPy0CembzT70Gq 6TDcvcHpJMZN9WSjU4EXavc7pr2E0fk8VWEK/VEEZdvK/sHfyoqNEWNXvWkW0WwPtmacewcnsrD 7 X-Received: by 2002:a17:906:7f89:b0:a43:5840:b8ac with SMTP id f9-20020a1709067f8900b00a435840b8acmr2968766ejr.42.1709023264502; Tue, 27 Feb 2024 00:41:04 -0800 (PST) Received: from m1x-phil.lan (mic92-h03-176-184-33-214.dsl.sta.abo.bbox.fr. [176.184.33.214]) by smtp.gmail.com with ESMTPSA id lt16-20020a170906fa9000b00a3d99415705sm538091ejb.73.2024.02.27.00.41.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 27 Feb 2024 00:41:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Yoshinori Sato , Magnus Damm Subject: [PULL 12/30] hw/sh4/r2d: do not use usb_bus_find() Date: Tue, 27 Feb 2024 09:39:28 +0100 Message-ID: <20240227083948.5427-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240227083948.5427-1-philmd@linaro.org> References: <20240227083948.5427-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=unavailable 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 From: Paolo Bonzini usb_bus_find() is always used with argument -1; it can be replaced with a search of the single USB bus on the machine. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-ID: <20240223124406.234509-4-pbonzini@redhat.com> [PMD: Fixed style] Signed-off-by: Philippe Mathieu-Daudé --- hw/sh4/r2d.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index c73e8f49b8..e5ac6751bd 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -244,6 +244,7 @@ static void r2d_init(MachineState *machine) SysBusDevice *busdev; MemoryRegion *address_space_mem = get_system_memory(); PCIBus *pci_bus; + USBBus *usb_bus; cpu = SUPERH_CPU(cpu_create(machine->cpu_type)); env = &cpu->env; @@ -312,7 +313,9 @@ static void r2d_init(MachineState *machine) pci_init_nic_devices(pci_bus, mc->default_nic); /* USB keyboard */ - usb_create_simple(usb_bus_find(-1), "usb-kbd"); + usb_bus = USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS, + &error_abort)); + usb_create_simple(usb_bus, "usb-kbd"); /* Todo: register on board registers */ memset(&boot_params, 0, sizeof(boot_params));