From patchwork Tue Apr 18 16:21:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 674519 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp58831wrs; Tue, 18 Apr 2023 09:23:18 -0700 (PDT) X-Google-Smtp-Source: AKy350awOLhYehOxU/o1RYe32Gp1fOicU/+gXzqzyGi/hY3XX1TeXg2Tc1N6gTDC+55RRSIbkbt+ X-Received: by 2002:a05:6214:246f:b0:5ea:2575:dccb with SMTP id im15-20020a056214246f00b005ea2575dccbmr20034238qvb.46.1681834998128; Tue, 18 Apr 2023 09:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681834998; cv=none; d=google.com; s=arc-20160816; b=Dn1Svp3y7odRMaPMwLpAgmyjibR4f2GoOx0FoAWwYVCpESA+J/nq4176bT1Rmg/0jp 2XMCV2GMEwRwiGfzI/EL69C2+kQUt16+KhilimPJIYgP0GkNgkhifMfbL+N7kvPsLDuf NPyZ6kYvaYQq6JQ9PljsfGpb1qO8v7tRbjaPK3hnsnD6t26nJvxln3pXVCXd3yogMC2s TkW3Sp5XRYUXV3o+Zu48bTXZybXSkl4s/5FAZ8m7x3m54alQrTo2d4oPRXIhqteu6t9z tuBrom3Y8hzl8NYQQ05S3PlHRmf/ytFsayW1snbxUrKmkOzqP65U+bQrfnIbPhYkNw0f P5Gg== 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=2d/kTabziFWz81diPGPd2lcq9eXntPtMnKyAEA11+CY=; b=gL/CMlIJbHVxNVZJBPxGmEt4LKbPkK29meuHiu24cW/yboN5E4U3pBvmqoSGKCcS6/ 4kXWr/q5cMT0EFVJP2rz//+F2IGIeWFJ32Zj7phpZeIiLaSjYrgILjkmEXlm2kUo8wK0 ixPRTAK6H7ojBCv6SJ/EI3Aku4hwLXYsdmn4gtcUIKdkduemmAu9iKkczvTaegEhF5VO lLnRqxxPDqYaI63jVqh7rsiR2fJn2Egy9PPJ8Xchwmk7ea5OV/xU3n0w8fylJEJ7KCir ySymkEDTolMhncWkocnpUT9YBe8YdRdqwfcQYwq432jYfahbRC+PAz36IN8BQ6Wsl9Yl vIhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VBIl2DDI; 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 4-20020a0562140d0400b005e7fc559b08si7448842qvh.147.2023.04.18.09.23.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Apr 2023 09:23:18 -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=@linaro.org header.s=google header.b=VBIl2DDI; 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 1poo5S-0006lH-Kr; Tue, 18 Apr 2023 12:21:46 -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 1poo5R-0006k9-B3 for qemu-devel@nongnu.org; Tue, 18 Apr 2023 12:21:45 -0400 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 1poo5P-00019u-Hr for qemu-devel@nongnu.org; Tue, 18 Apr 2023 12:21:45 -0400 Received: by mail-wm1-x32f.google.com with SMTP id ay3-20020a05600c1e0300b003f17289710aso131506wmb.5 for ; Tue, 18 Apr 2023 09:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681834902; x=1684426902; 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=2d/kTabziFWz81diPGPd2lcq9eXntPtMnKyAEA11+CY=; b=VBIl2DDITwHYzCBWk8T/c3PSW1X/2UIjoMDfUr0uzjO1UAEp9twCZm7Pu6X01Vb4TS MDDcY8sUPQvlfFBou1xMdSZ8oMBcyY6dAh7h/8HGUxYrlDuQpOYVKBdGUOEBs8g2oNF3 hNzuNZHkf87fQTu/BlnAJKfu6mD4W6HV3DyZ7bElssGj2fsRDQsrLfOea90OVg7uuxST qICsIFBVYL9wzNoV0qnAMT7M1CnOdEBK+FF62kykL9Vm0ghchrwt9xpmxF2Z6mQYFGBY sIFy2WBte33dS4OPTCmE+njA9hediQv9SIC+QyHCjaymAv93BCJ0P0f+WGjfb6A/2xaC 88og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681834902; x=1684426902; 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=2d/kTabziFWz81diPGPd2lcq9eXntPtMnKyAEA11+CY=; b=BwhhAVdjOJhbW6AZLsbd4eYv1MnjBdIbZFrWrU9yGxiM36EXKsCnC261fGvLfPvutM Uziu6uevZVIAUN2mcM7t1TUMnsLQ39Tvwmorig44WiDbm8cU9X7YhvushNITOQ91bVHs VwHx6pnqh5ajaWxfjtMD86m21WkYNGDLyUjf/TewA6Lnro48n7IERgjhdyBl0+PSEydu D5SXpOP/sINLmcSOyPgMhea5iTFME6CTBalVBtCHBarqJv3C+qta0AkQPkqvAQGrvTo1 lvyVjUj/tPf+wYjVBIEcLAUYQyP0hnPxDQxsEvU26YgRxVzXUMb0oV6WN/dj2gNDrsx2 OfiQ== X-Gm-Message-State: AAQBX9cFhjaRjEvYQsY3KLZcnOE9RLHduNmdkUgSMOHeLzluI6j7Ka+4 OEXRj1qVBAWy1/evUu3Ud+9Sag== X-Received: by 2002:a05:600c:21c4:b0:3f1:6ef6:c9d6 with SMTP id x4-20020a05600c21c400b003f16ef6c9d6mr8330381wmj.32.1681834902140; Tue, 18 Apr 2023 09:21:42 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id z16-20020adff750000000b002fb6a79dea0sm3963944wrp.7.2023.04.18.09.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 09:21:40 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 57F9D1FFBA; Tue, 18 Apr 2023 17:21:40 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_?= =?utf-8?q?P=2E_Berrang=C3=A9?= , Eduardo Habkost , Viresh Kumar , Mathieu Poirier , "Gonglei (Arei)" , Markus Armbruster , Erik Schilling , Jason Wang , Mark Cave-Ayland , Gerd Hoffmann , virtio-fs@redhat.com, =?utf-8?q?Marc-And?= =?utf-8?q?r=C3=A9_Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Stefan Hajnoczi , Eric Blake Subject: [PATCH v2 02/13] include/hw: document the device_class_set_parent_* fns Date: Tue, 18 Apr 2023 17:21:29 +0100 Message-Id: <20230418162140.373219-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418162140.373219-1-alex.bennee@linaro.org> References: <20230418162140.373219-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@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, 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 These are useful functions for when you want proper inheritance of functionality across realize/unrealize calls. Signed-off-by: Alex Bennée --- 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 d4bbc30c92..b1d194b561 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -795,9 +795,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: + * my_dev->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: + * my_dev->parent_unrealize(dev); + */ void device_class_set_parent_unrealize(DeviceClass *dc, DeviceUnrealize dev_unrealize, DeviceUnrealize *parent_unrealize);