Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Device::from_raw() in favor of using Device::as_ref() + into(). #1088

Open
fbq opened this issue Jul 11, 2024 · 2 comments
Open

Remove Device::from_raw() in favor of using Device::as_ref() + into(). #1088

fbq opened this issue Jul 11, 2024 · 2 comments
Labels
good first issue Good for newcomers • lib Related to the `rust/` library.

Comments

@fbq
Copy link
Member

fbq commented Jul 11, 2024

First, there is an inconsistency between Device::from_raw() and ARef::from_raw() on whether the refcount gets increased or not. That means Device::from_raw() should be renamed. Moreover, as suggested here, Device::from_raw() can be avoid by using unsafe { Device::as_ref(ptr) }.into(). Things need to be done:

  • Remove Device::from_raw().
  • Add example usage in the documentation of Device::as_ref() and probably ARef as well

This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes, to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and so on. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@fbq fbq added the good first issue Good for newcomers label Jul 11, 2024
@ojeda ojeda added the • lib Related to the `rust/` library. label Jul 12, 2024
@charmitro
Copy link

Perhaps @panosfol would like to take on this introductory patch for the kernel.

@panosfol
Copy link

Perhaps @panosfol would like to take on this introductory patch for the kernel.

Yes sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers • lib Related to the `rust/` library.
Development

No branches or pull requests

4 participants