From patchwork Mon Feb 13 07:08: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: 653182 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267389wrr; Sun, 12 Feb 2023 23:13:22 -0800 (PST) X-Google-Smtp-Source: AK7set+GQnXU7TOhr1+BPnZfcud1zwibUEBiC1a3zN4q8O8knq1CSdwCyKnXOrOieDHmBF5c4TYU X-Received: by 2002:a05:622a:64b:b0:3bb:89be:8b45 with SMTP id a11-20020a05622a064b00b003bb89be8b45mr20524147qtb.65.1676272402171; Sun, 12 Feb 2023 23:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272402; cv=none; d=google.com; s=arc-20160816; b=vNM9axkO49yUB1K2OtYfzgCfN6Z4LXxjPddTWtvmMQbQByUB9ttzY3lVrl6WtlWTRI olKGnpQot37YlaqIDsDwZzg6H7he26yIEOrnOkGh5CAPDQE19eCrv+xuoLLUvcXm4i1f vWqJHOiEEib5LZfiWj78DL4aRshwm4X9oI+oqJVptfvs/sxpFzd2XoYJX5h1PGQ0kmnY emP36NTeB7YlLc6DrbiB7/yAkHDp9D20hLuLQlq26w2WJ4v8+MfVjiwp0rpNt7pAEg4R eBlEP/uFxjgwlHZFLQLPXJ2Vn1zd6kst0qlQIAXNgVzQnKaNut/zEerj43LDtSygtmfc whkA== 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=hYUPBKE1S89egmye2c8RsXzKxECREbkHYxtN+eJ36k+K4UlU5+BxH0zBNHXQsMt+YY dJ8uZ8KkGQ8RawA/L94jFLEqr1za+CBL+jxgSti4in+3aYafMv0uqxyncOLvpzc2I8SR GltTr359cFISGANW3t2trgotioJ5n3YeKbqdRC6AOmgoCaPLqtpmXbVbfhRBfoJ/VvQ2 DY8avZQi7KdE54Gv6FKC/5yXuVjjXkiW2ZouQh0mQkZuMGjUvFHmTuH2o0LYKXp7LHhW +ObndQRg4X8N6I6ygxL+qRtvViITuGM6NQuBu+56qib3vzTtv6dRLUW8+fWXX5MCnAu9 vYmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c4HfOXEF; 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 f28-20020a05622a1a1c00b0039ce6373d32si9672118qtb.534.2023.02.12.23.13.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:22 -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=c4HfOXEF; 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 1pRSxU-00016E-Np; Mon, 13 Feb 2023 02:09:04 -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 1pRSxR-0000x9-UN for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:02 -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 1pRSxQ-0001r8-CB for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:01 -0500 Received: by mail-wr1-x42d.google.com with SMTP id co8so7304162wrb.1 for ; Sun, 12 Feb 2023 23:08: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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=c4HfOXEF7QeK9jrqu4iQcxBupJAS4471RrUqgSPXgazXFK62u5io44A867KLehpn50 1Cr4KeWlJCvfsmRus/6EsHOL36VkCcKo+1Z0j/rmu9IKtE47JZVWpuNJEYhux4Xtfmac 3FdJuGtqXr5h9Dj9ja3sU/Bwn3iQml7m2XoRbQQQ4Ta+59vPEo0Sh1j4b/waGumi4CPD unDwEFsBxXVC/kErgiY31p6H/5H1jWNcMLpXiVC3Se1HJ1n5ACJzfEaJrwPaRG/Bosd7 kbRH8n9KScGzlduIdPW4WMKrmDqPpd6AGodq9tkztPzCuKwzP02b1f/e6MlVVDaMww5I 7g4g== 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=qKukesQp1Y5qpJ0IP8KQF7EapH65Hf9H39821jj5GhYi8ZUFs/a8qWDanXrQ4eDkt/ feh8V4EAQXO1dzbcG9wmngGy8JzZT0dV6CHq01qBPCAXivziAq3GlC8KUuhirkJC8ph1 3K/Uz8t7zvNMzpVQTDXIk+JGJCbCfDmS8qzSKr8cpL012WbR6diYTE9wTPMkP0AjtJsX aQ4jCttJzgoHIoQOZU+qgIsSaaIfMB4gV9nrzEvDkBSqqlPU7TciPohqkLTbnGOgmKjP 29tR1u809DXtYQFch5pOv/wMCP8JB4zkY4iwtwSaXliiuvfNnAJgu2sP1+HW2DiM+Lvp NKaw== X-Gm-Message-State: AO0yUKXJYiy5bd1byVKyIF2ZSwKCeiI3ljm/19t7DSxlMLJOX+n2/AiK V2jVZCnEf+oq9sYVp3cJnZ+iV9cS8gFoIxEY X-Received: by 2002:adf:dcd2:0:b0:2c5:5a68:958 with SMTP id x18-20020adfdcd2000000b002c55a680958mr983845wrm.33.1676272138910; Sun, 12 Feb 2023 23:08:58 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id i8-20020a5d4388000000b002c5493a17efsm7719780wrq.25.2023.02.12.23.08.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Thomas Huth , Li Qiang , qemu-s390x@nongnu.org, Hu Tao , Gonglei Arei , Cao jin , xiaoqiang zhao , Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , John Snow Subject: [PATCH v2 07/19] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Date: Mon, 13 Feb 2023 08:08:08 +0100 Message-Id: <20230213070820.76881-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213070820.76881-1-philmd@linaro.org> References: <20230213070820.76881-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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the 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;