Skip to content

rust example register called twice. why? #127

Closed

Description

@omac777

It's not issue, but a question.
https://github.com/Rust-for-Linux/linux/blob/rust/drivers/char/rust_example.rs#L140

        let mut chrdev_reg =
            chrdev::Registration::new_pinned(cstr!("rust_chrdev"), 0, &THIS_MODULE)?;
        chrdev_reg.as_mut().register::<RustFile>()?;
        chrdev_reg.as_mut().register::<RustFile>()?;

Why is register called twice?

Thank you

Activity

  1. alex commented on Mar 19, 2021

    @alex
    Member

    Because the goal is to demo what it looks like to register multiple chardevs on the same major number. We're being lazy and just using the same file type.

    Would a comment explaining this help?

  2. added a commit that references this issue on Mar 19, 2021
    d5e7f1a
  3. added a commit that references this issue on Mar 20, 2021
    891b952
  4. omac777 commented on Mar 23, 2021

    @omac777
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions