From patchwork Sun Feb 12 22:51:32 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: 652838 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124450wrr; Sun, 12 Feb 2023 14:53:20 -0800 (PST) X-Google-Smtp-Source: AK7set90yf5AuJox+WcbRZg7Jh2KySREThKsGhSAH8tpG16yLmqgLIJHDX7yaURB5vzodjzUvZ++ X-Received: by 2002:a05:6214:c82:b0:56e:b13f:fea0 with SMTP id r2-20020a0562140c8200b0056eb13ffea0mr3153017qvr.46.1676242400716; Sun, 12 Feb 2023 14:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242400; cv=none; d=google.com; s=arc-20160816; b=NBMPAmfetbrEs9M+ZSwhbwGbGHQ+tBGTTjxJfybaM9LsdxyjimowV+2FtFZ5/RkRpR aXjL+FfFK140OZGqw9CJlitw9oDny3ZK6NAM6Ip2R9fyme5idrm2pRC99IBWQlKA6Uxb cXv/ZIjb2OFHDcSfG1MhLz5Jscs1ls/RU2KuoUJqyWgVIw6AJ9A8YVe45qr8Of9Fk8wX mRQwHtCFHjncWdK6mnWhmlmUSspVzIIwLS9h41lJ0cIkwFBPhBqSINHypz6DvB4Ypam/ uBef2MLqDqHrTPmYmsDOHkKylYHsnZ12QeHboi2j0hHm3bpyZbU6tD+lURNENDc46O0N /Njw== 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=mmW3+j4CxzNplehiqaRULW7t0qame5JDIOTexmpxrH0=; b=Zbsh2wyd3IO8GXfqHMZbYeWDEETYjAhdzFkZc5vowpQih/qZ6BkGxPH6tukqgI9Pti uuBfiLKB2sx4LQ7UVXDOxveaDmDo9dAvBSv/t9iRwk65pVc8UYu/Jm4xoKenfL6U/pFf rDJ7ywBgcC25AvN0zP4VgoRsaDey3pgifHvczv04vfukVL+puD8dGnSMy7Ii2jD3Bg5r +oDyWVEI2UO8gwfTFMHJlZzODXRFJGxU8FbLc0NpOxw0tfS/FWpTY+h+pbKJ1Jm6/Qpk lQctq4d1JH6+gMwr78ij9Y2B2qH1kWyi1rAl4KOJHgLAxGHBAMZzsGEFJiA506QrrEXi pz4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bz0ChdXw; 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 k10-20020a0cabca000000b00568c5e3a0cfsi7952109qvb.125.2023.02.12.14.53.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:20 -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=bz0ChdXw; 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 1pRLCw-0005lj-3l; Sun, 12 Feb 2023 17:52:30 -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 1pRLCu-0005fx-Li for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:28 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCt-000437-0O for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:28 -0500 Received: by mail-wr1-x430.google.com with SMTP id k3so2816855wrv.5 for ; Sun, 12 Feb 2023 14:52:26 -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=mmW3+j4CxzNplehiqaRULW7t0qame5JDIOTexmpxrH0=; b=bz0ChdXwolRU0I6j2tBywUYDzVv/7C1zU/gwIncr4FPc+dK61rSwCtD87lVZYPmZnq c6SJZAdkcpaIwBSraLgfwZie0C13RYKINpaj7/B7/tFkMPqNnwlYNqDhLJdKSZMTI7wQ 3u3aJPEyv8OenL/Kv9SBAZT9W1MeCtOCHeG4ij7aNqP2UbpgIrqGy0RRW3R0ZcgMzsZk xIm1Q1npoCfhdsRa4ZwN4YJ5KLNGTUzJDA5jYP4AvWgEN3Tn5q1szOnu6JF4R6RLivxK DjPiFf/roN2VEfkOENHvpNwgA+VMCPW2H8ljKIO5Eq4cxq3vXIMEAuV+uiuIkKLJ1qgC I+bg== 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=mmW3+j4CxzNplehiqaRULW7t0qame5JDIOTexmpxrH0=; b=KFlaOi0/aPVqRqCv49SoFd5ktqgWlq2nu3bptEaDqrQc0FjFqLqrEX/fGb9xFoeZjw pgi5Vq+TbUCRNG/xckd1Gk0tLWZUKwG20MauyD84GwjxHGIjPW86Bj8ijaJD6x+NHQbJ CBw/sZ+hwBnCEECb4dNnYq0ui6bkY26xl1bUvBOcnwjNJ3xWANS/fzs7Nwnf5EaogJme WHUHUjv2CbLllQItM+ZZOojpPsC1DtDbUT28Dwfa6K2H0Ra8xjWP/AHZF3FESaYLEQK5 aNqOzZnQ9a4j2V4/o8S1izxrgtp/7j/Pmvj6TpNKcSaaXG6PiBqaJTfAnCZdDmaA5CJx HXjA== X-Gm-Message-State: AO0yUKUoP2ghGjAGOswtOwoz8+UxMRuxmAaprKrc8Rhhf2E/+sGksS2L rc3lhoGQpD3u/SJdjn70+fb6rA== X-Received: by 2002:adf:decf:0:b0:2c3:f250:f202 with SMTP id i15-20020adfdecf000000b002c3f250f202mr21023961wrn.22.1676242345839; Sun, 12 Feb 2023 14:52:25 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id f26-20020a5d58fa000000b002c5526680cbsm3478694wrd.92.2023.02.12.14.52.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow Subject: [PATCH 07/19] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Date: Sun, 12 Feb 2023 23:51:32 +0100 Message-Id: <20230212225144.58660-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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 Replace accesses to qdev->parent_bus by qdev_get_parent_bus(qdev). 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 c96a25e955..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, dev->qdev.parent_bus); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(DEVICE(dev))); IDEState *s = bus->ifs + dev->unit; int ret;