Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2155294lqb; Mon, 27 May 2024 09:30:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1u1gKS89+HhXJfbPO666IQBKw8m8ryXsM+Xf3epx7ockxUxSNEH9Do/hxM6PS/gF1aaKcMidf3qodag/Kj3lacyVUfDYUQRnzHIrSAg== X-Google-Smtp-Source: AGHT+IHR7R6ea6zwJDYPJF1ZI8B8iLJCXKsmDWfz8DHZaRVXDyl5COPMwHrhiaC48bmApbr0WOzF X-Received: by 2002:a17:902:f689:b0:1f4:b986:bb52 with SMTP id d9443c01a7336-1f4b986bf79mr15123625ad.30.1716827410759; Mon, 27 May 2024 09:30:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716827410; cv=pass; d=google.com; s=arc-20160816; b=ZeZF25Qg5BaPCk78MtyYt1GzD3SIkN89cyDF1u9+TsaBz+hX42T0/yAT5xzu2i3vCq npx+g+m8yuX5aI7VIy36jrK45lPekNFEgfKaVq3I3Bh8sbmt+cYexBwjRWb+Aa1ZIMI8 ABpDHG/pAm11Kn8jkg3x5Cd5VbiYxlC8bMD2G6wFZnAkYB78hGfY83Ewdn0fepTkelm2 ZW6GWmM1YJnwEIYI7fFfQJLSQsRSdYDHpDZ/Atvs8nbOYjOhpL8ZLsTRLjFZENLSC4iw wnr7z2ADzvP1ILXKV1e+gEACFDpEmThC9tjtSRt3Epjqrnyrizo9jdHuWTsgCVWSSMmm 9Ixg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bOAN8DOKAutpcJ98IdSxdr6GKYFYp22/ixh21amGeTg=; fh=FgwDDXx9Ad8vmEmzzXm7uCBC9EwkDp3k7U93srafrH4=; b=vKj5cbQnD2HxJzQR4indpavuDJ+xvVvisXJR6wo6PjY/HUkrJg1u6JnSHXEuCCUe5o 211hOR7vG3JbcNLjwND4kyB1pkRjyz8SsWxjmNAdVW1StUmsWo/6zKT4AUE6DMYB6bPZ stFBVuSrHaKyYqwCpnUGugLojlBC1GtJEFufnlVcnuXn/sLfVINctU6BnmSO4UjcbmEX Gk6pGgJ6wwiIC05stIIeQ5LmLAp0EFe7GZMXIY///PO8DGtpEBAuamjnEuiMHRPLF7dl dBDU2258PUQpUZ/rWXVvo4Nmn+UU1VAR6xxK+hHQ3zEgTAfGNsG3QdONOseILikvEu11 61dw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EengVC3r; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-191215-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c78bc17si62650085ad.109.2024.05.27.09.30.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:30:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191215-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EengVC3r; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-191215-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1FAC32827E4 for ; Mon, 27 May 2024 16:22:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA4A5168C26; Mon, 27 May 2024 16:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EengVC3r" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 3D1C6167291; Mon, 27 May 2024 16:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716826510; cv=none; b=JaaW2OZ4OBAp4r2Z4CiWBz8oUIZcPLk23iBp2vLI/qygpxwxZm/yS4/Q18tcRRqZoqGYk70pMGq7KpRDEiNx4eNdfMamA5vpCKRqL5VQIM72ce9QCvDQxufHY2Irmp8yLK8t27chc4Hl8hyF3ZT9ZwzFBC/WJ0Ea+2LW0NCxBAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716826510; c=relaxed/simple; bh=E2Nmsu/7HYQLnn0sN5b1S2heBsMjF3oRWqAoBIGaDBE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XV8ZAf7CZVIDpobj8Ji6/XJ6Ov3FQV1zEzO346gEmDuNBMaYH7XGE0DqREUfqr3INap07sGs5ny1nRAenGadXYV/aT86NqnILY/AOFNSnYg1w9rIa4SIb4mOxnLm3ZDlnH/+G8XKR/e00NHyyZpE9SOEoJPVHRgiuWuYTIzPf5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=EengVC3r; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id E54D5FF810; Mon, 27 May 2024 16:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716826505; 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=bOAN8DOKAutpcJ98IdSxdr6GKYFYp22/ixh21amGeTg=; b=EengVC3rkV2AdgX2gUMxvuPJrkjrG9Id9BGc2TzsDfOh9F9xdVgWDv7UaVJztjDqCVoZTa KlGs1D+C8gveTFGS1Dn7nYjiR+WS+GlxfpSazJxn8Uy8QgbcACVwbZ7xDBymiBlFk6UG4D 4jjuKtCigVm/JuJ9mSlrx9euQ5TyAXK93RvGrUwa4FbvBahFUGbIt1id8TecYs9kKirod2 dSfgpdAzePZG8UOgAxH3RLpxWOvMoQcu8ttprKDI23osJb8s2z4xkvl+lAcdgAithHghe0 1JUCFiZgfvMp6eRZDamI9S69eDFVHXSWRBsij5GN7su9cWMuhV55MN+VSg0sRA== From: Herve Codina To: Simon Horman , Sai Krishna Gajula , Herve Codina , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lee Jones , Arnd Bergmann , Horatiu Vultur , UNGLinuxDriver@microchip.com, Andrew Lunn , Heiner Kallweit , Russell King , Saravana Kannan , Bjorn Helgaas , Philipp Zabel , Lars Povlsen , Steen Hegelund , Daniel Machon , Alexandre Belloni Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Allan Nielsen , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= Subject: [PATCH v2 04/19] reset: core: add get_device()/put_device on rcdev Date: Mon, 27 May 2024 18:14:31 +0200 Message-ID: <20240527161450.326615-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240527161450.326615-1-herve.codina@bootlin.com> References: <20240527161450.326615-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com From: Clément Léger 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. Signed-off-by: Clément Léger Signed-off-by: Herve Codina --- drivers/reset/core.c | 2 ++ 1 file changed, 2 insertions(+) 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 = acquired; rstc->shared = shared; + get_device(rcdev->dev); return rstc; } @@ -826,6 +827,7 @@ static void __reset_control_release(struct kref *kref) module_put(rstc->rcdev->owner); list_del(&rstc->list); + put_device(rstc->rcdev->dev); kfree(rstc); } -- 2.45.0