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 74EE4CE7AB0 for ; Mon, 9 Sep 2024 07:53:29 +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:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To: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=ryHecAjCKFHY5a39/P+GIvh5tYnxD8Fg8PfucobQxhs=; b=T3JaFt9gu0ltrppC9KVZAEke7q Y/tEVNB3jLP4s7duyDC3lNlc9KsLuVKIVhT6wIl+vadVthS1z2sXmHFFf7+bsnvO5gF67o+XET4eP udW6Yj7hELiBiuzLrF2jy5nfiQmY5uQDdR5EUKMeQ05v1eXGW3ijFWf3GRQdLEqQ+mlKw9q3L92eU KAir2A52ZSXXF7IbUp49anAF/HRf931wBO4szK/jO8UF2do85qijjk/D7dMQtIsVskbjJZejNRGF7 icw1E6idjbi5XRiXdXH1BQwnzGQtn6lA6//pV7u4yrnkgx4Q9SGP/L2S/aDFYZSyPoEzZoyxxxkxP pifLdicg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snZD1-00000000v0H-3cJ7; Mon, 09 Sep 2024 07:53:15 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snZBz-00000000ukb-2Vg0 for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 07:52:13 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 26DFA40005; Mon, 9 Sep 2024 07:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1725868327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ryHecAjCKFHY5a39/P+GIvh5tYnxD8Fg8PfucobQxhs=; b=Zq6JXZ//+adouwtwkw6boEPhyiUb2gfFl1RlA0RtXhCzJdYB5HfGK1TUuiPkVXECfEwRwo 5FksXPPXTfRR/GOVEhY+/BBte1UQQL25WwxYjwMs8hI6zh80c0qZ8lho8BBY9p/4i7aqGx HVeByxhdV3V98xdhXabPHXeeVJJ+ojd/5b5xx4NhZ2xsZZaBgPbGmDkM7S5gBdiuQFAVn4 WF17yA5QBKYBiKqL8Q7+2YUgOIzQQwVr5fl42DKQM21/Muj8AIaUrastdmO0NdIpt/nGT+ dfkAHGEQdaTjvIEcerwNh6l4fmtvPPZrqc3P4P4ns6/jQPS79ay20fahDCDf3g== Date: Mon, 9 Sep 2024 09:52:03 +0200 From: Herve Codina To: Lee Jones 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 , =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: Re: [PATCH v5 3/8] mfd: syscon: Add reference counting and device managed support Message-ID: <20240909095203.3d6effdb@bootlin.com> In-Reply-To: <20240903180116.717a499b@bootlin.com> References: <20240808154658.247873-1-herve.codina@bootlin.com> <20240808154658.247873-4-herve.codina@bootlin.com> <20240903153839.GB6858@google.com> <20240903180116.717a499b@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_005211_948680_D40BC747 X-CRM114-Status: GOOD ( 27.70 ) 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 Hi Lee, Arnd, On Tue, 3 Sep 2024 18:01:16 +0200 Herve Codina wrote: > Hi Lee, > > On Tue, 3 Sep 2024 16:38:39 +0100 > Lee Jones wrote: > > > 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? > > > > Existing user don't use devm_syscon_regmap_lookup_by_phandle() nor > syscon_put_regmap(). > > So refcount is incremented but never decremented. syscon is never > released. Exactly the same as current implementation. > Nothing change for existing users. > > Best regards, > Hervé I hope I answered to Lee's question related to possible impacts on existing drivers. Is there anything else that blocks this patch from being applied ? Best regards, Hervé