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: 655100 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448419wrc; Mon, 20 Feb 2023 07:07:11 -0800 (PST) X-Google-Smtp-Source: AK7set8Uw911omAYj0vYzFXfdY7ZtAxLXmFUfljSW7SZD2cczE1bazeU2FIxsbloWju8JgsRc0TL X-Received: by 2002:a05:6214:1c09:b0:537:7061:89d7 with SMTP id u9-20020a0562141c0900b00537706189d7mr4809339qvc.40.1676905630798; Mon, 20 Feb 2023 07:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905630; cv=none; d=google.com; s=arc-20160816; b=J1UdE46gnbO/tsEazxQFoL6L6k1ZSJW+qXb6IBawJcFcSxyoY1rUSVDu+pRF5GpInG uv1OmC4uXTIaU/WC4ix7XoJv/FEXn1l827J1ExKGFizJqOc90kcSPrn7CO5b1poY2X4T hPGjN3ENW2+sPXuC1szh4t7llgQRFu1wALbcpqH3Axpxgh8lmp6Tl/wCnUanxrpb1kpq N3Pn/QWEFb3SFu8aLwjcw4SwTZiVIsYflEWSuqvQ8PHiL7rl93eGWnQ6wHDI1ek3/J+e znz/zamirFMG9jUpdsVPAPVrBQefLlk5M0u7bf+5vHYGcvnVCIFAWmfvKzvUrHc5oWlW nFgA== 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=alpgVL4TtkFnvxglkaFOS7JafAYOgPwJn2AublwKwWs=; b=Ps2ZSiFosdPGOsV72FbxnSnh4iuD9L/it7BQdVcJWZADtzsZdbYmiZf2FKC/xu1qF9 ttLxFxFKiboU+PVALL4ZBt4KcokBkXo7OpYar0cWoK7MkHyX5QyIlQgTf9Jy7wpFEGP3 B6t/QfsvHrzfrkS9YT6eJ5Sj0hs0SHcA/95wVrjI7kUjmg/EViVIJDfnA8cZqxxNCy2T 23SQlpOB7CmQeMMHJxi2TwYb67EOuaeaaJAjV2rMJQlBMUjw7XopU7SAeT0hu1HZI7pd zEmgq28rP/vszUKeE8Y050eyIwTbuiLPfnfLCUW8NjMHxaSXqLnoRpTHiAG/JF9f2Qgi r4dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ASchb6As; 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 c13-20020a0ce14d000000b0056ef6095e5asi3248228qvl.419.2023.02.20.07.07.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:07:10 -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=ASchb6As; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655092 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1447373wrc; Mon, 20 Feb 2023 07:05:46 -0800 (PST) X-Google-Smtp-Source: AK7set8ekB3dzVFTufVAebqB9twrWGWnAgUlYHiQDiB03YVzNxuNIZdv25F2o90u+ov4aDUQ22Kb X-Received: by 2002:a05:6214:2027:b0:571:f87:a665 with SMTP id 7-20020a056214202700b005710f87a665mr4126262qvf.35.1676905545928; Mon, 20 Feb 2023 07:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905545; cv=none; d=google.com; s=arc-20160816; b=OXqqpFiYcBVUG+zEmTJ2MtqbDn3BxO34ZUZUnhY1kMMlbUmXPYVHe0MDf22KQXNjrH b3FkeDI9G8OcRin3b9Ju5LRrgpQL7sUGzvzhiPa0tZBOr1eNtsyc3Ohyczx6p/7cxTFD O8VvjBVrUoOyG3iY8xnaS3Np5+MvmNNpHHZKxlLDfLOx6zaoereZM7Zy1kjXBx3dS7qI nk/mGgpQSimhUAYMS7p61K7ZUf+bulDg3CCGnj0qNtCVKq0IJ7nqqfqOdrtnJ7KA4mEG mh7xkcnU9FwkSsz6JUrN6hRrdQpSyp+ofOIYFv4J0M3h1qIofQhmYC80mVUqZ003zstC JKmQ== 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=WvQXFHkymgCugjl5w0M5Pkt74ouZE927KClvNUr2f1I=; b=BdxgIRr6hzRtAD+GOdM53DigqF86AYoMm0VBx5bY3ibpp3vrE4DZev7KRagwvV3pwT nSfX8ykVoCcSpcSZYx7WYbHkx+MrTx0lkH23RDe1MRBw//taEwvRjcqcIYRx+VjaMglj kssYzGKl8uzhLhkSjOAqG6I8O3iqCRydTJ30DY6q3ZaWS9SrIsmAHLtabgFa3Tg5l9zW DMWGQKByIyHylNt3pgfnb402/k0rZm9PE0nnjioB6EJpa0L5MD5xLDgPhb5ptdU8Xlq1 2QAVij3+eGIPCmGou9zComFOuEpPw3P29x2HBZ5uJapQpcqU5ub9bVqcnrjq+kZiGjF6 OhKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oNbyK5bm; 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 q11-20020a0cf5cb000000b0056ea39b7a0csi1124840qvm.235.2023.02.20.07.05.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:05:45 -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=oNbyK5bm; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655096 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448306wrc; Mon, 20 Feb 2023 07:06:59 -0800 (PST) X-Google-Smtp-Source: AK7set+A4mDSBt6EmAqcmQWEoe74tgCAnOHPjNk7gGYRG4xUzlUF5liILV9zGatkQkz9QfDLB3Pa X-Received: by 2002:a05:6214:625:b0:56e:bbd9:1c10 with SMTP id a5-20020a056214062500b0056ebbd91c10mr2159964qvx.7.1676905618750; Mon, 20 Feb 2023 07:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905618; cv=none; d=google.com; s=arc-20160816; b=Hemg+8xz5OAbK40brmL5NSlp8t0MXXI+mx6tdr191VG9/qnjyitec8yZOnTtfPJdcW WUupar9yOgvGIeYG292m+UrRQqfl8M45QZuHdxjIVzE2jBNTTO9a3XLni8LO8zk6Mlzk ODt/UGyh39ZynDD53aMG36P2fbwR7Sxr+KtnyBLrkw7n4h+fZkFn4pfO2eLtvhbTuE72 rFL2UIy0QLUZOqvGBKw1TXxQLkUtpVIdZsUVRU2V6PTNR50r+oDWAj/xlFRiwXFWm/cb 4bvtGnFREp+y/HfUY3Nnv5pVf5SHf8nXrA54z3l8KS7J70gulA1RARTLH9lqNwC0r/45 5cPg== 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=7fg6HCxs6YpFo/+46boIzya1hKfktdzojAtH+afSJyQ=; b=lKtP5Tg/qTRXKxYfq9dbPXwEeyqJ15a17E1zcA+gJVk0tzxxTXx5TsTeH2JDkg5MWz 8PQN8FNS4VUGbUM2xqODsA1+50pjuSWfBUBpuTuioTAxVFyuGhRtPxmppT73k1E0jV3w GAQaI0pMM10XultcMvSpf0uhs3+s4KUCR67JFjIX7hXK3kH7dPyEatQGDtrPIrnQx/MG 7JcIFZauyDfyJY7JQx+fR7kcDVHmfKz0zooMbc7GB9qGxXiF+8bjuD8XLSqOwZgIa6me gpHR0tyb1Tyz1QNHko4CGNsEaS73AjyO1wugB8UuQVYDnkdHFWwp/M5WgqTNWtsFuIxi 9Cmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r9D8/sZ5"; 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 191-20020a3706c8000000b0071a74355a29si9826265qkg.289.2023.02.20.07.06.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:06:58 -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="r9D8/sZ5"; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655094 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448189wrc; Mon, 20 Feb 2023 07:06:49 -0800 (PST) X-Google-Smtp-Source: AK7set+WbqEZ9I12zmm8oq+LQw30fIPbbPJV9IG7xm3rAsxHK95iRjZpfmi7gpbeGhIS61SSzgNF X-Received: by 2002:a05:622a:308:b0:3bd:1bcc:d964 with SMTP id q8-20020a05622a030800b003bd1bccd964mr17159184qtw.32.1676905609072; Mon, 20 Feb 2023 07:06:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905609; cv=none; d=google.com; s=arc-20160816; b=W4ipzW+BHyia9LgxPtbkv0ZedAT0FQ6i6dPRKhnJmtcukAIpna+cDOwOXPfDpAoFtZ UkX4xm+iwNuVVP0pFgh6/04VaEzckcGZPAcqru4KkljUrCEPWKekkrTdVnU2BX5QHz9H IrflB4FU7fz9PyO/Vd9NktoI7KBSCS1Oi0qut2tFA0ZPeUv/UnLo+lMSFmVDMHyJxwNU oBpAb8mpsRDnxr4Dc3jSrsla+RDeXeXtBPjJs/hfbOpNR1t6DKZ7F1GGwb1Pydo3FKQW yyLPRnZnDb469mi4VeLkCX3pPvqPxx6F3T232qpJv2/2rC+5AXuKRV0XJmHl90KGbKNQ V49w== 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=9u15jpuOfwEVXLJzjPb3b2l90e4PtdG+UU4bHmgsE5o=; b=ombzSLOqazz0EEEcAqkIkAAig9+ZkNdSWrurlKizeD+HyEC7h+MCQ+z6wbNELuwQAK WLRC3sOOh6wFt2YomzgO7hrrdU0sYNMjAfMES9RN3JWi2r5YrqFxF+qvLKxy1n/+fZBB whkYyEyZ5yljEHd1loiHQ8rUyhnq5dVixq59nxoYLwrN0vOC9gLKgwpofKJyn+d7LYrp 2mFW0RTq09VtcE+iIGIhk9CI9uOT4ji/rtRa4goB80DNrYjGGC/HDqW0U/m6ocOg68JM MhZqv+0J+4LMfAgI2z17azvAMBJgfgDDgvzO2EpvcftKXVRs4iCL1pY8ru/L6eE5Utxo 9Q9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RMWeA/1D"; 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 d4-20020a376804000000b0071a7a156eebsi9634838qkc.240.2023.02.20.07.06.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:06:49 -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="RMWeA/1D"; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655093 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1447677wrc; Mon, 20 Feb 2023 07:06:08 -0800 (PST) X-Google-Smtp-Source: AK7set/+noDYrg/IolBR3abZ6xkrPiv8qpIw6LuQQXG2Zm7p0yEgRulbxZW9JNxP3XwUQkMOUTqg X-Received: by 2002:a05:6214:c66:b0:56e:93de:59c6 with SMTP id t6-20020a0562140c6600b0056e93de59c6mr5410260qvj.37.1676905568142; Mon, 20 Feb 2023 07:06:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905568; cv=none; d=google.com; s=arc-20160816; b=Zh5XmBhEoQ0hoDX5KxC3iThOsJ8BFbR+BR98OnbWWmy2xT4wVpuGtxRO00PB/mkWQX tObcE3QR6YLkstmSyz0VKaqPCzB0EG3UNB2t+C58VshbeYFfpXUMLTdMf0FMDoNv9ncL Ji3vNByMHquqvvIy435R0MIQeK19TUSWZ3ovrJAyao1vx290XGuwgg5B/XpvTX4qaSfy 7uOBSZQJtyn+x7ITXRmGddJogpDhRxoXMV9RyyEA/vG+iRNrl6j1j+lvaIWlbFDz3fiM 9g2ty4JfXIbODANKDbvZtnBIXTd6jo3Upai7yY+0dg2pk6snTXkSq/lVv8RBU5KuJaHo MuQg== 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=HSfxvXTslGwoUF9ppy8jNQv5yhLKiCPbveanE20/VQs=; b=E6ptQJr/v+hJmCL7py4lHq11wt7De9Nq3wOCt6dg1S9y4oJqjPiAbviW/NRoznt01i BcI4jWp86qDBfF0aNbQochThtfvZkS0gpPV6qgsB9/HefJlqO6lqx6Tka2E75xFuAovJ /Wrdswfp9D0Rn2cYO2LgwcuKlWHI/hrVc+95d2KRYTt3dZFlLkjLc2oeR/OEDGSjK1Za 06KaEEqg5Y56LW6/Zf9gm2faYZ5MEyt/wmNxdfiaDW8wovrikSjCeGwyXaCqr8S883if yu4eaiE3a0BMSlttkz0qrEEpdIMMvQD1Ri8a+VIuoOmJB71dRPAKMkHjX5LS3T/PzAv3 bMdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H5DJbPwl; 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 fh15-20020a0562141a0f00b005517fd5c54csi9557380qvb.516.2023.02.20.07.06.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:06:08 -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=H5DJbPwl; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655097 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448355wrc; Mon, 20 Feb 2023 07:07:02 -0800 (PST) X-Google-Smtp-Source: AK7set9ZdVfkPTczFjJIXACVUFWRxpzhyhRKYQrurr4Be0Rsp9UDg90pfVF8jUKR7OxDPWF8u3or X-Received: by 2002:a05:6214:c4c:b0:570:6deb:c284 with SMTP id r12-20020a0562140c4c00b005706debc284mr4139873qvj.22.1676905622512; Mon, 20 Feb 2023 07:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905622; cv=none; d=google.com; s=arc-20160816; b=TVGsiDpfko8kPhx7w2ygH2mMGMhK+Zbuex3w7Pf/ufyQabNfwOi4H5o5YeSn6wAMmN KlEi37MtG+tbzE6GVg4Ugm7k1vPyiE2oY4CF97i1GJkqj32uZp0+eT8t/cVnY9NxjNxc TOA1/d9CH8k9oEQFCsnZHW55n2CbP4HcZ/OJpPBAncxF503F3aX5M0Bl2Wu2o7k6zO/Y TcjMUdVcTEVB3AaQzKumWtBzdBiUyNgolPFY4thZm/X5V6vfO7SWJnaUyegJP6HaEvnl UniHRVI0Ve4YH0Sr4qzKL/3sTteLrFya9u9wQ6kwBTE16eZ3Cgu/pdADBfUFnbJhJgvW Oh2w== 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=tJz+z2UXP9NxFKN85KXZvfj6u/KvvDw8qw3Z2QL+l+I=; b=wa9qEEGLxAlcdWozbtaIn1/mfylhqGQzOQ0ccnE8WRSmGJpnM8T8hrJsPASqle8m4u NBIP2F9i27G3PPnFKeCdjf8E4/ZeUoki7DDnxS9kiw0c6Pp1s7+e99nqJKqyVfexnlkc 7J1QvSIwyigfrl6K+E+xO8JfUKcc6VkBTSeDJDLWS70QwJv5qxSJsSH/12cc6D4VZd+X U65AJhYrxZ7uf6QwntCH3IcXkXDfNI2Gq2EDUehs2aFPUDMrz7yEdd2B970ij+rHIlvT r1sz2q8TbsP1SfIwKVoM+yI/NIlkFxMZpBrwv8nWT4UFAWKMtesjQOBXJQzAsp+WSqAR khXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mMMpzKV2; 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 c194-20020a379acb000000b0073b9f3c5ca6si8343041qke.405.2023.02.20.07.07.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:07:02 -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=mMMpzKV2; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655099 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448394wrc; Mon, 20 Feb 2023 07:07:06 -0800 (PST) X-Google-Smtp-Source: AK7set+gLwIWeMnHh2Gke889IEGveTU1wMvkC/O7G9PLNawVhGWzss+JtKWKsIHIOMRAfP34rctv X-Received: by 2002:ad4:576a:0:b0:56e:a07b:f4d0 with SMTP id r10-20020ad4576a000000b0056ea07bf4d0mr3939272qvx.23.1676905626323; Mon, 20 Feb 2023 07:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905626; cv=none; d=google.com; s=arc-20160816; b=gb/4xXaPLwUbNSrMsKzEaJ7l7ziTZBTkqdE1lU05dmI6URzJGKhKgcHF2WWXKhGWSb oyFIstWvzdMyv2WyoeB/jdV1iWjIoMEqQ94p1LJ21K8ymkixbZyvTRBQu6mQtT+fgvi4 yiwkeh2HuePrDh/pjXwt4WI6KwG9u/j6HyFHHbOwIqPNGlFYj1C1mSyzg6Ey4Y+XcFYY 5J1nDBTpMNQQuQUNsg1V0aFkMW0/aCqTNEA819w9AMo7D2tTM62yz19NmQxhY5l3klKO k4hgnZjkZPL+BceiHE4ao+Gxhj5ZwVkzqffi3gwv4EZCpMVPDB4IBR3zW3Lx3xhr36mR 2DEg== 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=p8o9rMHYIWugBzDHKzJd9qgUvI0GxAA+Ds+7D1kDUBM=; b=Lg+BZC10FPjgZlmWveE4kGVKuSCtwDy2PMPqz1b/ldIPfOi04loDSV8+NBPEu0dqAu 41lE5rzRB8ebu6VrqM/FM0fA9sKEF2naAiGDwZVX3+kWZRItL/dG+rE8yh4XsvGLbDz6 aBMvoQiNo50zSnTnF3RjKgtXdAr4UwKLymd0S2KlFOOhWwOnSdnvekjF/hOdWJCUKXVc oNPnK/xYY3dfwqSNsBy1i9A1H2GTzoAvFUegBN8ngXZiJ1x8wiqXf3TkmSCDTHa5vc79 Sg9tYjrrTcNaJs3aiLb4Nsaj9hNjiCZhqyujephy6fzBblxAWlkabXh1C7eZiLEVg31T 0T+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dXKm87Ov; 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 m10-20020a0cdb8a000000b0056bfe779a68si9408805qvk.116.2023.02.20.07.07.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:07:06 -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=dXKm87Ov; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655098 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448383wrc; Mon, 20 Feb 2023 07:07:05 -0800 (PST) X-Google-Smtp-Source: AK7set9nLlsgRJbFU75LvQpAzXMWjixvqNgyD4ifsAkvMfLVx1lbiTKmfpFCgHfIpUsr7FeM5L+w X-Received: by 2002:ac8:5a42:0:b0:3b8:6a9f:9144 with SMTP id o2-20020ac85a42000000b003b86a9f9144mr2821932qta.46.1676905624953; Mon, 20 Feb 2023 07:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905624; cv=none; d=google.com; s=arc-20160816; b=XNhrXGCTbkxtobATtbnTJL7BuBA3kgQwBcWk47wVo6siBfybBrg7ABdfL3ulHxmBEK J027HQRhcbCzsV8GxPyJtwHwFQ2mZq13jb/2kaO2svdseRFuyR4aVo2/TagRKVmDSW6O Nsypgl6vvqmhY2K7wgHBoiSJ50pj3FG+WWpSTIPaetk2xkWTEtsqfUu9mCVNzENXrvRQ LemxxT+P1F1KJ8zy5OiSvNypyFr0mcuGpzy1fsN/8tmx2qyq+xN0Sdg/jnS61wgxyAKK WX+/IhJ8daCPl1DidIuo+sjfOZspjxPWZ/x6Q0GmFzzy894mDdfoDfmpPQZLkZbyzQKj QoMQ== 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=Rwk3S75FdqWeTle70LswE0cg7wHk0orFnQPLyZ5g350=; b=UpGvII+Fam013SlJtsddKp1/xu9KcPh+wsq7hLB4bzOJ9TeyJCfDR4x4n/N4+6xaTQ LiueIbIDaVnzLKdLgwgkvjPFxsWjuUrGXml2Pevf4EuUMpodurZWLvocnwnYZUy94fYw aVO1AJd7hBL5C0ZjSrVl8eDsNwO6CdLzBw3PgSO6pWBiFLqZm4JQD6DTOD/Dx4HoAvno X/6LyLY2M0jVFpkBpN8CdeJHA9uZryJ1IUfnIMfb9GdXXa1gqVqWiRh5QQIPgYDRtivz c52+bI/wpTOxDuUJrmOC+apiZNp29vVwhJFgCqPRb2ZIRCtM/z0aXAkJ2M9d3kbDZQro +rag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rdS4B/WC"; 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 z11-20020a05622a060b00b003bb97f23f46si9648879qta.777.2023.02.20.07.07.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:07:04 -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="rdS4B/WC"; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 655095 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp1448223wrc; Mon, 20 Feb 2023 07:06:51 -0800 (PST) X-Google-Smtp-Source: AK7set9EOuoLLVsuX7MpHOxS8g1HkJER/ZPyIl3T5g5Eadl0HcVWpla5bBL0cVaSdesE5qj/n9MF X-Received: by 2002:a05:6214:20ae:b0:53a:5812:143c with SMTP id 14-20020a05621420ae00b0053a5812143cmr5114792qvd.20.1676905611353; Mon, 20 Feb 2023 07:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905611; cv=none; d=google.com; s=arc-20160816; b=fJmU2xQ0Vh51AoE2C8nxcXrVowkvWNPkmGUe71/jDzyGJS5rqw6ol5zmzqdXkLbCAA 8gTCmIU1MDIrCcgAUesRJidDy8SbT9xj7/eYgUi8y1Z5Q1l2dgCx02fNAXCrD+KlNLCb C+Ps0/9sq58K8BZ4B2LAb++0PYId6+1jc4V66hL8jdZXdjwH/Ub6yRAL0u7JmxbVoKPA VgB4D99wMHGZf8IEDw9fhj1/gSfvVHeU73FS4+z2JraYK4iCFxyyh0s5SdQ1qGpC0v58 /nmFnJqGcwRelnhKtTD5TcID8lZtFMvYTQ7vEYgSAAxHoqf9xoso7UxUiSkzbBcWPj69 InpA== 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=qkM29ZYnS80tOuTl6ndvH0Cr2j3m8kabXDaXkwn7EWs=; b=AhVvD1lvbw9q8xTg6EsP+Tl7vS+1HeU3T1dQriU/cliKOzReX4XZ6CpK/cEE+lh0NK R0mC4xClaP7tepbWaxYa8TO8ZS3uC3Z6P4vd9TV6NU4RniSS/Jymms1VHNPELCKg+2// SEp8Dr5bYB8tJ4XJ/D2llDdQBR1AMk+HorT+AYQsz7DFCibfaKHz8TOWOCb3Vn9pTAxh oDuc7KhJbq+/IAeuLkJ9aBUg5vb8KD+tYSCevsaD5PFqMu1QbN1ckQDrxKzQXwyzrI6a F68UB0YSFJZGPvqnVtYDD8cPhOrsC6O3HkSb60cB6O4YcpiQ7ObnpiE7r8Ah9yGbS/ae Dt7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xV0y1/nX"; 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 b17-20020a0cb3d1000000b0056e90e0e936si1944389qvf.58.2023.02.20.07.06.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Feb 2023 07:06:51 -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="xV0y1/nX"; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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;