From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 C659B346AC5 for ; Wed, 6 May 2026 12:42:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778071353; cv=none; b=GrlB7igf18IKjK58fzXzoF56cBMQxRTlA5R1TgfwzmSZaeuI5akKqGjpt0/LKe1z6KZCft0LWcmbi3ENH/KlcE8t8prr4TfpKD2oX0dz3WMhInM05aRn6G+HrqSDUPqaLVUQ3jKiyMar5DY6TytHo/10xVQFFjniuRMA4sJnaGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778071353; c=relaxed/simple; bh=FWXRoarZwbuPU0CvSG62/+ZjpGP5KpwDFvefCjFI/Sw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=mWt1LXxg5pjpablNwX1LqPw2nxbqqzsTCgNjZ2K7e3I/Qm8R1FfBXvDlYIij27CwbbZ1vHjI6HkLbqGDUE2d8brZRwfWLlEWaEZ4ZgUfM9c55q11Up2SyVfVoU+1uYPhifuHrCON3xWkxEx6DQz9JsDN2GjLlbx8HKh0q+0HcMU= 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=vMhGwQQl; arc=none smtp.client-ip=209.85.128.73 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="vMhGwQQl" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48a5952c635so69483345e9.2 for ; Wed, 06 May 2026 05:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778071349; x=1778676149; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=GgVBoDfFSnA8IrE1su9Kgw5EWmAPu4xV1AP/RXJBkOw=; b=vMhGwQQloPZPA77E0ZYUvGzHMBroETNqP7dXYE9svzHYxCOm7udHo9kf1uGv68b20W u/9HBEyE9jACgxZBXSECYVUN/s+g0Hgpap+No7JjTOBuoBxuwOi3SSJ3uDocY4p0SndI EOgOGCgDBtpCJwlf15S7c8OF3PFIH8wRBJekmWE5D4/I9d7clyE+079SdFLxAbfK7e0J 2XJ+OkFlcsN3FzhixxAKiDpQYmU1Ft4YIE9Q2YTpF2LVP8y8BtVC9FHnBHj+WZazvgSo gGmlTGv7PMBuO2Qauzlcv1/CZzfhTzuCL/52FoKTgSOIxiYcJkHFFvT3YAUfGVRU0GhV 2skA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778071349; x=1778676149; h=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; bh=GgVBoDfFSnA8IrE1su9Kgw5EWmAPu4xV1AP/RXJBkOw=; b=o6x/aTinUzCXS3OgA+IphWzvzXBcrcuqgX1eCqs6NQEumHTgcPRZzvxs+Z0Me5YU+4 XY/NoAb2BwEhEEhxpvUY/pUip1vKU6jPsmsWXBNryX5xIclPOujjkK3yQzOD1TXGRyzk UupwOKt/MWYxcj4VaNqNjJ/PmqfvOBKGdEJknhxL1CzOPCmHOd0IkSnh+p8uBEf2CFXu Dso1dDDXZ5C4B8F+F2B6t112H9n4vFdhXklN+tyIpuQzA6FFEETBENO0fdPp3lUDLmQQ IjEnpQMdWPpUF9XCA0xqskDonwX6/ve1+SWkCpUvBiD9Kr0LtZ+czIqtAJuWPl1QhAxF +NHg== X-Forwarded-Encrypted: i=1; AFNElJ8MVZuMLSBBcZhKnkMRi7Sk+JEYwf9AwQ4GV4sxnFySwO400pLNHczP5CaN87rjVc3FMh1bKhXYMp9IyVTMzQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yy0XmfAeYIFz/gvDOybXEqlLNkMyZ3ANUuMfJD5ep+zMligK90W dfsBLL6pL7h0AxU2zg2uYn7aK+R1JAzHAUNekudh/qXNShB6ks+CHW4L0wM1tNQzM+ZxU9w4AnS mOes+qMC3nHwqcDw6Kg== X-Received: from wmbil16.prod.google.com ([2002:a05:600c:a590:b0:48a:73ac:6247]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:a08b:b0:489:1ba8:5bf0 with SMTP id 5b1f17b1804b1-48e51f4119bmr57153895e9.21.1778071348766; Wed, 06 May 2026 05:42:28 -0700 (PDT) Date: Wed, 6 May 2026 12:42:27 +0000 In-Reply-To: <20260505152400.3905096-3-dakr@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260505152400.3905096-1-dakr@kernel.org> <20260505152400.3905096-3-dakr@kernel.org> Message-ID: Subject: Re: [PATCH v2 2/3] rust: auxiliary: add registration data to auxiliary devices From: Alice Ryhl To: Danilo Krummrich Cc: gregkh@linuxfoundation.org, rafael@kernel.org, acourbot@nvidia.com, david.m.ertman@intel.com, ira.weiny@intel.com, leon@kernel.org, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Tue, May 05, 2026 at 05:23:08PM +0200, Danilo Krummrich wrote: > Add a registration_data pointer to struct auxiliary_device, allowing the > registering (parent) driver to attach private data to the device at > registration time and retrieve it later when called back by the > auxiliary (child) driver. > > By tying the data to the device's registration, Rust drivers can bind > the lifetime of device resources to it, since the auxiliary bus > guarantees that the parent driver remains bound while the auxiliary > device is bound. > > On the Rust side, Registration takes ownership of the data via > ForeignOwnable. A TypeId is stored alongside the data for runtime type > checking, making Device::registration_data() a safe method. > > Signed-off-by: Danilo Krummrich The change itself LGTM. Reviewed-by: Alice Ryhl But I'm not entirely convinced that this is the most convenient user-interface. I'm wondering if the auxiliary driver trait could specify which type the parent driver data is using in an associated type, and whether you could eliminate the check and error path that way. But then again, AuxiliaryDriver does not appear as a generic parameter in auxiliary::Driver, so it might not work. Alice