Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3EE4CC433F5 for ; Mon, 28 Feb 2022 20:33:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8FB2683C00; Mon, 28 Feb 2022 21:33:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=akkea.ca header.i=@akkea.ca header.b="Z678WBmJ"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="vK1Etnce"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5E3DC83C27; Mon, 28 Feb 2022 21:33:23 +0100 (CET) Received: from node.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0EDB783B9E for ; Mon, 28 Feb 2022 21:33:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angus@akkea.ca Received: from localhost (localhost [127.0.0.1]) by node.akkea.ca (Postfix) with ESMTP id 73BD94E200C; Mon, 28 Feb 2022 20:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1646080397; bh=QeWWKTAZTLj5Nn7ZG4G8/yu1TkrF0ucL3Pc558kkZTY=; h=From:To:Cc:Subject:Date; b=Z678WBmJILU/wTcxg1xby+hE5Tw7dqtmUDaH33EGonKstdKYGwyB0khHR67+3mudR 2hHjEj6gumGCPKeLCBZ2uSjv6NeCErf2ATIXU8WbpVzv2+HvBRzB2/t30Jna35uSAm HyUcmNfD113AJzWbRC8tPHcbve2xgKufC/UaC0RE= Received: from node.akkea.ca ([127.0.0.1]) by localhost (mail.akkea.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yGAnxzwEGHUm; Mon, 28 Feb 2022 20:33:16 +0000 (UTC) Received: from midas.localdomain (S0106788a2041785e.gv.shawcable.net [24.108.106.191]) by node.akkea.ca (Postfix) with ESMTPSA id 798704E2003; Mon, 28 Feb 2022 20:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1646080396; bh=QeWWKTAZTLj5Nn7ZG4G8/yu1TkrF0ucL3Pc558kkZTY=; h=From:To:Cc:Subject:Date; b=vK1EtnceBMpE7VYMtJbK7MtQhWsdbUGtZqC9u/g5FUnZ1olLmQYzCOKoB0E/33gLb D9gRmi3lIoKE1Tk6OsXccv46OJ9ouDR+NT/rrCnpJMq8j4Uvpr8uDr0hYCKxdHdP3f e7CT/ih9nIzF57PxCTTJMntD9RTlnZ3t3eGYTC4I= From: Angus Ainslie To: u-boot@lists.denx.de Cc: sjg@chromium.org, kernel@puri.sm, uboot-imx@nxp.com, Angus Ainslie Subject: [PATCH v2] core: devres: optionally build devres into the SPL Date: Mon, 28 Feb 2022 12:33:07 -0800 Message-Id: <20220228203307.206022-1-angus@akkea.ca> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Add a CONFIG_SPL_DEVRES option Signed-off-by: Angus Ainslie --- Changes since v1: Instead of gaurding the source add an SPL_DEVRES option drivers/core/Kconfig | 13 +++++++++++++ drivers/core/Makefile | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 8f7703c8b5..7e666708fe 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -206,6 +206,19 @@ config DEVRES non-managed variants. For example, devres_alloc() to kzalloc(), devm_kmalloc() to kmalloc(), etc. +config SPL_DEVRES + bool "Managed device resources in the SPL" + depends on DM + help + This option enables the Managed device resources core support. + Device resources managed by the devres framework are automatically + released whether initialization fails half-way or the device gets + detached. + + If this option is disabled, devres functions fall back to + non-managed variants. For example, devres_alloc() to kzalloc(), + devm_kmalloc() to kmalloc(), etc. + config DEBUG_DEVRES bool "Managed device resources debugging functions" depends on DEVRES diff --git a/drivers/core/Makefile b/drivers/core/Makefile index 5edd4e4135..0cbc3ab217 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -4,7 +4,7 @@ obj-y += device.o fdtaddr.o lists.o root.o uclass.o util.o obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi.o -obj-$(CONFIG_DEVRES) += devres.o +obj-$(CONFIG_$(SPL_TPL_)DEVRES) += devres.o obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE) += device-remove.o obj-$(CONFIG_$(SPL_)SIMPLE_BUS) += simple-bus.o obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o -- 2.25.1