Re: [PATCH v6 3/8] rust: pwm: Add core 'Device' and 'Chip' object wrappers
From: Danilo Krummrich
Date: Tue Jul 01 2025 - 13:14:55 EST
On 7/1/25 6:01 PM, Michal Wilczynski wrote:
+ /// Returns a reference to the parent device of this PWM chip's device.
+ pub fn parent_device(&self) -> Option<&device::Device> {
+ self.device().parent()
+ }
I know what you use this for, i.e. to provide a &Device<Bound> reference in your
class device callbacks -- that's great!
But please don't expose this to the public. I think what you want instead is a
private unsafe method that returns you the &Device<Bound> directly, since you
also know that you set a valid parent device, hence no need to mess with the
Option as well.
And again, sorry for not catching it right away.
- Danilo