Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1877076lqa; Tue, 30 Apr 2024 01:40:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMBJCy3KJiULgK5XTTPQtJO8ym7Bf7nhi+RZaDY5vnVzAbu6TsLkyxLC/1Do5Q+K8EUUrVnpt5Fk3CQhuxuP+9MK221gCBj+xbrLWR9Q== X-Google-Smtp-Source: AGHT+IHggxqS/GSgxZjRQ7v1Jy9rWHbcAvXWKRcBcEoh9Q5TT/p54gy4z99k7YAo+DIR+WizIsQl X-Received: by 2002:a17:902:d2cd:b0:1eb:dae:bd98 with SMTP id n13-20020a170902d2cd00b001eb0daebd98mr15031920plc.51.1714466427782; Tue, 30 Apr 2024 01:40:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714466427; cv=pass; d=google.com; s=arc-20160816; b=kshpAwL14kuDfFlXwHSb13TY4I3sz5IvMW8Bmxb8vq2xCoTGmdxZUZ75OO1sWQu3hk 1kQVz1rtJ4zE8goznR/Yw56OcREdV9Ic+wlB4rqMAFztaxL+QnMgtvA2/gkUyve9InUF tz0/WW71azYmNNykqoM1RcZ8817o8VqHFY0DRki1aIqk7ncbznsOeg7oTt3W8wKY+B0E IksxFAWagLG6YaccGQIhlk5qRc0Zr2LOlkMjuWJu1djgJmLJM80sl8wOOlNe5p53nQO3 UCMUMc2D1R7XFyRwFkQib2bxOlvxQTV0AdHWp9SIKJlVbQuz8siVeJi/GSMhPoBBX+Ed f/0Q== 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=yQCmnd7DbFj5IxQKgje4KI56L2MhsXyiKeIjOIac594=; fh=FZ8lJPkZghXo7cjjk5LlG/r+nFxaAY6dY38taoG8W1o=; b=UNcTvOVjIKX1Uf1FpJiWYY3wYRswOmTM+dEtdJ124m0XW7QY8Vacf9058iPcd76Qz9 PjN6TCbtPIRRl7rHMPclmoh1nylV/asRjub6WUPTB+pS2n9vDKu4R2Idn+mVvYrXhy9O xD/8degJvbC48WyH0NYUCsqNBgbUfMUtyjxM8mEvAd+SXsSBUJ5y74wMecqOnbQF3nTz vVinXTzquuFbM9Q46NCiskbzayZa+JXhr+l75DtMmOU0BEJY5BBFArn0uOH86QtrSDEy v7uSGiAeXcbRPBNrVfti4jxm7JzVw7DwY9eVNR3yn15pg9H9uGf6OwQjMA3LXnylrg7X ku9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=G0pcULHd; 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-163554-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163554-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 u6-20020a17090341c600b001eb0800e90asi7794323ple.249.2024.04.30.01.40.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 01:40:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163554-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=G0pcULHd; 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-163554-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163554-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 25770284052 for ; Tue, 30 Apr 2024 08:40:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BC6313C8E9; Tue, 30 Apr 2024 08:39:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="G0pcULHd" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 B72B31292D2; Tue, 30 Apr 2024 08:39:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714466358; cv=none; b=FJBdOEmMznjozunfjuih9Z+NgF3D/gKsrG9W/hlqXawiyAK7rEv0ms2VcrPUSgYC7UttFzEfHbYcsUmtnq7ctxqygQGjWKtCCErCTPkZYbtIetPFnX2mk29s/L3QjDpbMmcu2TSlSYjS2Ch2kE5XVLHFtHohRIUwbmMJE7WZvoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714466358; c=relaxed/simple; bh=9JD6NWoGfDEIQIduEDC370roBJXlkhonyzBg+qc2pFg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l/yo+jd2Wm9aiwf7voo0OTFOd29VOhVFo8F6mVqvDnRNJZ8q7mdUzKJLEjIFn0EdJCEfvBq9CaDQfnuz3Gpd/EVNHBLynl9AZi0PfahENQ8FI+qIHKxvwjbJjsw4Ub5yKzRZvw8s5zDmNNBAUB5WlXD3AAW7n0yaGfG9RuZ3N2M= 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=G0pcULHd; arc=none smtp.client-ip=217.70.183.200 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 8BF0520009; Tue, 30 Apr 2024 08:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714466355; 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=yQCmnd7DbFj5IxQKgje4KI56L2MhsXyiKeIjOIac594=; b=G0pcULHd1GS1Kd5ctB8CoCy+juU+WQe4NOXWHKIOPlA2HcBeyndoLZIcNdhk8IoE+wmxrZ K5JEQNoVQ79/u4K3yo5AC4dhHiAFBXGI8XE7CuuDRbreLi0cRvvzKw139Wlop5I9ZHQoai IjzEl8+uLGxlICtjb7W/hE805uKRG06Yk1eAM5KlzyC2YPCQG+l9jlzJZSluNa1cnct8V9 dGC0g+TmB1NyK10tEF2z7rocBsP1li2NHUmygMEw2gFs4C6YDiQQowZjOnJ6pkHSHZJ6FU 9JIzdYkyNFMMzz/uVxv9lHEYiFqLbfaBYUCr3MkuW7OTUHmPOH4Uz8q8QrIbKg== From: Herve Codina To: 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 04/17] reset: core: add get_device()/put_device on rcdev Date: Tue, 30 Apr 2024 10:37:13 +0200 Message-ID: <20240430083730.134918-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430083730.134918-1-herve.codina@bootlin.com> References: <20240430083730.134918-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.44.0