From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0C7E86126 for ; Mon, 2 Sep 2024 10:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725271294; cv=none; b=e64uddABcE+4ejgPknfHeXeLOtrb7OdjyRbvmKFjVgYQXAdmG8OmfYOP4g6PXWWUXvb3sQZgKLYUzk7LQe0tKo8phklMRvEq+uoTaeon4ZDzPB3GZh9Eom6iL8uo4Lqk1T4cvqk7XJKnP4USMai4+j4CdlLXxMVPC8BD39dWzxg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725271294; c=relaxed/simple; bh=DLwcNSQz8RWmdGdVUt99mUKMNZeOYDfKI+/lFn9dl2Y=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=s4N28wvnu434zTk5tPmLfrvO1OQ9EUak8s5bOSc1/Z0514Oponf90XuocowpAshhTlwUp0hk1nTyrDOwGzTYb6IGZYxO2/jbI+M4BGtUui+QmOKWQTZhqxJV/GFK46xXxKLS5wCXEkaTADMCUgqTqZU+hyz1hd2W5n4O/juDz54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sl3rr-00071B-ST; Mon, 02 Sep 2024 12:01:03 +0200 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sl3rp-004sA6-MO; Mon, 02 Sep 2024 12:01:01 +0200 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1sl3rp-000gII-1q; Mon, 02 Sep 2024 12:01:01 +0200 Message-ID: <0676fcf89ca07dde911b8759b8e8b10df4bcf6cd.camel@pengutronix.de> Subject: Re: [PATCH v5 7/8] reset: core: add get_device()/put_device on rcdev From: Philipp Zabel To: Herve Codina , Geert Uytterhoeven , Andy Shevchenko , Simon Horman , Lee Jones , Arnd Bergmann , Derek Kiernan , Dragan Cvetic , Greg Kroah-Hartman , Bjorn Helgaas , Lars Povlsen , Steen Hegelund , Daniel Machon , UNGLinuxDriver@microchip.com, Rob Herring , Saravana Kannan Cc: "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?= Date: Mon, 02 Sep 2024 12:01:01 +0200 In-Reply-To: <20240808154658.247873-8-herve.codina@bootlin.com> References: <20240808154658.247873-1-herve.codina@bootlin.com> <20240808154658.247873-8-herve.codina@bootlin.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pci@vger.kernel.org On Do, 2024-08-08 at 17:46 +0200, Herve Codina wrote: > From: Cl=C3=A9ment L=C3=A9ger >=20 > Since the rcdev structure is allocated by the reset controller drivers > themselves, they need to exists as long as there is a consumer. A call to > module_get() is already existing but that does not work when using > device-tree overlays. In order to guarantee that the underlying reset > controller device does not vanish while using it, add a get_device() call > when retrieving a reset control from a reset controller device and a > put_device() when releasing that control. >=20 > Signed-off-by: Cl=C3=A9ment L=C3=A9ger > Signed-off-by: Herve Codina > --- > drivers/reset/core.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/reset/core.c b/drivers/reset/core.c > index dba74e857be6..999c3c41cf21 100644 > --- a/drivers/reset/core.c > +++ b/drivers/reset/core.c > @@ -812,6 +812,7 @@ __reset_control_get_internal(struct reset_controller_= dev *rcdev, > kref_init(&rstc->refcnt); > rstc->acquired =3D acquired; > rstc->shared =3D shared; > + get_device(rcdev->dev); > =20 > return rstc; > } > @@ -826,6 +827,7 @@ static void __reset_control_release(struct kref *kref= ) > module_put(rstc->rcdev->owner); > =20 > list_del(&rstc->list); > + put_device(rstc->rcdev->dev); > kfree(rstc); > } Reviewed-by: Philipp Zabel regards Philipp