From patchwork Fri Jan 2 00:50:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1169 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315102; bh=P30kGybYmwYfUNVyfoacwflEcYTeDxDYY44D2N84qUw=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kz2N86Fll35vUUJzfX0ktOLFShv25wnuAyllAlcIOVXfUokFiOBejgwG6mMbYJMj/ k5hrgSS2tmw66QcOvuKs5mvrlFlJw3z69H/e11XqVgL9oUGqlcWyZotYYW08DVW2sP zPBA9jDeBTP2bC0uVHyWsB7n3rfsBvlfFH5rWoL8zfqP0IuVZNON5iq8uK9QO4wRix MWLUbrFANBM9nPLntBo02MtFrSSOQLdq71ukOPQ06/ctVgpFhLbfD7pJsEvUFd2t0F Kk0N3zXaNzld+uQksrHh7Ki0SNf4QTGs+RDQE23iY7z3Uo/OutkOWFhKQ5KjWJ2zXZ f2gAABBWOq6Jg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8741A69001 for ; Thu, 1 Jan 2026 17:51:42 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dPyi67G5F611 for ; Thu, 1 Jan 2026 17:51:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315102; bh=P30kGybYmwYfUNVyfoacwflEcYTeDxDYY44D2N84qUw=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kz2N86Fll35vUUJzfX0ktOLFShv25wnuAyllAlcIOVXfUokFiOBejgwG6mMbYJMj/ k5hrgSS2tmw66QcOvuKs5mvrlFlJw3z69H/e11XqVgL9oUGqlcWyZotYYW08DVW2sP zPBA9jDeBTP2bC0uVHyWsB7n3rfsBvlfFH5rWoL8zfqP0IuVZNON5iq8uK9QO4wRix MWLUbrFANBM9nPLntBo02MtFrSSOQLdq71ukOPQ06/ctVgpFhLbfD7pJsEvUFd2t0F Kk0N3zXaNzld+uQksrHh7Ki0SNf4QTGs+RDQE23iY7z3Uo/OutkOWFhKQ5KjWJ2zXZ f2gAABBWOq6Jg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 765F168F58 for ; Thu, 1 Jan 2026 17:51:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315099; bh=WhJWf+6J0aA1VmYh84WjxzyprI2ucBuBhceuRDI8VA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aK2lJ34jCulzbzNmKHDI7VB2h4CcNw5NQlmf/pakFebWK7MOt4sT4uhORPIKYILJX PvX+YbLKfctVaPhHs6JvxBEQUgil12LFoKU/GTPq+ojHS86Ak7r1kvXh+q1TN9LER+ jBxXcMb+2vsJZhF2k7gD5piPipJHHYiJcPG+9whOQEzrVcWHXUEYcFuBUbR1fZR4/z bjZYCRhW4oWu4pXPdHGQ2dF9VWuXzHDi2fwIIO0/XHm6vH7nizzTMs2Fuhppror4oc cN656MgiWcLC0vE40h+i8+/ioXFHdrWoCE3vrHmLJga1psz5PHoWu2n90ylL/jTsFf jWGKX8po7jBVw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E22DD68313; Thu, 1 Jan 2026 17:51:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id Vxk7hgr5_aBa; Thu, 1 Jan 2026 17:51:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315095; bh=kJYNw5y9awEu025U2v24nrqAoXNHrKe2BfyqKAG/BtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BlfLZVrO150oRmsatuL2kJidhVff3cH2tAuo/iNGc0byKv8eW9i51kKj3mlhwbyEW MKp0XQ53r+Etvn8bsDoNcFtbjbvE15j7wTku34QhDPmBm3vEUr/kBqX00eQA2Z6tyk 3Si13sHawmKYy1+bPc+qsV0eDvTSsCPfc73/JYzuicF7bFx0nF+vYVLbbHnINUNQpm kD/Djnk4JEtZAB9ElOTcTM0Ms0/lOfljDuS6B3SbG0cyTfdOsfHFSAg9K9w8Z32PtH S5Osl4MEL+Q+TVYAvdIPuic78iA147C+0+DVH5f6V3gS7huvCQUTZ7MFCHceoPgcla WSGzQj4YwMWeg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8608368FFD; Thu, 1 Jan 2026 17:51:35 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 1 Jan 2026 17:50:35 -0700 Message-ID: <20260102005112.552256-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260102005112.552256-1-sjg@u-boot.org> References: <20260102005112.552256-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UOSYFUS5UPQBBGWIYJO7LOSDAEDS6TOC X-Message-ID-Hash: UOSYFUS5UPQBBGWIYJO7LOSDAEDS6TOC X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 05/30] video: Unregister cyclic on the last video-device removal List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a pre_remove() handler to unregister the video_idle() cyclic when the last video device is removed. This ensures the cyclic won't run after driver model is reinited by the test framework. This complements the uclass_find() fix by properly cleaning up the cyclic registration rather than just gracefully handling the orphaned state. Co-developed-by: Claude Signed-off-by: Simon Glass --- (no changes since v1) drivers/video/video-uclass.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 383be0d96b8..3e02c48d399 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -874,6 +874,23 @@ __maybe_unused static int video_destroy(struct uclass *uc) return 0; } +__maybe_unused static int video_pre_remove(struct udevice *dev) +{ + struct video_uc_priv *uc_priv = uclass_get_priv(dev->uclass); + + /* + * Unregister the cyclic before removing the last video device. This + * ensures the cyclic won't run after driver model is reinitialised + * by the test framework. + */ + if (uc_priv->cyc_active && uclass_id_count(UCLASS_VIDEO) == 1) { + cyclic_unregister(&uc_priv->cyc); + uc_priv->cyc_active = false; + } + + return 0; +} + void video_set_manual_sync(bool enable) { struct video_uc_priv *uc_priv; @@ -897,5 +914,6 @@ UCLASS_DRIVER(video) = { .priv_auto = sizeof(struct video_uc_priv), .per_device_auto = sizeof(struct video_priv), .per_device_plat_auto = sizeof(struct video_uc_plat), + CONFIG_IS_ENABLED(CYCLIC, (.pre_remove = video_pre_remove, )) CONFIG_IS_ENABLED(CYCLIC, (.destroy = video_destroy, )) };