From patchwork Sun Feb 12 22:51:42 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: 652841 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124620wrr; Sun, 12 Feb 2023 14:53:54 -0800 (PST) X-Google-Smtp-Source: AK7set8UX9dd8snm4epNgE18wuMjrqjr8AF8psgql89OYR97YwL3VU7hnMoMFEwgEFK8NDMM30YX X-Received: by 2002:ad4:5763:0:b0:56e:b30a:142f with SMTP id r3-20020ad45763000000b0056eb30a142fmr1823468qvx.14.1676242434351; Sun, 12 Feb 2023 14:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242434; cv=none; d=google.com; s=arc-20160816; b=u4Dk9MLrEorTwXd38nOCJw/4IeD/7z278FXBegODvqfCM8OLMeNm8MVwe8TZyogA+l 96Qi8k1i2YqppXNGiHDxluRJtdFpHU1c4b9uizt3OQ7qUKgFDX/EyX786XiPGBXV9UUW gpszgUdM6FbyiOFxvq2usgVtIlTZOZDJbRPAAn8Gt5wug7CoFvpC7/aoDz98hr00BnkT YWgz4121zwVY9fxRtw8aNhnXNj+nFGXgMEuntZEKSSdVuQGazjkt7XIGHzU8hq7fGJtc FkSR+Nzc+raLSrxJtXktWwUSb9NjeY4/noUKmCCIq1t3LP6foh6VmuaZQLmiDWVcNw/E npEw== 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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=btOdTJ6LNlLqOTPKM7TI6zR9Zc67AAs+T+MWA6u4cEcOlKAzzXkg+XI08VhDLZslKs KQvup6HckAzi1MNp25FMZBDZbUyahdz/hqfSm5Gc3oftZvndUdhatws6rmLOdtCxmT+w N/dRGRu4zERk4/aeP9FoDsGDtiBk4Jz9YIPY71t68Ql9OfF2eWJ8M4YJVY/HrFrlKf3h GDma0O/4RLMXk/YQH6q3yHneyHH6eI54Czy/oEkpAb3NODkGH80r428JcsX9i7Pjjb7P qnJQD7VaHDEHDL1Be83yfhK+H/8Gcbbh682gprqQN1TTz7kVoDtPYMzAbUIC3sVgTkrz wQLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OWPqsAb0; 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 x17-20020a0cb211000000b0056bf9633d57si8158156qvd.7.2023.02.12.14.53.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:54 -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=OWPqsAb0; 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 1pRLDo-0000pV-Bs; Sun, 12 Feb 2023 17:53:24 -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 1pRLDn-0000mI-8u for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:23 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLDk-0004Ai-Hn for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:22 -0500 Received: by mail-wr1-x431.google.com with SMTP id h16so10418122wrz.12 for ; Sun, 12 Feb 2023 14:53:20 -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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=OWPqsAb0SuWg82E34DR/JsqG0wasmdZB/YM1XLoRpg6AGc/kJOUtWaoaWg4Xx/VMNk 3tLkJbJa8XeISnO2rI6xZIPfPslQS7Ym8WxI78EwlsAIumsuMtFWBNumhOSv3rIJqnFR BXHNCULiwpzCb8QzmcWKgij02Lm721vz+PiWM6m50YPWgPPiw57whsM4aVFUWbvahMlD TQV+W3222datHAf+6D+bt5LPesgVuV5ra4M3t7WCzKxmtE6iVNWapQKpERfHtY1qlR6N X72fgsVIbpbeX3tUjjhhnIGl/dk4UloS0uMhM3v91MAP9IJv6JhYW+rDYK49MaGuJ1ns WVnw== 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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=ISTNXN/Ea9eXVYyVjIREigdG/vf1tnXS+Snu6NXRDAT/Ewn9kzg753ogTX0W4rZR1r p3wZxweFdKfghDSYSacBuyJmS3y+X/LwL4NkK2zS9962RWroshjezZKX/q84DCshirY/ yfpHQn4M7BDAquehJWl3engi3EG1Og9I2/SP7nxy/iZGhmv+FfMwOTONaBQbksw9hBhf rjGZO6pUJDXQlvdzR3z/rvoXBLauPzINgMHkSVvxxqBScicABhontAqkH5J3oFOe/szd AI2aApHxutK6wi13QIn07FRyFr5pbwDUpio63DOxuW2GAwsL1bEwINSfbSHIBZXpzIAi xGoQ== X-Gm-Message-State: AO0yUKXtCcgLAaMbhBg4JHP5azHMDhm9xWJfKECIkS5cssx+xKQHf2cn 8/SsxqPgNieNGhNHv2BVN9DeQg== X-Received: by 2002:a05:6000:1b88:b0:2c3:ea8b:2724 with SMTP id r8-20020a0560001b8800b002c3ea8b2724mr17542808wru.21.1676242399794; Sun, 12 Feb 2023 14:53:19 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id k1-20020adff5c1000000b002bff574a250sm9202140wrp.2.2023.02.12.14.53.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH 17/19] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting Date: Sun, 12 Feb 2023 23:51:42 +0100 Message-Id: <20230212225144.58660-18-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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=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 Use the safer USB_HUB() QOM type-checking macro instead of casts. Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/dev-hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index a6b50dbc8d..4734700e3e 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -350,7 +350,7 @@ static const char *feature_name(int feature) static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, int request, int value, int index, int length, uint8_t *data) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); int ret; trace_usb_hub_control(s->dev.addr, request, value, index, length); @@ -523,7 +523,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); switch(p->pid) { case USB_TOKEN_IN: @@ -568,7 +568,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) static void usb_hub_unrealize(USBDevice *dev) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); int i; for (i = 0; i < s->num_ports; i++) {