[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25158cfc-5a8f-4419-b1ca-08743277ee23@gmail.com>
Date: Fri, 27 Oct 2023 10:07:14 -0300
From: Martin Rodriguez Reboredo <yakoyoku@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.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@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [RFC PATCH v2 2/2] samples: rust: Add USB sample bindings
On 10/27/23 04:15, Greg Kroah-Hartman wrote:
> On Thu, Oct 26, 2023 at 09:34:51PM -0300, Martin Rodriguez Reboredo wrote:
>> [...]
>> +
>> +config USB_RUST
>> + bool "Rust USB bindings"
>> + depends on USB && RUST
>> + default n
>
> Nit, "n" is the default, this line is not needed.
>
> Also, if you want to get really picky, _which_ USB is this for, the
> "host" apis (you plug a USB device into a Linux maching), or the
> "gadget" apis (i.e. Linux is running in the device that you plug into a
> USB host)? Linux supports both :)
Nice one! I'll probably target host APIs as of now due to what I have in
my hands.
>> + help
>> + Enables Rust bindings for USB.
>> [...]
>> +//! Rust USB sample.
>> +
>> +use kernel::prelude::*;
>> +
>> +module! {
>> + type: UsbSimple,
>> + name: "rust_usb_simple",
>> + author: "Martin Rodriguez Reboredo",
>> + description: "Rust USB sample",
>> + license: "GPL v2",
>> +}
>> +
>> +struct UsbSimple;
>
> "USBSimple" please.
>
>> +
>> +impl kernel::Module for UsbSimple {
>> + fn init(_module: &'static ThisModule) -> Result<Self> {
>> + pr_info!("usb enabled: {}", !usb::disabled());
>> + Ok(UsbSimple)
>> + }
>> +}
>
> I know this is just a fake patch to test the bindings logic, so sorry
> for the noise, just wanted to get terminology right :)
>
> thanks,
>
> greg k-h
No, you are right. Because Rust uses upper camel case for struct names
there's the tendency of lowering initialisms, so you can either leave it
as `USBSimple` or as `UsbSimple`. When I publish my USB host bindings
I'll take your comment into account for sure.
Powered by blists - more mailing lists