rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/2] samples: rust: Add USB sample bindings
Date: Fri, 27 Oct 2023 10:07:14 -0300	[thread overview]
Message-ID: <25158cfc-5a8f-4419-b1ca-08743277ee23@gmail.com> (raw)
In-Reply-To: <2023102737-juniper-trodden-afb4@gregkh>

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.

  reply	other threads:[~2023-10-27 13:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27  0:34 [RFC PATCH v2 0/2] rust: crates in other kernel directories Martin Rodriguez Reboredo
2023-10-27  0:34 ` [RFC PATCH v2 1/2] kbuild: Build Rust crates as libraries Martin Rodriguez Reboredo
2023-10-27  0:34 ` [RFC PATCH v2 2/2] samples: rust: Add USB sample bindings Martin Rodriguez Reboredo
2023-10-27  3:21   ` Martin Rodriguez Reboredo
2023-10-27  7:15   ` Greg Kroah-Hartman
2023-10-27 13:07     ` Martin Rodriguez Reboredo [this message]
2023-10-27 13:08   ` Greg Kroah-Hartman

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=25158cfc-5a8f-4419-b1ca-08743277ee23@gmail.com \
    --to=yakoyoku@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.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).