From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C92743D3489; Tue, 3 Feb 2026 16:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770137206; cv=none; b=FrL/TGietCKcd6g+ZWcxTxAhZBdBb37VpS4DcBnhJ1tZ6niq/zDuXs+pdsAVKTCSr7sxI8kdNRwD0kdda/xELxjJSLP1JrqYD0pWtpRgQUHBw6PJI9KMwFEHpdBWGSqZ136UyUsWgYCGQcV7Nf4YmsExCh+S+iqIw9SpJlWtxWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770137206; c=relaxed/simple; bh=SN3mq4DneEguOI8zzgWysg+fcRGURMTHTYxbyoFa1/M=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=quP+sv5YIN9ngrUz7BxhuYwqkpynLt7iiGT+zigcCSu/V5V4So4yVNNJPATh8BTgKDzIPcyWhTgtONcGgHcQaLxHHjZPtCiHayLgz9vf2iMMRtS/xgmzJxc/Ho3O5ZdikIeu/xo74h6R9Q+cMGboOaevSjIhyceWbBdHonYTvWI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MRTMR4oN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MRTMR4oN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F66BC2BCB7; Tue, 3 Feb 2026 16:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770137206; bh=SN3mq4DneEguOI8zzgWysg+fcRGURMTHTYxbyoFa1/M=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=MRTMR4oNnQwjKFji63iZnjCbODzO67FUaFCb82HB3Bg1qRDJ5K2FaflXFWUVS6Le/ 5aDwl3Ze0/50Lr9lNN5mg7rvfhZK4kXAZRQdNIA3pmcQ1JprqxDQtfkm63kPF774kX b0eDwwNZfHLAMLfa8q6pAjhoyNMLe3NP7EesSqqwh0Sl+mQ6Rblj3jQlT2PljwSJKX cCUdEfvMh/HSp5Jx5YxGOIMOc4/fwjz/LK5glYHcmc6LkpDozYtaKvxXaGSwebzdBv CU6SERbxxptO48aTaV0nw+/FuYnWJ+H7HLGtTkfzAavwwZ1eVEPAclrFpsxaNaVySA M51SqFPMP4F5A== Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 03 Feb 2026 17:46:39 +0100 Message-Id: Subject: Re: [PATCH v2 3/6] rust: device: Support testing devices for equality Cc: "Matthew Maurer" , "Bjorn Andersson" , "Konrad Dybcio" , "Satya Durga Srinivasu Prabhala" , "Miguel Ojeda" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Daniel Almeida" , "Rafael J. Wysocki" , "David Airlie" , "Simona Vetter" , "Michal Wilczynski" , "Dave Ertman" , "Ira Weiny" , "Leon Romanovsky" , "Trilok Soni" , , , , , , To: "Greg Kroah-Hartman" From: "Danilo Krummrich" References: <20260203-qcom-socinfo-v2-0-d6719db85637@google.com> <20260203-qcom-socinfo-v2-3-d6719db85637@google.com> <2026020338-gratitude-overplay-98b0@gregkh> <2026020342-dime-sharply-3fd4@gregkh> In-Reply-To: <2026020342-dime-sharply-3fd4@gregkh> On Tue Feb 3, 2026 at 5:40 PM CET, Greg Kroah-Hartman wrote: > On Tue, Feb 03, 2026 at 05:29:16PM +0100, Danilo Krummrich wrote: >> On Tue Feb 3, 2026 at 5:17 PM CET, Greg Kroah-Hartman wrote: >> > And I don't see what patch in this series uses this, am I missing it? >>=20 >> impl Smem { >> pub(crate) fn access<'a>(&'a self, dev: &'a Device) -> Optio= n<&'a Mmio> { >> if *dev !=3D *self.dev { >> return None; >> } >> =09 >> // SAFETY: By our invariant, this was a subrange of what was re= turned by smem_aux_get, for >> // self.dev, and by our above check, that auxdev is still avail= able. >> Some(unsafe { Mmio::from_raw(&self.raw) }) >> } >> } >>=20 >> It's used to ensure that the Smem provided by the auxiliary parent can o= nly be >> accessed as long as the auxiliary parent device is bound. > > But how can a parent device ever bevome "unbound"? It can't, that's why auxiliary::Device::parent() returns a &Device, = i.e. as long as the child is bound the parent is guaranteed to be bound as well. The point in this implementation is that we need to prove to the resource container (Smem) that we are allowed to access the resource, since it is on= ly valid to access for the duration the parent is bound. In the end this is equivalent to Devres::access(), which bypasses the Revoc= able if we can prove that we are in a &Device scope. Having that said, the code should probably just use Devres instead. :)