From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5637437111 for ; Tue, 21 Jul 2026 07:50:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784620239; cv=none; b=R6Vj5jfU+2hWN9U8h995JJOc/jf8YKfU5I5yHBZzWM5bd+8UHnPZo3kr36GkIfYRq4AgP7ZEP+iE7TvNxKm7mwAHZIDXlQaahDJVwFl7Uj4QLTcE0+FxuM0QVzFGultf4ZFNlc7/IUdjER70NCdpstN5bbYlAzw8dEtJhcgorfE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784620239; c=relaxed/simple; bh=v1HyQ9w4CQ9GtjNjR+yGGPjV+zdr+mSawSgmUOS7+QY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UHyfQIPzqpADong+zUxw24mnfk0DEm7bdLsw85QOg2e9Z0FYXMBsRVvX5HKFGgeomw2ravAKYCQ53mN39ugQi1L2Qrv6+X0YXWxVWdKencx6JRATeNZhMQPZcZ1J24YKPeXT1MwAacC0q8Ga2GPNTfy1TXPYZyPpSIlwhF5FWUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uusYuBLc; arc=none smtp.client-ip=209.85.128.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uusYuBLc" Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-492488f8583so146543835e9.2 for ; Tue, 21 Jul 2026 00:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784620235; x=1785225035; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jZN0cXKJfka9i5ge5e0ezdkYWG8Vmfnfz35ybXd+mtU=; b=uusYuBLcah4tK4MNxCg1ZCyK/edOcwoSm0eps5P3xbRoCdCMhQAq/juWwIIajri/r8 ktUmODgWzrGWoP+7KhMT3iZ7lMsJe2RFnjwkbNT8Z/i2HkwU2/S3zOjnawpRCWc4dUkC 1qdQp5cBGJbIG8If2h8Mjz48YUlJnEh2TVmW4Q3P2cpoHZ01csnc6LZjU59R+uHDJ9/6 uBX/uB0cUeTOwUbeQtJTrZBOPAqrmPA/qr2ahVRKdB1gAaM4vPXYQgVKYvqmzWr9nVx3 PSjUl2CTz2uiiRBXmYKqmec73t+Vv3WHTuHc2V7XibGtm2vCcioKVDa3Dtq+UrFJfr56 nMFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784620235; x=1785225035; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jZN0cXKJfka9i5ge5e0ezdkYWG8Vmfnfz35ybXd+mtU=; b=BNIJlExo3bQZqfWXF+N6l+Ou/0Nn86FGsKb/iQzP3a7JzEx9yMoEaOeayLvN0Sgrue tgUQgIG4rZXd+bffw4Dyc/XDPYHCV6EUBwWmOlUDLp7HGhlO/Sxn4bTSzyHaxkSqQ0oV S/Vkv8fHe0M7mqzjcyVqfrF8GvizhrPBVO9g8QeYDApR3XDQBrdpEi8FESmToo1fGsbB RsrTLY/VVpaq3r+ZF2OPLAPou8y6IPd06mFXWbTyBugSZ3xhzXyLeRrMhJO9sio1+mka Snip4pc0P3tiIMwodfXtvoG1+4Wgo83zlwFFA8T39SDXn4Z/UBw4oG4Xx8tJwPGAZjb9 xjvA== X-Forwarded-Encrypted: i=1; AHgh+Rqg6HYfvlzCDzUbN23ThWpkF4bXk3E/sgzpvlDNiuyaFl8HzbA425NIoFFmUsZTAKRPIg1U9x/yuqSDsq0=@vger.kernel.org X-Gm-Message-State: AOJu0YwLgtcnIXqO+qRzyr38UELSG7PqBb49TpQRJRaM8komdqw5zepg 8jezGYKzSh6WPrGa03u/vM33fUkBxEPn714adzOE+ci+i5VG4HAiZuQdc7R5+9JdFMlruoXWhEf XrvWXfV+Dtoe7goT9Hg== X-Received: from wrny4.prod.google.com ([2002:adf:ee04:0:b0:47f:4fe5:ede6]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3b26:b0:495:6274:56c2 with SMTP id 5b1f17b1804b1-495627459e1mr65586805e9.2.1784620234926; Tue, 21 Jul 2026 00:50:34 -0700 (PDT) Date: Tue, 21 Jul 2026 07:50:33 +0000 In-Reply-To: <20260719153631.559341-1-dakr@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260719153631.559341-1-dakr@kernel.org> Message-ID: Subject: Re: [PATCH v2] rust: irq: make Registration compatible with lifetime-bound drivers From: Alice Ryhl To: Danilo Krummrich Cc: daniel.almeida@collabora.com, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, tamird@kernel.org, acourbot@nvidia.com, work@onurozkan.dev, bhelgaas@google.com, kwilczynski@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, mhi@mailbox.org, driver-core@lists.linux.dev, rust-for-linux@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Sun, Jul 19, 2026 at 05:36:05PM +0200, Danilo Krummrich wrote: > Adapt the IRQ registration to work with the Higher-Ranked Lifetime Types > (HRT) device driver architecture introduced in commit 2c7c65933600 > ("Merge patch series "rust: device: Higher-Ranked Lifetime Types for > device drivers""). > > With HRT, driver structs carry a lifetime parameter tied to the device > binding scope, allowing device resources such as pci::Bar<'bar> to be > held directly rather than through Devres indirection. However, the IRQ > abstraction required Handler: Sync + 'static, preventing handlers from > embedding lifetime-parameterized resources. > > Remove the 'static bound from Handler and ThreadedHandler and replace > the Devres indirection with direct request_irq() / > free_irq() calls in the constructor and PinnedDrop. Registration<'a, T> > stores the IrqRequest<'a>, which structurally ties it to the device > binding scope. > > Also remove the &Device parameter from the handler callbacks, > since handlers that need device access can embed it in their own type. > > IRQ handlers can now directly own device resources: > > struct IrqHandler<'irq> { > bar: pci::Bar<'irq, BAR_SIZE>, > } > > impl irq::Handler for IrqHandler<'_> { > fn handle(&self) -> IrqReturn { > let stat = self.bar.read(regs::STAT); > ... > } > } > > This eliminates the indirection previously required for IRQ handlers to > access device resources and aligns with the broader goal of expressing > every registration scoped to a driver binding through compile-time > lifetime bounds. > > Reviewed-by: Daniel Almeida > Signed-off-by: Danilo Krummrich Reviewed-by: Alice Ryhl