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 CBDA156B81; Tue, 24 Jun 2025 12:46:28 +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=1750769189; cv=none; b=Yd2S6oaNi9JsFcUSImvzlQbRRv8dbHS3aeCpQ+dSeeEKboPi/SvQaESd75pzCPMvkvZ6mhjTeulIHvYd+pUHopsSjHx+tYGUazX1/LzkWQ6SfWLwrN/sv9CIwhYtnIzxns+fB8FsQwhVvapU4SapybRZxgSTNP20dK272F+CUbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750769189; c=relaxed/simple; bh=RdmvkU7zbsp1GGLnDF1okwRvijnnAgoRsQAHXDHpULM=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=Q7GCTaD5wnG2ryeUMr6SwPHIo1hbHtAtRuhwobed+c3rilfJSlMWKY/CaGa6MLbYc97Q5/cpF6E0gwmGuLHYKwkplZKebThELoqxWXmLbqlgoyGQnCv7g04HojhR71hMhdcJijxtwc9ra+gD2TKcpNlcGqXMgWxfz91KU2fmVsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TbKSiOw8; 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="TbKSiOw8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16FC6C4CEE3; Tue, 24 Jun 2025 12:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750769188; bh=RdmvkU7zbsp1GGLnDF1okwRvijnnAgoRsQAHXDHpULM=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=TbKSiOw8qOeDDDpO0G4u2IR+zED7E6RjYG4IyxZIdZjBRaqK8TkSxwz/Zxh2CB6tv VPuNpPLmIlNVRS4a54Y42deOed29dHUcWQCkFdn4bfISW52QsSDGu+Cm0s/4JC+xiS sGwMBKoJrJN1CZ/6E1prZZDSSZ2HuM/2EyP9J1yR3DBC4wa9bXY+R5EgZwPRpdruhp nej8i1IpvPioEt+zdObcQ1xJPmKDs3flKtmTb3szLJEdxfVxJ5VL9zUNsny6Y1M/OP gxeIBA15jDbDp1JzIY84KSlo46AoxG4B19HGDKBUqIgskVVVBYgcQ3hk2cpHfI7Ydz RkLHZBCMimPnQ== Precedence: bulk X-Mailing-List: linux-pci@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, 24 Jun 2025 14:46:23 +0200 Message-Id: Cc: "Boqun Feng" , "Alice Ryhl" , "Danilo Krummrich" , "Miguel Ojeda" , "Alex Gaynor" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Trevor Gross" , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Thomas Gleixner" , "Bjorn Helgaas" , =?utf-8?q?Krzysztof_Wilczy=C2=B4nski?= , , , Subject: Re: [PATCH v4 3/6] rust: irq: add support for non-threaded IRQs and handlers From: "Benno Lossin" To: "Daniel Almeida" X-Mailer: aerc 0.20.1 References: <20250608-topics-tyr-request_irq-v4-0-81cb81fb8073@collabora.com> <20250608-topics-tyr-request_irq-v4-3-81cb81fb8073@collabora.com> In-Reply-To: On Tue Jun 24, 2025 at 2:31 PM CEST, Daniel Almeida wrote: > On 23 Jun 2025, at 16:28, Benno Lossin wrote: >> On Mon Jun 23, 2025 at 9:18 PM CEST, Boqun Feng wrote: >>> try_pin_init!(&this in Self { >>> handler, >>> inner: Devres::new( >>> dev, >>> RegistrationInner { >>> // Needs to use `handler` address as cookie, same for >>> // request_irq(). >>> cookie: &raw (*(this.as_ptr().cast()).handler), >>> irq: { >>> to_result(unsafe { bindings::request_irq(...) })?; >>> irq >>> } >>> }, >>> GFP_KERNEL, >>> )?, >>> _pin: PhantomPinned >>> }) >>=20 >> Well yes and no, with the Devres changes, the `cookie` can just be the >> address of the `RegistrationInner` & we can do it this way :) >>=20 >> --- >> Cheers, >> Benno > > > No, we need this to be the address of the the whole thing (i.e. > Registration), otherwise you can=E2=80=99t access the handler in the i= rq > callback. Gotcha, so you keep the cookie field, but you should still be able to use `try_pin_init` & the devres improvements to avoid the use of `pin_init_from_closure`. --- Cheers, Benno