From patchwork Mon Feb 13 18:43:37 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: 653209 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2580808wrr; Mon, 13 Feb 2023 10:45:09 -0800 (PST) X-Google-Smtp-Source: AK7set8mXu7LpDot48DnF9JwhnhigQQRj0ao0ySL/rJrFL3lHiY4HjXAf9Kv2HROkh5a3bOzhkBS X-Received: by 2002:ac8:590b:0:b0:3b9:e735:96e7 with SMTP id 11-20020ac8590b000000b003b9e73596e7mr44184105qty.63.1676313909755; Mon, 13 Feb 2023 10:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313909; cv=none; d=google.com; s=arc-20160816; b=xZ3bZ99Wzhib4oDTwzMWPr6SVlyQpr33dVXMmdjRj01+VZ1kYBX3XGMjmTKoCensB0 cq1mV+YOtqcGyTbQ59AyQk6Un4zeEaQC+yNbmlPcopVTmbCTKQjiifzgw8/7I8Hq9x87 EUjvNgT8jG1t8otnHHW7qK0cgJd0x9S1caW9OeseLkkqrlKnE5aoql0GAQEg0R6QCleh wbCQh8kBama1zxdxFYjBlr889AQfgSRD6fqBt3/gu6FndYLaHBH8wWMe8oVz4uF2lQlQ 4CBEPNqGjAN6bebidRVocJbvkGcZItKHQ4nyKZel13X6zqeMb1k2j3rl9mu70TFA7HJm vB/w== 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=Q1cMUaEaRjvGcT91iASAx1yB5Sl992uC3br001/MV5V1cgrgDtc1rrZSp80/CPh9qX 30a3x1C9vBvRPwkcji7fdwL+uijMnItQgYofLqclWxY5fa8YKuvZVtRvIEMUNUxT4PKv 1YRgqQEpn79wJOVEQ/gSYn+o3zwQGZ0dRs48RALBJJb8DRBRQiZZsv7PFJ/BGwyqNmOq Q0+2+x0EUZXxISB1kCCg6xJEtkgxm+PmCFfkJKUFiXb1WwQNpf3RS/5q88WEuRBL9eKH F6HWmnTIsMEyiQB/f/TuTx8xIp8NoWjaoa6APBnx69b8j19iusT3qw5FU8WKzUW78RSq yBCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ao75rupK; 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 bp32-20020a05622a1ba000b0039abe2daf39si10331046qtb.180.2023.02.13.10.45.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:45:09 -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=Ao75rupK; 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 1pRdow-0002LY-RG; Mon, 13 Feb 2023 13:44:58 -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 1pRdot-0002DO-3x for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:55 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdor-00008M-I6 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:54 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso9767055wms.4 for ; Mon, 13 Feb 2023 10:44:53 -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=Ao75rupKEQ4AuOjLz8TKCzWe+lCHyAzKJ9Zo+E2WZlexKnJPUXtKTuKxpEhjQtEo1X 3mQ7Xk4mKQC0OJpigD9sNKdmrn/w8rNPXbAvLyy1G2kyWpYk9TMTo37Nec2CjxbxcEeE Q4fvP7+JphzgaCCFotnT4Y0yN0sU9gUQPIaqwu/PUbvKvPq4cvMVc+u+pM7TR1211pQp Wuges9BAp8uoVN9KBoQgbO7H6x3MN4Nk7wLTBSTyoxXWXDdS43zAH+sPh4lsBwr+W1dn /FNqiW7iuFsfZLALh9+KM1XJ7N0U/Lc3PBBnR3XUdLULeWa8wShtwRjBfXfkjX9py9fH K1rw== 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=I6x4uTylShE0zgbpMna18iyW3exjKJT++jfqNkLGMcGGtrMbDZlIe9c89MmvqAoPNl i6EBIXgAanOFyamifeU9bKKi5BeK5uJsxrEof9DT9UUFhq7TNaW3scNbUmhQyAwLpOJP gXj1JKDHyT0JW6Qrt5sAvxP8E7G8hnpLm0itlBPsJlz/yY9UZEmCtUENK3eHBpxsWQb6 jO5VOUvbDb9wBqLP4P5VuBd8aS1rz3Rs84/Ku3CKtm+YRXcBBvryCAdPTPlD+1rms2z3 CacIXfxCGKjOXyr0Io4jFPryq9cfT2AEXBWGUQ+bgm3SJvcQK93QRDtS+j0QsjlTzhxl 0Npw== X-Gm-Message-State: AO0yUKWugJTHm0Xv63yCoNCCaDLZwh7sDC/QBop2pVtc9rZWsjDsNkqa ZO7xygJn5qrZYys2PM46jGZ/cNJw8BSBuItE X-Received: by 2002:a05:600c:3510:b0:3dc:42d2:aeee with SMTP id h16-20020a05600c351000b003dc42d2aeeemr20043513wmq.25.1676313892145; Mon, 13 Feb 2023 10:44:52 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id y6-20020a05600c364600b003df7b40f99fsm17139595wmq.11.2023.02.13.10.44.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH v3 13/14] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting Date: Mon, 13 Feb 2023 19:43:37 +0100 Message-Id: <20230213184338.46712-14-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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++) {