From patchwork Mon Feb 20 15:05:07 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: 1745150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ASchb6As; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5PD1mNfz23j7 for ; Tue, 21 Feb 2023 02:07:12 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7jL-0001Ri-DS; Mon, 20 Feb 2023 10:05:27 -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 1pU7jK-0001Ra-53 for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:26 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jI-0008Mc-ER for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:25 -0500 Received: by mail-wm1-x32c.google.com with SMTP id bg37-20020a05600c3ca500b003e21e018039so2126555wmb.3 for ; Mon, 20 Feb 2023 07:05:24 -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=alpgVL4TtkFnvxglkaFOS7JafAYOgPwJn2AublwKwWs=; b=ASchb6AsemQJip8loRYisB7hEyV3yfrzaLMvvDJY1aJ/cJ3LAXXz48FtKkQbY3ckBs kWZbJjVVs2RZez2+tr/3EvLyINbeF5wsIM++U7qV6XuzOG7pKDqC/dvua0g1vZHz562B guKLHgtFb1OBBNROHoD3UIVPwDjYxaNCcIdzx+pmKPeEEV7AAR+OwRj+5VmEsUFLbW8I BGUc/9gylvWpt3Kim0uAboScpaWW8fAc+9Pqn6eDhnCPWSynfe0Vb5bvFOJjMR6jjdQi K17X6+aWIbBqu5g2pg8BVzYh2H61DFq5H0+lO0oO2gc/EgxD4f54P+wTD0AhoBhNtQMr enHQ== 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=alpgVL4TtkFnvxglkaFOS7JafAYOgPwJn2AublwKwWs=; b=PVc3+Q8ILBMSwBc5zN+QQAS9H37fbpbC6g4S42kk2o+h5Lrr/D3ZF+ncI3WvHNi/qC 2V0WYUdRsgxkXMxBWylj/+MV9MWiX67h4+zs/SjJdedj4DEsLO2GEw+uhfBbHWkYzLrm rS5/8/peQBgBqFIo0TXw56OAFY1TWYaRbCO2CmqdHtjdSkUhhXKuSDEfC7O3jvniHiHF PVJo1/K0y/dyC1CET/qjAoSZoMWsm2Q4k/3LFapJJGoY4luTjPB5KeAwJpOvdFDDhlvR tjfSl0kjN2T3KjSaFo6gv8YFAhnc+FV+UEX6Df+/AUFzzuguWP7UnOHAt91YLpnzQB3Z eRyw== X-Gm-Message-State: AO0yUKWeC0CUWZ/3X/N5zCbzlMhKi/tn3W5OSAR2FwKg3JJR79fycWIU LTkXnfUgmPFWgaG01H9jDY9cHN/YhkZERJEf X-Google-Smtp-Source: AK7set8K2Q5CNWjg2gQD4DALKpuAKJ/rvI/9nVNu9r5ZfCu5VrtKTuicUeC/2X7mdrQmrt3ZkE8Mrw== X-Received: by 2002:a05:600c:164a:b0:3e2:668:3ed6 with SMTP id o10-20020a05600c164a00b003e206683ed6mr267883wmn.2.1676905522896; Mon, 20 Feb 2023 07:05:22 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c46c600b003dc47d458cdsm1370643wmo.15.2023.02.20.07.05.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/9] hw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus Date: Mon, 20 Feb 2023 16:05:07 +0100 Message-Id: <20230220150515.32549-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To avoid forward-declaring CCIDBus, declare CCID_BUS QOM definitions before its use in the USBCCIDState structure. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/dev-smartcard-reader.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 28164d89be..be0a4fc3bc 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -278,7 +278,9 @@ typedef struct BulkIn { struct CCIDBus { BusState qbus; }; -typedef struct CCIDBus CCIDBus; + +#define TYPE_CCID_BUS "ccid-bus" +OBJECT_DECLARE_SIMPLE_TYPE(CCIDBus, CCID_BUS) /* * powered - defaults to true, changed by PowerOn/PowerOff messages @@ -1174,9 +1176,6 @@ static Property ccid_props[] = { DEFINE_PROP_END_OF_LIST(), }; -#define TYPE_CCID_BUS "ccid-bus" -OBJECT_DECLARE_SIMPLE_TYPE(CCIDBus, CCID_BUS) - static const TypeInfo ccid_bus_info = { .name = TYPE_CCID_BUS, .parent = TYPE_BUS, From patchwork Mon Feb 20 15:05: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: 1745142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=oNbyK5bm; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5Mb3RpKz23j7 for ; Tue, 21 Feb 2023 02:05:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7jV-0001UG-Nu; Mon, 20 Feb 2023 10:05:37 -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 1pU7jP-0001S9-Vy for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:32 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jN-0008Pc-Rm for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:31 -0500 Received: by mail-wr1-x434.google.com with SMTP id c5so2229783wrr.5 for ; Mon, 20 Feb 2023 07:05:29 -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=WvQXFHkymgCugjl5w0M5Pkt74ouZE927KClvNUr2f1I=; b=oNbyK5bmWx489XuCKxFfaXarv7cwfVphOyQH3WvLtfsWk5rp2/H2tCe15B+Gw82YOi BM9lsmBHxu5uTDzHEcdgA4ygYFkD18nJ4++SNEiNoNEynJP4X54mOdQdtQeZiM9tIiTU 1+NygPMdKY35KGvLc9QDcSUxa7Ldi/J0dzf/f+AdsQOzgYs3L2sFcpMt8nTAl4wzCgW3 OdAsDjdyDwJc4diwmlJcnWgxVXxRTMrwVC8lJgmDzk/LCmH0EyG6XK5vmUJVs0pAE/Ky hPNbC08/vo1TpsR8D0H3Xcg5KgCAP9/pFVXg+isZ9UaxWs1244vdEQPtasCMl11daFb1 0Fmg== 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=WvQXFHkymgCugjl5w0M5Pkt74ouZE927KClvNUr2f1I=; b=n0cW7ZjGXqyGH9NSWE7LGfed49MWMa8VYZsUhRL6gWjWhwspa0UJF71mGaQ0AhjJ03 DlaCRbebTLEWqxkOuHvLBrNnPVjt6+rVxVuLw8bLOVvjBefx5nfueYYCgj1Zs1tO7Kef keJoYF0yhVX1Dog+PITjTZtWwS47RHHyOmOTqgCgbLnoClbSr27HoqESrxgM0r/Rahe6 WY1xIbE4FkU8Lah3ME2yGGUcyxBSQWufCBmzEpVga1TbUfYqdSpuiaJ4sooCB3jyNZYR NpxZReU/8Q9kH0FoTyQMlpbmpAlEWGn2f4kWAXKiWS6BXcbAaftCbDfTWOC8n5EQ4dp8 Ynuw== X-Gm-Message-State: AO0yUKX6hbVoHdwGHaVswXKATLXvGnDftjViNtHw6Il6UN6LG8bs/4XU OAa0NzYNC16YtkRAjlpQHeYHkMrnb77NhgOS X-Google-Smtp-Source: AK7set9wOPJyT/SXml6PHb6eRhI1d7QfpYWhO1coMcPLrn8JB9m6DzsY6wADJnXSE1OeKhAQcTNaoQ== X-Received: by 2002:a5d:4f87:0:b0:2c5:8d06:75c2 with SMTP id d7-20020a5d4f87000000b002c58d0675c2mr2981896wru.35.1676905528225; Mon, 20 Feb 2023 07:05:28 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t20-20020a1c7714000000b003dc3f3d77e3sm1437266wmi.7.2023.02.20.07.05.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/9] hw/usb/hcd-ohci: Use OHCIState type definition Date: Mon, 20 Feb 2023 16:05:08 +0100 Message-Id: <20230220150515.32549-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Forward-define the type first, then use it for the ohci_die() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/hcd-ohci.c | 2 +- hw/usb/hcd-ohci.h | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 9d68036d23..7ecf9b15b7 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1827,7 +1827,7 @@ static USBBusOps ohci_bus_ops = { void usb_ohci_init(OHCIState *ohci, DeviceState *dev, uint32_t num_ports, dma_addr_t localmem_base, char *masterbus, uint32_t firstport, AddressSpace *as, - void (*ohci_die_fn)(struct OHCIState *), Error **errp) + void (*ohci_die_fn)(OHCIState *), Error **errp) { Error *err = NULL; int i; diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h index 11ac57058d..8a9ba8b959 100644 --- a/hw/usb/hcd-ohci.h +++ b/hw/usb/hcd-ohci.h @@ -33,7 +33,9 @@ typedef struct OHCIPort { uint32_t ctrl; } OHCIPort; -typedef struct OHCIState { +typedef struct OHCIState OHCIState; + +struct OHCIState { USBBus bus; qemu_irq irq; MemoryRegion mem; @@ -89,8 +91,8 @@ typedef struct OHCIState { uint32_t async_td; bool async_complete; - void (*ohci_die)(struct OHCIState *ohci); -} OHCIState; + void (*ohci_die)(OHCIState *ohci); +}; #define TYPE_SYSBUS_OHCI "sysbus-ohci" OBJECT_DECLARE_SIMPLE_TYPE(OHCISysBusState, SYSBUS_OHCI) @@ -112,7 +114,7 @@ extern const VMStateDescription vmstate_ohci_state; void usb_ohci_init(OHCIState *ohci, DeviceState *dev, uint32_t num_ports, dma_addr_t localmem_base, char *masterbus, uint32_t firstport, AddressSpace *as, - void (*ohci_die_fn)(struct OHCIState *), Error **errp); + void (*ohci_die_fn)(OHCIState *), Error **errp); void ohci_bus_stop(OHCIState *ohci); void ohci_stop_endpoints(OHCIState *ohci); void ohci_hard_reset(OHCIState *ohci); From patchwork Mon Feb 20 15:05:09 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: 1745146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=r9D8/sZ5; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5P01q8Bz23j7 for ; Tue, 21 Feb 2023 02:07:00 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7jY-0001ZD-TI; Mon, 20 Feb 2023 10:05:41 -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 1pU7jV-0001Ud-Sv for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:37 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jS-0008Q8-Hm for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:35 -0500 Received: by mail-wr1-x433.google.com with SMTP id l1so1265211wry.10 for ; Mon, 20 Feb 2023 07:05:34 -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=7fg6HCxs6YpFo/+46boIzya1hKfktdzojAtH+afSJyQ=; b=r9D8/sZ57wMWYURio6MgHiplYoREPPP5ECnZWbkTvd1XGr+lIeT0nApvdJUXrTD4Pv ts4EtFGdrza8Q8Dqlk6QFEBiTByaEbH1raEoXSSXCcpgyEGQaj0DcPVLFf8ke3uBply7 tGnmcx1rIAPnGajolZyE1zTcQPwoecPbJtelOpmVI8nRo0ZN+R34kpSmpgjoDeQYZESH rqVdBFEZl1lxwmc+RmvOHBlLgTPfYJMuQUEgqRe2gOX03gIpGunW0T3IPuS5QR6Vca7c iXh7ZxIakDuDlYXQHpg1b+DwnLDiSJ95M2AWNbhKxU8ytXuf9SaNh9DNqnX0pBIC2miN Oykw== 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=7fg6HCxs6YpFo/+46boIzya1hKfktdzojAtH+afSJyQ=; b=8SJxntMib3BmIJlMvAxqi36tYYP/Uuoj/JlrnAYBIO0TY6P3R+wfW0O8dEyhIrYjhG y2gcZyBhXgLkVC3iEujzYB/mYcfGKnK4yhnd86flaqjepY6UqcrIrq8bHoVUPMI0fM3w M4RohKLeuOeo/gJU6txXezV4bDWo80q1Rq1mHnJQxnbC97i3WtfwY4ycmqdipunX9UO1 P+j7T8BwvfwRWTBq90G17psaLGF/8gEPSVulFO6TGGn/2kQ7dxVEccijzEVW6FalEPLK EePu0nNmpELIAuDQKOFFN/4pqKuiam76D//Au8M196YdivGZ/PQ+QBsR02/UP6P777jz azAQ== X-Gm-Message-State: AO0yUKVIrmElAwhYrPqFzPYAYiSq2doVaX6KaJ6XuhvIBinxJxmOHT2I sgg0sTlCSpV0zg1E3JQj5DkjKkaithcTwNgg X-Google-Smtp-Source: AK7set+nPjQc+NySf/0HGsmAmLPQNFM8i/rDFL997S2BPuimChtlBhe2FWqr5/1lmfm5E5OagoblyQ== X-Received: by 2002:a05:6000:188b:b0:2c5:4e06:b689 with SMTP id a11-20020a056000188b00b002c54e06b689mr641490wri.28.1676905532987; Mon, 20 Feb 2023 07:05:32 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id v6-20020adfedc6000000b002c5544b3a69sm12652486wro.89.2023.02.20.07.05.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/9] hw/usb/hcd-ohci-pci: Use QOM type-safe cast conversion macro Date: Mon, 20 Feb 2023 16:05:09 +0100 Message-Id: <20230220150515.32549-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use the PCI_DEVICE() QOM cast macros to avoid accessing internal fields. Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/hcd-ohci-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c index 6b630d35a7..3234408f1a 100644 --- a/hw/usb/hcd-ohci-pci.c +++ b/hw/usb/hcd-ohci-pci.c @@ -52,11 +52,11 @@ struct OHCIPCIState { static void ohci_pci_die(struct OHCIState *ohci) { OHCIPCIState *dev = container_of(ohci, OHCIPCIState, state); + PCIDevice *pdev = PCI_DEVICE(dev); ohci_sysbus_die(ohci); - pci_set_word(dev->parent_obj.config + PCI_STATUS, - PCI_STATUS_DETECTED_PARITY); + pci_set_word(pdev->config + PCI_STATUS, PCI_STATUS_DETECTED_PARITY); } static void usb_ohci_realize_pci(PCIDevice *dev, Error **errp) From patchwork Mon Feb 20 15:05:10 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: 1745144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=RMWeA/1D; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5Np4C7zz23j7 for ; Tue, 21 Feb 2023 02:06:50 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7jd-0001eX-UK; Mon, 20 Feb 2023 10:05:47 -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 1pU7jY-0001YY-Gc for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:40 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jW-0008Pc-Px for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:40 -0500 Received: by mail-wr1-x434.google.com with SMTP id c5so2230289wrr.5 for ; Mon, 20 Feb 2023 07:05:38 -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=9u15jpuOfwEVXLJzjPb3b2l90e4PtdG+UU4bHmgsE5o=; b=RMWeA/1DUNU/mSgesZKESsaWE52KJLBrIkDhh1pCFUt79cs1JsT/nDsjR2GYaP58Hh RfX72N1TNOT40w69PJbWrQTomzhIQudyKWB3vBuBKhFi4wTzSC5V6GxZv72MCdAd9X3G ZfgqdccPB1fJBJqNKcvIcR/i8sr48jeJFmXUrT4ugVP/gNGpqlyFvjcGN83nS8cFU9EE G+f2ZvEwVSbJ+xkrzdGP45EYJgoqUFnn9GR5urH5Z+zNyS6siUbEOLLjGH4Hu2noPj3o wHkUr/XjbR3UbBLWkQc/EdSulcWIzbXjwozdmZE/dM45SlIm+IGU3MXK5WsT0VdK7zdP dDRw== 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=9u15jpuOfwEVXLJzjPb3b2l90e4PtdG+UU4bHmgsE5o=; b=meqqfkxqgZytHSDfx9EpoTXd+4tBDjK5JFq6r/1FjoeMHB+U3RdAWy9jvwoBHDGM+1 AFOYZuClORtC51su032yR/MBBNkmIKhdRQwld7FXAXLuWsOH/1tOfNq4EktS1CzLtxVy Xfno6QzWO6/T8h2i69h7yh7KlQNzAfaXvecjZ1OJON9d0dqPbGqmB67qwuIRSHj4ggQv x1Mr021+6Hcs94kiry41KMYL/K0aMHZrWk5X5UdtRkthMrwF5Jc6cWbYAlM4xPj5dCya dcQ1y1vFNgXJMOK4pGNP0i/Z6A+lfPMyeDsPgIzNTCWtwUc28FO0xSbCV3aawpPK9NXM GdEA== X-Gm-Message-State: AO0yUKUOOa4LQmsDs2jtldJYAIOc7zU87moZ8CrNZmKgyWNYWpd4w2HG 6izEwSU8IkJKAI4L4zctQ91QsqzKpfsE44fW X-Google-Smtp-Source: AK7set8HLzg7NSMDXpDZ57qoK9yCAD7LIX3SYBPyoMK8yCBmoqe17Mozgr7+GqXTQrEw3JUzszqfzg== X-Received: by 2002:a05:6000:2cf:b0:2c5:5313:9d19 with SMTP id o15-20020a05600002cf00b002c553139d19mr840769wry.26.1676905537867; Mon, 20 Feb 2023 07:05:37 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id j27-20020a5d453b000000b002c577e2fc87sm3633703wra.15.2023.02.20.07.05.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 4/9] hw/usb/hcd-uhci: Declare QOM macros using OBJECT_DECLARE_TYPE() Date: Mon, 20 Feb 2023 16:05:10 +0100 Message-Id: <20230220150515.32549-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The automatic conversion done during commit a489d1951c ("Use OBJECT_DECLARE_TYPE when possible") missed this model because the typedefs are in a different file unit (hcd-uhci.c) than where the DECLARE_INSTANCE_CHECKER() is (hcd-uhci.h). Manually convert to OBJECT_DECLARE_TYPE(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/hcd-uhci.c | 2 -- hw/usb/hcd-uhci.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 30ae0104bb..f77ffda69a 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -60,9 +60,7 @@ enum { TD_RESULT_ASYNC_CONT, }; -typedef struct UHCIState UHCIState; typedef struct UHCIAsync UHCIAsync; -typedef struct UHCIPCIDeviceClass UHCIPCIDeviceClass; struct UHCIPCIDeviceClass { PCIDeviceClass parent_class; diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h index e0fdb98ef1..69f8b40c49 100644 --- a/hw/usb/hcd-uhci.h +++ b/hw/usb/hcd-uhci.h @@ -75,7 +75,7 @@ typedef struct UHCIState { } UHCIState; #define TYPE_UHCI "pci-uhci-usb" -DECLARE_INSTANCE_CHECKER(UHCIState, UHCI, TYPE_UHCI) +OBJECT_DECLARE_TYPE(UHCIState, UHCIPCIDeviceClass, UHCI) typedef struct UHCIInfo { const char *name; From patchwork Mon Feb 20 15:05:11 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: 1745143 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=H5DJbPwl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5N13RV7z23j7 for ; Tue, 21 Feb 2023 02:06:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7jg-0001ka-P2; Mon, 20 Feb 2023 10:05:48 -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 1pU7je-0001fL-Dw for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:47 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jc-0008Re-4x for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:46 -0500 Received: by mail-wm1-x32f.google.com with SMTP id az11-20020a05600c600b00b003dc4fd6e61dso1341371wmb.5 for ; Mon, 20 Feb 2023 07:05:43 -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=HSfxvXTslGwoUF9ppy8jNQv5yhLKiCPbveanE20/VQs=; b=H5DJbPwlSHr0wxelY67ABoyZ5fFi2vxf492DyO97aoWKec/4XhNG7oNSHr3YbGemn0 d5PjctjHVY/FMvnoYgOlqNi1CbCsFAiZIQuADtA2cNbAZR54t1zWzZzYbjXNh2Dy7+1b /3fAgH7PMlMB9HPKYufAkyI1hrdVnyJN6BpN7LSIjgd7jpJgJm4cxb7lTkGBDMPGUteo NZe+2mBePix6VGKDQ5rYRp6ctdHZzlx0JZJG1XVdXpv2PXI44mgP2V1+3DGpM639bS7p FPc5+ZrBqHPiQ81g/yr0ki+2LDcXxng9R5qKrZutdIJdRz5iiVogXqGDxe2HQCWcq/wu CvOQ== 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=HSfxvXTslGwoUF9ppy8jNQv5yhLKiCPbveanE20/VQs=; b=CS9foG5n4wSEWGxhNrMQEfhQQ2igXU5+x5W5VGUrDtb0FEiYfamhuFlcinCHR4kK8W LkfoodEBFMIdPoOPigaspkM2ZyeFK2lE1/DixU67KLpTODIa6nqxSBFokdAhgTSyzM+v dL/1uC4+2MLW7jG0PDE0ZFRzZCqDZ+jzGB66pD0K6Mh/akfb/7Y5I07bLmNwUOP6/CwZ lYKu0fS5WNjwebwsX6zclAVSjmuBltIWcgQlUS/c4sqFJOl3TmOV2lvH3BRgzgQgkwpc dTtEg6lgoJFKb/D/03W+7iLme1eGbdfaErxqkgKBdP5NhQD4jirtDoQRJorwLduYX6yA z3Fw== X-Gm-Message-State: AO0yUKWgIrmEBz/Jh7+zdEu9HccG/vyqxWGBaZG5lMTz6i18BqTJeh/W 1zJBDzaRcxsGJu9W7FaqAa9XflRQpPwGnJi7 X-Google-Smtp-Source: AK7set+6A+Q790Cz/ezfBwA3kZRIfVW0Jg9iHiYM4XQ8fOg2o+7MMfNUvKoyYcWsv/arfdBFwmhVcw== X-Received: by 2002:a05:600c:331f:b0:3dc:19d1:3c13 with SMTP id q31-20020a05600c331f00b003dc19d13c13mr375070wmp.12.1676905542630; Mon, 20 Feb 2023 07:05:42 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o6-20020a05600c4fc600b003dd8feea827sm11410074wmq.4.2023.02.20.07.05.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 5/9] hw/usb/hcd-uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro Date: Mon, 20 Feb 2023 16:05:11 +0100 Message-Id: <20230220150515.32549-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org By using the QOM UHCI_GET_CLASS() cast macro we don't to use the intermediate PCIDeviceClass variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/hcd-uhci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index f77ffda69a..8ac1175ad2 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1159,8 +1159,7 @@ static USBBusOps uhci_bus_ops = { void usb_uhci_common_realize(PCIDevice *dev, Error **errp) { Error *err = NULL; - PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); - UHCIPCIDeviceClass *u = container_of(pc, UHCIPCIDeviceClass, parent_class); + UHCIPCIDeviceClass *u = UHCI_GET_CLASS(dev); UHCIState *s = UHCI(dev); uint8_t *pci_conf = s->dev.config; int i; @@ -1267,7 +1266,7 @@ void uhci_data_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - UHCIPCIDeviceClass *u = container_of(k, UHCIPCIDeviceClass, parent_class); + UHCIPCIDeviceClass *u = UHCI_CLASS(klass); UHCIInfo *info = data; k->realize = info->realize ? info->realize : usb_uhci_common_realize; From patchwork Mon Feb 20 15:05:12 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: 1745147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=mMMpzKV2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5P40T7Gz23j7 for ; Tue, 21 Feb 2023 02:07:04 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7ji-0001lK-QC; Mon, 20 Feb 2023 10:05:50 -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 1pU7jh-0001l7-T7 for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:49 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jg-0008Pc-EF for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:49 -0500 Received: by mail-wr1-x434.google.com with SMTP id c5so2230800wrr.5 for ; Mon, 20 Feb 2023 07:05:48 -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=tJz+z2UXP9NxFKN85KXZvfj6u/KvvDw8qw3Z2QL+l+I=; b=mMMpzKV20DvNI1a+ue0uObqkkE1zAFwtyqVEDHQ8AHLGErcvNa3Os8lAL3aCZRJWln 2KSmeW9ijG9Y+hz+C/0C0wdvCXGR6aHSQVhOZduWVyyoj5zQzP5zGG5Waiorrw/DCV1o O6+fT6QGkWKIg4RZ66pIlRXhbBRJeU95YG0KtTs0OHWYRskTViwuFGBzRwZJxIBuJa6p StX9kpXU58hlgp12BoTOK7EJJKUuHa0yKU/nyHM+8ZEZWXDJu6AUu1cDBn2MzDN3mJwr 7QQTR9ix9pebdWMyPjbrVntfYxUdqje4Guw1Ex0AfS1RELLdk6EsGhGj8p12fVRABFTl FxBg== 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=tJz+z2UXP9NxFKN85KXZvfj6u/KvvDw8qw3Z2QL+l+I=; b=79fO5GLV7e1L5QoYGY8oa8t4oZpH8XM984CoeWQWahTmUuqZAceFISeskbQlk46vZE UKvRERnTDhd5PvtgWSBY664J1rW3h/iAKZxDy67oyGL+kLEgtKB16CHdesGN6G0gYihF /dOCL8nSj7UXzxav1rCDFhI0a0x8LJ0grllUYtakMpG2MWWkzRfkzhPiutDGEvJbpCGQ Ni29yvAO3NPmEVnk2NmlB5JR73XSnw0sO+r3b7hTbZl4ua12VqcEn21FuqVy4htSkG0f PhPysa/jSpTUfLb5YE0jxE/CSnEiNO0Ii2dbcmXH6+9tSZuFGdlzRpgMmNpW0CQhmsIh qFCA== X-Gm-Message-State: AO0yUKW0tkt6lKoe7svJLpu/kNfRBjVxW4l1XD45yZUIXhsg4pAx8XM0 f2Vu/JMxQU+LPh8IRZeAj4OjetTcLynOCwXw X-Google-Smtp-Source: AK7set+WzoYHRkfC+EtMMFfvWQRjVs4gxX47NIOqH0Wu/fRz4inJtbd3dWhDi4MVJval4oDbELx4Rg== X-Received: by 2002:adf:eac6:0:b0:2c5:53e6:9aba with SMTP id o6-20020adfeac6000000b002c553e69abamr1578216wrn.5.1676905547616; Mon, 20 Feb 2023 07:05:47 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id a16-20020adffb90000000b002c54c92e125sm829142wrr.46.2023.02.20.07.05.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/9] hw/usb/hcd-xhci-nec: Declare QOM macros for NEC_XHCI Date: Mon, 20 Feb 2023 16:05:12 +0100 Message-Id: <20230220150515.32549-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org NEC_XHCI is a QOM object type. Declare its macros / typedefs using OBJECT_DECLARE_SIMPLE_TYPE(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/hcd-xhci-nec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c index 13c9ac5dbd..d732be0ef9 100644 --- a/hw/usb/hcd-xhci-nec.c +++ b/hw/usb/hcd-xhci-nec.c @@ -27,14 +27,16 @@ #include "hcd-xhci-pci.h" -typedef struct XHCINecState { +OBJECT_DECLARE_SIMPLE_TYPE(XHCINecState, NEC_XHCI) + +struct XHCINecState { /*< private >*/ XHCIPciState parent_obj; /*< public >*/ uint32_t flags; uint32_t intrs; uint32_t slots; -} XHCINecState; +}; static Property nec_xhci_properties[] = { DEFINE_PROP_ON_OFF_AUTO("msi", XHCIPciState, msi, ON_OFF_AUTO_AUTO), From patchwork Mon Feb 20 15:05:13 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: 1745149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=dXKm87Ov; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5P76JdYz23j7 for ; Tue, 21 Feb 2023 02:07:07 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7k5-00023q-Ds; Mon, 20 Feb 2023 10:06:15 -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 1pU7jn-0001oh-Qw for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:57 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jm-0008U6-8s for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:05:55 -0500 Received: by mail-wr1-x42f.google.com with SMTP id v3so1462948wrp.2 for ; Mon, 20 Feb 2023 07:05: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=p8o9rMHYIWugBzDHKzJd9qgUvI0GxAA+Ds+7D1kDUBM=; b=dXKm87OvSP5t8PW1VhPsHLOYT9xOV5RBpPkg0viuHrxaBLSMDwyK9WyS0P0WvJqq9Z nQsJKmGynhhaoa3VULViKj/X0t9nQY646RqArIXdw1aUFzRtYvxNu9YOJUOtbaOd505p lbldkY5rmBe5CfTSI6cwQqxASSh20HdkVf22RRS70SdgtNFPA3Fotx2tXKGh93VRHkkI BoVJYmeKXcL2LbeNVOAhJeJAD01yV1v2daZ7s75rmDBnCt25f16lGOmzICUZmfv9RcbR BbDjbi1p5Lk97pgBXCnQqxJ3FSc+7KO0FlQCFneeYgisWyLAVeXxkaXUFTIvqVcjWMzp cnLA== 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=p8o9rMHYIWugBzDHKzJd9qgUvI0GxAA+Ds+7D1kDUBM=; b=FKaCncCYz3EPq/Dunz3KrCEsGqVNkeh4tGgEN9gBGEjVQxXgjazY7pCqrdy4r1qjsk Kw3xlgBFALaWjAaPsn1dcdTK5i+WwMsDC3Ca16xgndcbotxoPKGCZunw1JU77pXSnRpU 85zIoTXjnYPU47uZB5q5kVgAGJkavJCiR0aS7m6C3lZF7kj+97k0OYU27AyMPiGu42Hh FwskH96jJgO9HAj8gvNjvc3TeikJsAOKJ6RWyHa4UpaXSQcaQ7Xwo0znOX7da+1wr6Ib ZjoDydNP5MoVxe2b/kzi5uP0ZbTheSDVp5AlN4CrnT7rrij+m3R9gYT9r4ZBYLoHVeF9 z0oA== X-Gm-Message-State: AO0yUKWqb4tuDJZ5jvpIcEJWSXDRtBea3ITJc9U52ZXb8voOp7N9uz7p W143ma7plCNvTSg3mphm8/HhNfx3ZhM+FFHq X-Google-Smtp-Source: AK7set+Fr+RlRaTSgA1TIOlDInqd6M5dPOqikpRdcBaMu0dyb4K5F0wuH0UHZvPQR0zDqTnIrIcXiQ== X-Received: by 2002:adf:ee43:0:b0:2c5:afce:6080 with SMTP id w3-20020adfee43000000b002c5afce6080mr334045wro.12.1676905552497; Mon, 20 Feb 2023 07:05:52 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t5-20020adfdc05000000b002c556f36116sm4133914wri.66.2023.02.20.07.05.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 7/9] hw/usb/hcd-xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro Date: Mon, 20 Feb 2023 16:05:13 +0100 Message-Id: <20230220150515.32549-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/hcd-xhci-nec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c index d732be0ef9..328e5bfe7c 100644 --- a/hw/usb/hcd-xhci-nec.c +++ b/hw/usb/hcd-xhci-nec.c @@ -53,7 +53,7 @@ static Property nec_xhci_properties[] = { static void nec_xhci_instance_init(Object *obj) { XHCIPciState *pci = XHCI_PCI(obj); - XHCINecState *nec = container_of(pci, XHCINecState, parent_obj); + XHCINecState *nec = NEC_XHCI(obj); pci->xhci.flags = nec->flags; pci->xhci.numintrs = nec->intrs; From patchwork Mon Feb 20 15:05:14 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: 1745148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=rdS4B/WC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5P63Xpwz23j7 for ; Tue, 21 Feb 2023 02:07:06 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7k9-0002G0-QS; Mon, 20 Feb 2023 10:06:19 -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 1pU7ju-0001t1-FI for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:06:10 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7js-0008Um-RI for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:06:02 -0500 Received: by mail-wr1-x429.google.com with SMTP id bo30so983088wrb.0 for ; Mon, 20 Feb 2023 07:05:59 -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=Rwk3S75FdqWeTle70LswE0cg7wHk0orFnQPLyZ5g350=; b=rdS4B/WCFnvVO5TKYbKcoQK/WeA9T17pLMTOkt3wcMDJbyTNGZo2NcMKcZMLFztdlY Nw0vyvHeN8wnYCYBixoHw50+uYX10oNRlj+tKB+zVkJVXDO/58oOljosON5Z6/CHx3rx k6fwLBMUtYt1vrcO97UAlGu6kUCN82ov+wRzh00nBd/UlG3sRVI7ejix9TNIAYyyrdxv fgoSkLXVdl//8JWnWjf84YOGRvoYu5MGWmR85r1BNL3Rw8E/tsZU9fd6ANL9aAhjHm7D /QdnTeAl+JyYi8BjGWcDMKU+vYI35wNTxak8GHNTQIw3xRkS6mCtgvEwYOms1y2OJciw Yz0g== 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=Rwk3S75FdqWeTle70LswE0cg7wHk0orFnQPLyZ5g350=; b=rEiz/kF+n7eyzGWFct5NU9cKUhwYZuJ4WUPX88HKVPRtIesucOHlJ0kA/d9cQfKTuw DEueZXXDksKUReqwRkZPIECjk6xy79XpvqMiOwrGHglZixd81yLHGz3iTyPgVbKl241v MXFTQMSRS7oDFhLoMtv3ToEJvBDLnJb9wmANhnmeshVuvFJItJ0T6snC2pFRYxEibiD7 ThLEzQyPTbwSWhLaBSiv0Nz/95T0K8jBSf/ShktCAlTnW6Z4Ys8rh8Asf6gbW/hXnTcB OlIEmSLhjWTIlPlL2L0N4U9mHOoGN/lOdCpw/rYFL2e8uf9Y3+PxL0Be5HZkzPlxTZ+Z VJIw== X-Gm-Message-State: AO0yUKU78PK6a4RGKK/1UPESdceElQkNPCFtv5Qg/eAIwG6GFzRPO4Am CaDBXZjlvBtCT8YzP3hFI12zWNMcHhnWZ5H7 X-Google-Smtp-Source: AK7set/roX5wuRRwTdlRtsijr0lBSa2FsN9FX7wsbjw+iSMlCc43HtDgsjOEbxL4OFAUigSTvwrD3g== X-Received: by 2002:adf:fc12:0:b0:2c3:e20b:82aa with SMTP id i18-20020adffc12000000b002c3e20b82aamr1973309wrr.22.1676905557565; Mon, 20 Feb 2023 07:05:57 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id y1-20020adff141000000b002c58f199a49sm11428923wro.117.2023.02.20.07.05.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:05:57 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 8/9] hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE() Date: Mon, 20 Feb 2023 16:05:14 +0100 Message-Id: <20230220150515.32549-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org hw/usb/u2f.h was added by commit 80e267f1d1 ("hw/usb: Add U2F key base class"), almost the same time of the automatic conversion done by commit c821774a3b ("Use OBJECT_DECLARE_TYPE where posible"). Manually convert to OBJECT_DECLARE_TYPE(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/usb/u2f.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hw/usb/u2f.h b/hw/usb/u2f.h index a408a82927..8bff13141a 100644 --- a/hw/usb/u2f.h +++ b/hw/usb/u2f.h @@ -31,22 +31,16 @@ #define U2FHID_PACKET_SIZE 64 #define U2FHID_PENDING_IN_NUM 32 -typedef struct U2FKeyState U2FKeyState; typedef struct U2FKeyInfo U2FKeyInfo; #define TYPE_U2F_KEY "u2f-key" -#define U2F_KEY(obj) \ - OBJECT_CHECK(U2FKeyState, (obj), TYPE_U2F_KEY) -#define U2F_KEY_CLASS(klass) \ - OBJECT_CLASS_CHECK(U2FKeyClass, (klass), TYPE_U2F_KEY) -#define U2F_KEY_GET_CLASS(obj) \ - OBJECT_GET_CLASS(U2FKeyClass, (obj), TYPE_U2F_KEY) +OBJECT_DECLARE_TYPE(U2FKeyState, U2FKeyClass, U2F_KEY) /* * Callbacks to be used by the U2F key base device (i.e. hw/u2f.c) * to interact with its variants (i.e. hw/u2f-*.c) */ -typedef struct U2FKeyClass { +struct U2FKeyClass { /*< private >*/ USBDeviceClass parent_class; @@ -55,12 +49,12 @@ typedef struct U2FKeyClass { const uint8_t packet[U2FHID_PACKET_SIZE]); void (*realize)(U2FKeyState *key, Error **errp); void (*unrealize)(U2FKeyState *key); -} U2FKeyClass; +}; /* * State of the U2F key base device (i.e. hw/u2f.c) */ -typedef struct U2FKeyState { +struct U2FKeyState { USBDevice dev; USBEndpoint *ep; uint8_t idle; @@ -70,7 +64,7 @@ typedef struct U2FKeyState { uint8_t pending_in_start; uint8_t pending_in_end; uint8_t pending_in_num; -} U2FKeyState; +}; /* * API to be used by the U2F key device variants (i.e. hw/u2f-*.c) From patchwork Mon Feb 20 15:05:15 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: 1745145 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=xV0y1/nX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PL5Nr5C6pz245j for ; Tue, 21 Feb 2023 02:06:52 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU7kH-0002UG-NB; Mon, 20 Feb 2023 10:06:25 -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 1pU7k0-00024M-J5 for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:06:11 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU7jy-0008VO-DZ for qemu-devel@nongnu.org; Mon, 20 Feb 2023 10:06:08 -0500 Received: by mail-wr1-x42d.google.com with SMTP id t13so1467229wrv.13 for ; Mon, 20 Feb 2023 07:06:03 -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=qkM29ZYnS80tOuTl6ndvH0Cr2j3m8kabXDaXkwn7EWs=; b=xV0y1/nXiJXWfsgXH359JNNC1H61ZrNTma9hfWvppEhSx3TrrIB3NA+T0u0DfoJq9Q wTxmtTBiXERCPC1cX0rj3CenoO2V11GEtWpN61Rfo9XAJFJk+LVRKmFNHJMHn2ZyT+1C PiMoEFzMV6/aH7vM27DCiMxLjBcjBXSoKQSJ6LBSS3W0ke2jl6dffJOM8khHiF1WWorK VVAV7Iq8r+9aMaCGG50aWJByqYd3xtRT21FVC9A6lLt6vQ3R/mtOx5zrp0jn6WRhAvhJ tXqCfklNEydlZQjVHVHP/o1BSgy3ENXSN1SfNtJJuFLiUo6Zx5ya1LNu5CzjWKOFEh4t mmOg== 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=qkM29ZYnS80tOuTl6ndvH0Cr2j3m8kabXDaXkwn7EWs=; b=uoUlw4orzE3Fbg/1WgSCCAV0qWcoPjlEhYMsILhKGPLcPQtlrnZYAoH2rTbCG1nD9A UDdlpHWnaC+GLHo8FA6ff7Dmz77axT7+6SlMGTu4JeJJwwka7jEjtqjUwC6DL8VNAJU0 K8VNLoNvAkxD/Yhgjnb29XBPwuPzrmThUxphM5CO0m/B1UwFZwyc/Cl8+CUF/sjOWPhe Ke6kVbKdGdEqTXgaOuCfX6UzlxVKX1TaZmAg9T1a8IVqKpBl/07U38sOjCaMrGKUk1Cy MEvKzyIsQXxGSYyY2Gbkk13T8TL0hYNrWLpolBMIKEfXKQpGCBmkVXfCop8v/fzd7w9o FLmA== X-Gm-Message-State: AO0yUKWGDVlHwv34ocMY3DPdd/QsqwZA3surMw5Bv63yoPLKL8P0UlBr Q7SZGdsd65tE6F/CutDWKiQ7odzbyGQetluD X-Google-Smtp-Source: AK7set+ZQetSGsq8kf85jT4wjshhQOk6OFSxAKh4s69hJtKvpOlaO0KxjTOCUha+vSv6CreEQih36w== X-Received: by 2002:a5d:4610:0:b0:2c5:98f2:5b16 with SMTP id t16-20020a5d4610000000b002c598f25b16mr3257738wrq.1.1676905562416; Mon, 20 Feb 2023 07:06:02 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p9-20020adfce09000000b002c5493a17efsm12617632wrn.25.2023.02.20.07.06.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Feb 2023 07:06:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macros Date: Mon, 20 Feb 2023 16:05:15 +0100 Message-Id: <20230220150515.32549-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230220150515.32549-1-philmd@linaro.org> References: <20230220150515.32549-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use the QOM cast macros to avoid accessing internal fields. Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/u2f-passthru.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c index fc93429c9c..b99c0b622f 100644 --- a/hw/usb/u2f-passthru.c +++ b/hw/usb/u2f-passthru.c @@ -299,7 +299,7 @@ static void u2f_passthru_recv_from_host(U2FPassthruState *key, if (transaction->resp_size >= transaction->resp_bcnt) { u2f_transaction_close(key, cid); } - u2f_send_to_guest(&key->base, packet); + u2f_send_to_guest(U2F_KEY(key), packet); } static void u2f_passthru_read(void *opaque) @@ -316,9 +316,10 @@ static void u2f_passthru_read(void *opaque) ret = read(key->hidraw_fd, packet, sizeof(packet)); if (ret < 0) { + USBDevice *udev = USB_DEVICE(key); /* Detach */ - if (base->dev.attached) { - usb_device_detach(&base->dev); + if (udev->attached) { + usb_device_detach(udev); u2f_passthru_reset(key); } return;