lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ve4waunjbwjjuteuzsalsvbdzwygqhfla5nvqefkl5smaixups@x2e4ltcuisxd>
Date: Mon, 20 Jan 2025 15:18:55 +0100
From: Marek Behún <kabel@...nel.org>
To: Fiona Behrens <me@...enk.dev>
Cc: Marek Behún <kabel@...nel.org>, 
	Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Pavel Machek <pavel@....cz>, 
	Lee Jones <lee@...nel.org>, Jean Delvare <jdelvare@...e.com>, 
	Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin <benno.lossin@...ton.me>, 
	Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, 
	Trevor Gross <tmgross@...ch.edu>, Mark Pearson <mpearson-lenovo@...ebb.ca>, 
	Peter Koch <pkoch@...ovo.com>, rust-for-linux@...r.kernel.org, linux-leds@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/5] rust: leds: Add hardware trigger support for
 hardware-controlled LEDs

On Mon, Jan 20, 2025 at 11:59:03AM +0100, Fiona Behrens wrote:
> >
> > This looks as if you are doing a Rust binding for struct led_trigger.
> > But you keep calling it Hardware trigger, which makes me thing that
> > you are confused about what is a LED trigger and what is a hardware
> > trigger.
> >
> > Why do you keep putting "Hardware" into the names of these symbols?
> 
> The idea was to create a abstraction specific to writing a hardware trigger (or my understanding of what that is) and deal with the other
> trigger types later, to more separate the things on the rust side with e.g. the vtables for those.
> But my understanding might be wrong.
> 
> (My broad understanding is what I did in the SE10 driver later, to tell the hardware to not present the LED to the kernel, but some other hardware wiring to a hardware thing that then drives the LED)

Looking at patch 5, you do:

  #[vtable]
  #[cfg(CONFIG_LEDS_TRIGGERS)]
  impl triggers::HardwareOperations for LedSE10 {
      fn activate(this: &mut Self::This) -> Result {
          this.data.send_cmd(LedCommand::Trigger)
      }
  }

I think this naming "triggers::HardwareOperations" may cause confusion
in the future. I think that what you implement here should be called
LED Private Trigger, or something derived from that.

Using the work "hardware" may lead people to think that it means the
other mechanism, wherein we offload software LED triggers to hardware
(which is implemented via the `hw_control_*` members of
 `struct led_classdev`).

> 
> >
> > I fear that you may be confused about some stuff here. In order to
> > determine whether this is the case, could you answer the following
> > questions please?
> 
> That might be right, thanks for trying to clear it up if that is the case.
> 
> > - What is the purpose of `struct led_hw_trigger_type`?
> Marking a led that it has a private trigger that gives control of the LED to some hardware driver.
> > - What is the purpose of the `dummy` member of this struct? What
> >   value should be assigned to it?
> From my understanding this is just to give the struct a size, so that it has a unique address in memory so the pointer value can be compared.
> > - If a LED class device (LED cdev) has the `trigger_type` member set
> >   to NULL, which LED triggers will be listed in the sysfs `trigger`
> >   file for this LED cdev? And which triggers will be listed if the
> >   `trigger_type` member is not NULL?
> For null all generic triggers will be listed, and for some value all generic plus the specific trigger.
> > - Why does both `struct led_classdev` and `struct led_trigger` have
> >   the `trigger_type` member?
> led_classdev has it to declare that it does have a led private trigger mode, and the led_trigger has it so the activate/deactive functions can be found.
> 
> My research so far into how triggers work was mostly so that I can use the wwan module trigger on the SE10 board I have here, and therefore I did not look into how to write a generic led trigger usable on more then a specific led.
> 
> Thanks a lot for clearing up possible misunderstandings,
> Fiona

OK it seems that you do indeed understand these.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ