devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>, "Guo Ren" <guoren@kernel.org>,
	"Fu Wei" <wefu@redhat.com>, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Drew Fustini" <fustini@kernel.org>,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
	rust-for-linux@vger.kernel.org, linux-riscv@lists.infradead.org,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH v6 3/8] rust: pwm: Add core 'Device' and 'Chip' object wrappers
Date: Tue, 1 Jul 2025 19:14:37 +0200	[thread overview]
Message-ID: <aeb45ff9-73a7-427b-8cca-cc9646b65b9b@kernel.org> (raw)
In-Reply-To: <20250701-rust-next-pwm-working-fan-for-sending-v6-3-2710932f6f6b@samsung.com>

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

  reply	other threads:[~2025-07-01 17:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250701160157eucas1p1b6dfd8bf3859b07bff0cfcd171d7c939@eucas1p1.samsung.com>
2025-07-01 16:01 ` [PATCH v6 0/8] Rust Abstractions for PWM subsystem with TH1520 PWM driver Michal Wilczynski
     [not found]   ` <CGME20250701160158eucas1p1402f4cb2ed2b4d0d672d47f5d3beb3d1@eucas1p1.samsung.com>
2025-07-01 16:01     ` [PATCH v6 1/8] pwm: Expose PWM_WFHWSIZE in public header Michal Wilczynski
     [not found]   ` <CGME20250701160200eucas1p150e6aaae8efebc723776476a054ddad1@eucas1p1.samsung.com>
2025-07-01 16:01     ` [PATCH v6 2/8] rust: pwm: Add Kconfig and basic data structures Michal Wilczynski
     [not found]   ` <CGME20250701160201eucas1p14d4182ecd8d6b2034f55ed5262bac646@eucas1p1.samsung.com>
2025-07-01 16:01     ` [PATCH v6 3/8] rust: pwm: Add core 'Device' and 'Chip' object wrappers Michal Wilczynski
2025-07-01 17:14       ` Danilo Krummrich [this message]
     [not found]   ` <CGME20250701160202eucas1p25bc7b00304c064bf35a753d28f970c57@eucas1p2.samsung.com>
2025-07-01 16:01     ` [PATCH v6 4/8] rust: pwm: Add driver operations trait and registration support Michal Wilczynski
     [not found]   ` <CGME20250701160204eucas1p2d0f1ec8ab7310927f497040bb879ba05@eucas1p2.samsung.com>
2025-07-01 16:01     ` [PATCH v6 5/8] pwm: Add Rust driver for T-HEAD TH1520 SoC Michal Wilczynski
     [not found]   ` <CGME20250701160205eucas1p27a77e76ce28deede85e666f0544c6c7c@eucas1p2.samsung.com>
2025-07-01 16:01     ` [PATCH v6 6/8] dt-bindings: pwm: thead: Add T-HEAD TH1520 PWM controller Michal Wilczynski
     [not found]   ` <CGME20250701160206eucas1p1b4510b4dc09dc7193cac0e51db908784@eucas1p1.samsung.com>
2025-07-01 16:01     ` [PATCH v6 7/8] riscv: dts: thead: Add PWM controller node Michal Wilczynski
     [not found]   ` <CGME20250701160208eucas1p2633ce5cd0b9ef013999b3d596be74cdd@eucas1p2.samsung.com>
2025-07-01 16:01     ` [PATCH v6 8/8] riscv: dts: thead: Add PWM fan and thermal control Michal Wilczynski
2025-07-01 20:05   ` [PATCH v6 0/8] Rust Abstractions for PWM subsystem with TH1520 PWM driver Drew Fustini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeb45ff9-73a7-427b-8cca-cc9646b65b9b@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aliceryhl@google.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fustini@kernel.org \
    --cc=gary@garyguo.net \
    --cc=guoren@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lossin@kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=m.wilczynski@samsung.com \
    --cc=mturquette@baylibre.com \
    --cc=ojeda@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ukleinek@kernel.org \
    --cc=wefu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).