From patchwork Mon Jul 10 15:35:04 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: 701026 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp5243325wrs; Mon, 10 Jul 2023 08:37:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1KeQb+k1d7h7uIcAHajgfxXylVxvRH3GSvhKU78way8ozlwB6xsuTZdbC+vodCa8BjfmC X-Received: by 2002:ac8:5b52:0:b0:403:a308:3cfc with SMTP id n18-20020ac85b52000000b00403a3083cfcmr9178582qtw.25.1689003429462; Mon, 10 Jul 2023 08:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689003429; cv=none; d=google.com; s=arc-20160816; b=x2nemI/JvelFukedr0yoOlWDznBpU3Ju67pvxEgQfsUGnQovKOJkS1gmfB6lMW2bQt fPuI0zZi46giVes4kTyPpSzzrjMlrKYdeIF8Lebp464agtPwuwrI5UpkXcRf8DjuVQ5V J4gJ8DO62kDQUywZiUeE6ujs77iBMFODlTv8l/fGTCNd77eOjGgRhKl9JlWLB+qaJkIn YitrwfJQipW2f508VQcV/4zWgZXoZxiPOuiU+QBiL8bECnprVFA5eDqPvUsQxPukN3tB 0GZT+oq5AbHyG2jInEXVdqNulUItZ6fR+Ww4tPl2E1+jJPzUlLCjeN+z1PrUrZNS5BQa /Xqw== 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=A5nrdE1EbWfnKTXnpPgJZ0uBCr/0VA1ZCTtf34qEAwI=; fh=pHpVzH22N3up2JSv0jV3vGkBG2/OCgsTpbbdQUlofss=; b=CDx6BoFzU5BtUszKIaRqsAAJhQBRBBo5V+GSWjU7r65KR+4CFQCCxAbCk+1yyoYfn4 s/eWkIDdcN53uS2q13GcnabFJY11IocSjc2ihhQC0mj8B1cMJ6idmDyZnmohO8tGZEWR b5imXqScBBPBQnNI7C8P3OIDIEdPaP7dz4WyIo8Wd+oeGPsRkStEHEvGC7jGY6WXo6h0 CzFber+U/VS2dyyIOxyHTzH8sH68ZOp7SZDV1LxqJVsGP+K3wUMdhbU7TilRX474+neg q+5HdZAdOQYtFdqnSgXQiFh8lpllF21AsvyKJ/lKgYmY6kJs/lU5Ra95gAn7LWHBqf/s U62g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OrGn7Nwj; 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 o20-20020ac85a54000000b00403b25523bbsi11798qta.537.2023.07.10.08.37.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jul 2023 08:37:09 -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=OrGn7Nwj; 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 1qIsvc-0005t9-6y; Mon, 10 Jul 2023 11:35:56 -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 1qIsvQ-0005lo-Vd for qemu-devel@nongnu.org; Mon, 10 Jul 2023 11:35:45 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIsvB-0004jr-JF for qemu-devel@nongnu.org; Mon, 10 Jul 2023 11:35:44 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbea14706eso47804215e9.2 for ; Mon, 10 Jul 2023 08:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689003328; x=1691595328; 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=A5nrdE1EbWfnKTXnpPgJZ0uBCr/0VA1ZCTtf34qEAwI=; b=OrGn7Nwjm+XbE+PNmSMJuXVthHH3ULc6N4kPsnLW92+NTRe49XPenOJcvcj+rac9Pt nVKbFaUa4sjJBQ5JMRiOtgrIVvCNWGvOPL1tNcAW4f4tOH/emMZuKxg7rRXyDxt7iER4 EVh843PUSJyRGBg3xZ2xsIqDnW8rBcSrOAnhBIdapzKLBQsvkCG7acr4Oq+d69200Srw WAsJ6ZdhbU8XMqnISdOThSNRm8ngNvfiGC5+pbMHzTRiBD+XPPnMyUiJhMWsDe9+zFNk fdGqiHCURsd4iiM3nGDx0bqt3xGWg0iHSBm2E2YXRApK8AGI5dMq9qV0vcb1IsF4Oe5i GRWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689003328; x=1691595328; 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=A5nrdE1EbWfnKTXnpPgJZ0uBCr/0VA1ZCTtf34qEAwI=; b=Vkt/evEk+WlNCeWHtndPovCzdkEDQ7jeOmtOoU3RJPql67qFm00fhaiYfs5Seyme45 FxGsUkKJubGZeO+yNcevQgrVw6NTooU/empc1fT1LNnXI4riWbo0NHrPFesNC1jR2nPR myJ5HT1saXyhV5LNCYyYXgH66/ezGn4f+28tDWwphg3/8b5ZgLdchqrEGExg+gg2/dU0 fm/NWisgnM4iudMaX+8zTo1V+UdbX0R5SJ7odTmlwzCXHJdbavd32Qg2EstWzz60D6vI +JA08hCEHEVJ+rQvUNe3SvLL7FdoeSLk/coGIWYGH8OWXGxsE7NF3f8kp+x5O9azJyBE QJ1A== X-Gm-Message-State: ABy/qLbVKBwRsXAqrU5Tg+8YeXEMGSAz2u/bsa4mSLxEcyTv2WWp1gjY /OToef6myA0EA3iln8YpjGnQ4g== X-Received: by 2002:a05:600c:378b:b0:3fb:ffa8:6d78 with SMTP id o11-20020a05600c378b00b003fbffa86d78mr8100846wmr.36.1689003327693; Mon, 10 Jul 2023 08:35:27 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id e14-20020a05600c218e00b003fa96fe2bd9sm10643485wme.22.2023.07.10.08.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 08:35:23 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 68AF61FFBD; Mon, 10 Jul 2023 16:35:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Jason Wang , Viresh Kumar , Raphael Norwitz , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Eric Blake , "Michael S. Tsirkin" , Mark Cave-Ayland , Kevin Wolf , Markus Armbruster , Gerd Hoffmann , Mathieu Poirier , Hanna Reitz , =?utf-8?q?Alex_Benn=C3=A9e?= , Erik Schilling , "Gonglei (Arei)" , Eduardo Habkost , Fam Zheng , virtio-fs@redhat.com, Stefan Hajnoczi Subject: [PATCH v3 02/20] include/hw: document the device_class_set_parent_* fns Date: Mon, 10 Jul 2023 16:35:04 +0100 Message-Id: <20230710153522.3469097-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710153522.3469097-1-alex.bennee@linaro.org> References: <20230710153522.3469097-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.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=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 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 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);