From patchwork Mon Feb 13 18:43:31 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: 653217 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581829wrr; Mon, 13 Feb 2023 10:47:09 -0800 (PST) X-Google-Smtp-Source: AK7set+YU69l84NnIhM+UvGi5v3A5G1oEUivVoQGEgj0E3YG8E3b8mvkqJX8i2qz90qfL2jHPvj4 X-Received: by 2002:ac8:58c5:0:b0:3b8:6bc1:1570 with SMTP id u5-20020ac858c5000000b003b86bc11570mr33193661qta.23.1676314029628; Mon, 13 Feb 2023 10:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314029; cv=none; d=google.com; s=arc-20160816; b=i1/G9lu2INLmDhW1wbMacvVzWESlzcJ0qR66QiFTKRV6pyNs101Fpcynb0X+DHzF/d azjiW9XPBYRiHv8Jc9pdrcLvluXwxBYhWVzCxIMKWZWewtX1OL//+7u897eGjcjfmkkX 2DyZbbEOs+OMoUrCm46vISAIhmQMieESbF5cggnYVf+U6cDt1e1HvYvYvttb06a9mePm Uj46NQmod2BtKxLkp1YJePoJLCykQ5WJAIshhclXn82B3r18LqeKxo6XWHIksXouCI9i vCw612LF4QItZI2MyWwdClMtiM7+aj10GnYZ4Qr6SZc0YkNePYMSwnvwWsSAbjZ0N6uk Is/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=rd+6FPIT6HVJGbPZKi2XYWSbww4/pXi7UlIGtnSnPwXPQ3O50lk1Ce3XVi4HJ27uR1 7Lg2tN2hCnN1lOtYbCP9EZrTk+FwemwP4HRjSWCIfu86VFLjpgzLuU5p0lPa21fdLot6 3ss9bc6pKtGUQXo1y3dMANqwWMGS3tkPq9rCT6CRaHrfHevl4Kf9mowrDB3PMkpQTGfw f7xT2qwJuiHjYWCjotSr9zqJejvJQrebvZ+wVq7kQ3loA2RnO9ss7rXCJIa3ujoffntp g0Od0IR/BB3kRYTiroAcBmGxFFkJCgw0r4oDZ7CCiHAAUKQG602LJG2iaDTCLeItZUrD 6YDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IX9uVrlK; 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 h22-20020ac85856000000b003b1ad716005si10319596qth.577.2023.02.13.10.47.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IX9uVrlK; 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 1pRdoO-0001At-Gr; Mon, 13 Feb 2023 13:44:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRdoL-00019i-Mq for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:21 -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 1pRdoJ-0008TB-PA for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:21 -0500 Received: by mail-wr1-x42d.google.com with SMTP id k3so5634959wrv.5 for ; Mon, 13 Feb 2023 10:44:19 -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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=IX9uVrlK4z4v5wHmT/ms9nRTa9td+Wtl2M9zlza8++IaYw7ZXYjHQ2VrFrHfN7KwFl FnxP9XhB7nBrp9qunnp67yNoGbX736q7NpdRXv3exJluCAnHZCx5UuHqDKJegR5GI/Cd d8ojIQYm/E+aiuHTRFEV+RUh39hLJ+ZlD5eSJsmxrhwGKpRsp2vu3f0R0+J1ZQoE+c3p vsVk8Y148lADz+/LkloHBZWHSqwXRqNqbLTl35a3ArLXs0hKZgNbItcbRGAHltbc94Cm tQ396zmUAOvHv9imYwrxaD3hg02o080qMYD/rZ4IF4NxqKt9PgLzk4Clg4ACaPcnQRfp kbTQ== 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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=qxittwVlHPlGGaMJOLbWiR84Z5gOcaRfzpCytU+H39WqTbzjpCQAJlceJUCD6zEp8H PtagJr+wFZSRwOXu2fKmNJBt1m8HW5N+/VZnjKruFoasb12LymKKqIozG0qVT0oxIala 6tlxc2Hg1b7G7yw85aKuhELRcZBcYsdzFw2T/UpDLbCGd6DfPI6r55ZVve0prK/oPFZK JQGEY13oYFhddSmgCuAgz+FfYOnMHrh8ByT3zLxizi/WsWieOaw8nUu0Kd0VfOIlhjHM GtWt1LY9RD1Guxvf+VmJr8NZDNzwEK0fUoVdTnqA3RyB5iqDeGDS7sts3fvWgesjonjd OxGw== X-Gm-Message-State: AO0yUKVVhwzi2lWwwC2Ad+GD80I2JnR4Nxw8FfJM8/mL0gvx54L9J2e4 GyE1mA/0sExhw+N/im86FYU2FRqC/pVO6FGZ X-Received: by 2002:a5d:4ec6:0:b0:2c5:587e:75ba with SMTP id s6-20020a5d4ec6000000b002c5587e75bamr4147313wrv.55.1676313858144; Mon, 13 Feb 2023 10:44:18 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c445200b003de77597f16sm16158016wmn.21.2023.02.13.10.44.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow Subject: [PATCH v3 07/14] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Date: Mon, 13 Feb 2023 19:43:31 +0100 Message-Id: <20230213184338.46712-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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 IDE_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/qdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1ead62fd18..a168643266 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -90,7 +90,7 @@ static void ide_qdev_realize(DeviceState *qdev, Error **errp) { IDEDevice *dev = IDE_DEVICE(qdev); IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev); - IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(qdev)); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(qdev)); if (dev->unit == -1) { dev->unit = bus->master ? 1 : 0; @@ -139,7 +139,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive) int ide_get_geometry(BusState *bus, int unit, int16_t *cyls, int8_t *heads, int8_t *secs) { - IDEState *s = &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; + IDEState *s = &IDE_BUS(bus)->ifs[unit]; if (s->drive_kind != IDE_HD || !s->blk) { return -1; @@ -153,7 +153,7 @@ int ide_get_geometry(BusState *bus, int unit, int ide_get_bios_chs_trans(BusState *bus, int unit) { - return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; + return IDE_BUS(bus)->ifs[unit].chs_trans; } /* --------------------------------- */ @@ -164,7 +164,7 @@ typedef struct IDEDrive { static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) { - IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(DEVICE(dev))); IDEState *s = bus->ifs + dev->unit; int ret;