From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17EA8CD3446 for ; Tue, 3 Sep 2024 15:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NaNTC9+dxZbmlAGpNwimyr5IFJHPO+gvNXPEJZH38c0=; b=cUwbCROdUno/aXnUo32T6TJD4u gmXJ/1YCnnwfwR0w3YWCwiP960v30Z2Y4QefOejnRfC3ty2Q5XrWLZfnyrHZLP4bdd8eo/ZtlYSbc MlOO+IxpXWCn8tA9rby3+BG08os7kVbTKHe1naKBLtBaPJB4f038EYXMMvns+NAcZlXqRPWH9F1Qb 17sbC/QRpcson53KtFSSTR8TXosPjAtH+HgUvLvQd6u10dtyw0OEhq7GNAvXc1cy0xdZyIoY7IhC2 MKY9p4kGVfhnJsnrtJrVL49dnEw6oTbDjOJjBpOx6qKt01iC6THOnVkbuDshlXLrOyPlczkzTQYI6 O0VaWGUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slVtO-00000000yYR-2TRG; Tue, 03 Sep 2024 15:56:30 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slVcN-00000000uOg-1lHD for linux-arm-kernel@bombadil.infradead.org; Tue, 03 Sep 2024 15:38:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=NaNTC9+dxZbmlAGpNwimyr5IFJHPO+gvNXPEJZH38c0=; b=DAn288u65FIc0LqjHdedwlsOTX Fw6Bukt3Q1MlixmrldELo+Axxe+nXn5t1RsNGctY/eYLuvmo3kOAPA1tfIceIkSj8JzIQlBerZEL7 CXuDrcOdSnWgzq7MKgKAtFGDBJtWAwvlz3gsJGihb5dkpJXs0WXCJ192ArfrCVagRFmEBZGACxlcQ OnPVPdVR+roXFZpdssNZDOEtkdwk2jvqVrI90oeff4fKmRbpOn1vwaQOoLCIZ+JXnmfjJSS9NXMD1 hsmwODPhxQAdl5gLK0EHznf5BEcdoN8vuQiVvx0SZ1n3jkB+UDUZbzvVXxUsIcNxBVobySUkEtxT7 lRfy74dA==; Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slVcK-0000000CMEG-0eHX for linux-arm-kernel@lists.infradead.org; Tue, 03 Sep 2024 15:38:54 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 0A745A43C3E; Tue, 3 Sep 2024 15:38:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 326CCC4CEC8; Tue, 3 Sep 2024 15:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725377927; bh=S5CoP4L+Z9i13ubnj1t4i0TX9PPx6KHBRTxC+jRT8do=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QODztkH6u7BRnJThucAKNoOr795B2lvtmtFY+IUg4yvPmPrqS+agtzwSw6CiGSsTr 36GwN4s7ehdVPUd54QoFjYOtThqT1cXEu/hA3bgENux1uxsfa0weXEoow0sXRNxj4T MbhiHAzUKo/KHAHMqBB/WRJf5Su9O2cvVwo17ec3y5MSadZTXz3YV71O9IogkZe1PS NaD/XrQftLmGcW1KMoLfeeqr2CZaRDdf9iV+qK7woBMpyhjtPVkAjK7SyaPklNHr4z XHDaJ8wB2F+EY+Y9q+hbvClT7YWWSK7YAYXn6cSvMRXuPyJq8p1bDA3aJlL6SSS79R m4X1SbPTkB6HQ== Date: Tue, 3 Sep 2024 16:38:39 +0100 From: Lee Jones To: Herve Codina Cc: Geert Uytterhoeven , Andy Shevchenko , Simon Horman , Arnd Bergmann , Derek Kiernan , Dragan Cvetic , Greg Kroah-Hartman , Bjorn Helgaas , Philipp Zabel , Lars Povlsen , Steen Hegelund , Daniel Machon , UNGLinuxDriver@microchip.com, Rob Herring , Saravana Kannan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Horatiu Vultur , Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Allan Nielsen , Luca Ceresoli , Thomas Petazzoni , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= Subject: Re: [PATCH v5 3/8] mfd: syscon: Add reference counting and device managed support Message-ID: <20240903153839.GB6858@google.com> References: <20240808154658.247873-1-herve.codina@bootlin.com> <20240808154658.247873-4-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240808154658.247873-4-herve.codina@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_163852_410436_3D07FB4B X-CRM114-Status: GOOD ( 18.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 08 Aug 2024, Herve Codina wrote: > From: Clément Léger > > Syscon releasing is not supported. > Without release function, unbinding a driver that uses syscon whether > explicitly or due to a module removal left the used syscon in a in-use > state. > > For instance a syscon_node_to_regmap() call from a consumer retrieves a > syscon regmap instance. Internally, syscon_node_to_regmap() can create > syscon instance and add it to the existing syscon list. No API is > available to release this syscon instance, remove it from the list and > free it when it is not used anymore. > > Introduce reference counting in syscon in order to keep track of syscon > usage using syscon_{get,put}() and add a device managed version of > syscon_regmap_lookup_by_phandle(), to automatically release the syscon > instance on the consumer removal. > > Signed-off-by: Clément Léger > Signed-off-by: Herve Codina > --- > drivers/mfd/syscon.c | 138 ++++++++++++++++++++++++++++++++++--- > include/linux/mfd/syscon.h | 16 +++++ > 2 files changed, 144 insertions(+), 10 deletions(-) This doesn't look very popular. What are the potential ramifications for existing users? -- Lee Jones [李琼斯]