From patchwork Mon Jul 10 23:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 701103 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp5424083wrs; Mon, 10 Jul 2023 16:09:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlH8AljeIgBA7sOxuhkpDl/wqr32eW8FTY/8eJwVx3dPSKMqLOQ5Ne+475oM63xN0ojAizZm X-Received: by 2002:a37:87c6:0:b0:767:287d:6df6 with SMTP id j189-20020a3787c6000000b00767287d6df6mr12940477qkd.37.1689030552481; Mon, 10 Jul 2023 16:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689030552; cv=none; d=google.com; s=arc-20160816; b=JH8acwRO9Cw/JTlefHP+q6pQDG3T/HdEQcohaJIfVf16PRJ8MCHArbsIa8OYZF+0Pd d/jpffWiBBYxc+RgLy/83HvockN83Jw93BFCeLVBRpeZTCBsC9K9PoDef/CsyWliVf2+ chQgoJ9yQQ7FYOnzL2QJwVgNSZVWdnVarOfuX6Gx24zvCIJgawzJ76XKZPKHBPErrVNW YVhQBk1S+6NglOu9tluauDGh1KXqJat3xxyPpmhIUDOMNE2Z0TFR6ihXSuE/gkvMg6Tn rWQ5IywEktSXO4zqfVwKrbhG+Qm5wRlhR68ajhb1l3x43Xr61Dh793DH33uZKYYxgOKx G7cw== 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:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gchxlBA+cB22tJPCzqHzEwVhVGuwa/sdVVkoeiXPLUI=; fh=X2OS929T+Aa0AlNZhzgxPBAGY+pEkxStfq9vMtooKZQ=; b=gOz+atf1EAhJESoePAi6b/hsup96/U9/s2vaFQOomzn0JTplmgRJdouCfwlYRUtshs dWhhH0z6krNhzj8sbd9B8s4y6OcaD4RH3EE2zZvCedVJT7Rv2J5nMd+rCHqqYV9wALv9 +iRigusSveAbnL66CBA62vWLYZer47t0v3180n3zmALvZvXOSlRCrTNUbNIXklx+81Ya QNggWddx3pPq+hhsz88tXXJSLEHO9b6oX/6B57QoUgr8agpBwWzKv10fKDQJlX8L5nGY FDTEJIWU29wYfjUsHuXDuTSGZsRYaF03JE+wUcHcMfLPNaWbl7e7L2bKvSUqQBQs+RLP 88gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="G2mU1m/X"; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s21-20020a05620a29d500b00767dfe07ec4si104002qkp.164.2023.07.10.16.09.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jul 2023 16:09:12 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b="G2mU1m/X"; 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=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIzwO-0002eo-9c; Mon, 10 Jul 2023 19:05:12 -0400 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 1qIzwN-0002Wc-0O for qemu-devel@nongnu.org; Mon, 10 Jul 2023 19:05:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIzwJ-0004aQ-HR for qemu-devel@nongnu.org; Mon, 10 Jul 2023 19:05:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689030297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gchxlBA+cB22tJPCzqHzEwVhVGuwa/sdVVkoeiXPLUI=; b=G2mU1m/X4XbvivAUIsXsvsYRY+yX0mxuj6Jzu7OUBkkVWyv9pdR4e0EIOwsYAnVd3q9/d9 YpaNPtgveE2SXMzGclktkq9d9JfyMSDCqD4wjfBRSv++9SDBuI5ZTienby34kWlIcfKYEd DHqNUU+7Cycy/DLRBtOYttoVrknCHtg= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-7o4Kbhw3Mta-FYhKux5faw-1; Mon, 10 Jul 2023 19:04:56 -0400 X-MC-Unique: 7o4Kbhw3Mta-FYhKux5faw-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fbfc766a78so24389635e9.3 for ; Mon, 10 Jul 2023 16:04:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689030295; x=1691622295; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gchxlBA+cB22tJPCzqHzEwVhVGuwa/sdVVkoeiXPLUI=; b=aGP38018cSoUpKTXNn1rIQ38JFuzRgy/NuqPV5ahUZrA+aWGUCIWi2m/mele0U2hPk qIh/ql+UUiWVRziE2eAcBQwUj3UY++8keHEXNlwACP9iVp3I7wg/UJKUemHPkvxLvuTl 6lKMrDQkO1Wplc8tUhV2MUrUsNaslQwL+SPj/UPxU06/JPDPRSsqankkDiXq8NZiM7bP eZrm2S4kAVLQVgZyl8Jae84XqcsqQhpaBpnSMSTuIm1pOCu3J6qlrKu9cWULrGiAcFyE 23y2erg73bxsWAGZC3/l8EjyeCJCHYpHH8tON4SHX3qMXojvjw7KYx4tMeHd41DqSXGE XWGQ== X-Gm-Message-State: ABy/qLZD2CzGctMhNWBX+Y8LKdhQ3okJ5qOoZqySHl1XjV8gPUKTlAlJ 8SDxZUeCI9VKyjC3iaklr43gT8FLSaYe3jFWh6aBINi5h2+68R9AhrXdZdr2WFPah+ShHLdxzD/ 5LdVt2WfXhATjxESPGUauE3BGTYrQIKGqqNbYZmy8Y4MrS0jM1Pm7AN+FT/SxFtRYpwXH X-Received: by 2002:a7b:cbd8:0:b0:3f9:9a93:217f with SMTP id n24-20020a7bcbd8000000b003f99a93217fmr11257220wmi.3.1689030294797; Mon, 10 Jul 2023 16:04:54 -0700 (PDT) X-Received: by 2002:a7b:cbd8:0:b0:3f9:9a93:217f with SMTP id n24-20020a7bcbd8000000b003f99a93217fmr11257202wmi.3.1689030294415; Mon, 10 Jul 2023 16:04:54 -0700 (PDT) Received: from redhat.com ([2.52.3.112]) by smtp.gmail.com with ESMTPSA id a25-20020a1cf019000000b003fbb346279dsm919922wmb.38.2023.07.10.16.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 16:04:53 -0700 (PDT) Date: Mon, 10 Jul 2023 19:04:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Paolo Bonzini , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Eduardo Habkost Subject: [PULL 51/66] include/hw: document the device_class_set_parent_* fns Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Alex Bennée These are useful functions for when you want proper inheritance of functionality across realize/unrealize calls. Signed-off-by: Alex Bennée Message-Id: <20230710153522.3469097-3-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/qdev-core.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 196ebf6d91..884c726a87 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -952,9 +952,36 @@ void device_class_set_props(DeviceClass *dc, Property *props); void device_class_set_parent_reset(DeviceClass *dc, DeviceReset dev_reset, DeviceReset *parent_reset); + +/** + * device_class_set_parent_realize() - set up for chaining realize fns + * @dc: The device class + * @dev_realize: the device realize function + * @parent_realize: somewhere to save the parents realize function + * + * This is intended to be used when the new realize function will + * eventually call its parent realization function during creation. + * This requires storing the function call somewhere (usually in the + * instance structure) so you can eventually call + * dc->parent_realize(dev, errp) + */ void device_class_set_parent_realize(DeviceClass *dc, DeviceRealize dev_realize, DeviceRealize *parent_realize); + + +/** + * device_class_set_parent_unrealize() - set up for chaining unrealize fns + * @dc: The device class + * @dev_unrealize: the device realize function + * @parent_unrealize: somewhere to save the parents unrealize function + * + * This is intended to be used when the new unrealize function will + * eventually call its parent unrealization function during the + * unrealize phase. This requires storing the function call somewhere + * (usually in the instance structure) so you can eventually call + * dc->parent_unrealize(dev); + */ void device_class_set_parent_unrealize(DeviceClass *dc, DeviceUnrealize dev_unrealize, DeviceUnrealize *parent_unrealize);