From d5e7f1a8bd0f07c9e0a06580b2bad2a0264a1f49 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 19 Mar 2021 19:38:09 -0400 Subject: [PATCH 1/2] fixes #127 -- added a comment to clarify an example --- drivers/char/rust_example.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/rust_example.rs b/drivers/char/rust_example.rs index 1761f734d23371..a4dc54dd3cff84 100644 --- a/drivers/char/rust_example.rs +++ b/drivers/char/rust_example.rs @@ -136,6 +136,8 @@ impl KernelModule for RustExample { let mut chrdev_reg = chrdev::Registration::new_pinned(cstr!("rust_chrdev"), 0, &THIS_MODULE)?; + // Register the same kind of device twice, we're just demonstrating + // that you can use multiple minors. chrdev_reg.as_mut().register::()?; chrdev_reg.as_mut().register::()?; From 80cce19970ef6019698fdcc5d690e2ecc149e619 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 19 Mar 2021 19:50:11 -0400 Subject: [PATCH 2/2] Update rust_example.rs --- drivers/char/rust_example.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/rust_example.rs b/drivers/char/rust_example.rs index a4dc54dd3cff84..3008cd21b01fb4 100644 --- a/drivers/char/rust_example.rs +++ b/drivers/char/rust_example.rs @@ -137,7 +137,8 @@ impl KernelModule for RustExample { let mut chrdev_reg = chrdev::Registration::new_pinned(cstr!("rust_chrdev"), 0, &THIS_MODULE)?; // Register the same kind of device twice, we're just demonstrating - // that you can use multiple minors. + // that you can use multiple minors. There are two minors in this case + // because its type is `chrdev::Registration<2>` chrdev_reg.as_mut().register::()?; chrdev_reg.as_mut().register::()?;