[v3] rust: helpers: sort includes alphabetically in rust/helpers.c

Message ID 20230426204923.16195-1-amiculas@cisco.com
State New
Headers
Series [v3] rust: helpers: sort includes alphabetically in rust/helpers.c |

Commit Message

Ariel Miculas April 26, 2023, 8:49 p.m. UTC
  Sort the #include directives of rust/helpers.c alphabetically and add a
comment specifying this. The reason for this is to improve readability
and to be consistent with the other files with a similar approach within
'rust/'.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1003
Signed-off-by: Ariel Miculas <amiculas@cisco.com>
---
 rust/helpers.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Martin Rodriguez Reboredo April 26, 2023, 8:55 p.m. UTC | #1
On 4/26/23 17:49, Ariel Miculas wrote:
> Sort the #include directives of rust/helpers.c alphabetically and add a
> comment specifying this. The reason for this is to improve readability
> and to be consistent with the other files with a similar approach within
> 'rust/'.
> 
> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1003
> Signed-off-by: Ariel Miculas <amiculas@cisco.com>
> ---
> [...]
Shouldn't the link use the `Link: <url> [1]` format? Otherwise LGTM.

Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
  
Ariel Miculas April 26, 2023, 9:04 p.m. UTC | #2
This is the format I see in https://docs.kernel.org/process/5.Posting.html#
```
Link: https://example.com/somewhere.html  optional-other-stuff
```
And looking briefly through the git log I see the simple `Link:
www.example.com` format.
But I'm happy to change this if needed, can you point me to the right format?

On Wed, Apr 26, 2023 at 11:57 PM Martin Rodriguez Reboredo
<yakoyoku@gmail.com> wrote:
>
> On 4/26/23 17:49, Ariel Miculas wrote:
> > Sort the #include directives of rust/helpers.c alphabetically and add a
> > comment specifying this. The reason for this is to improve readability
> > and to be consistent with the other files with a similar approach within
> > 'rust/'.
> >
> > Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> > Link: https://github.com/Rust-for-Linux/linux/issues/1003
> > Signed-off-by: Ariel Miculas <amiculas@cisco.com>
> > ---
> > [...]
> Shouldn't the link use the `Link: <url> [1]` format? Otherwise LGTM.
>
> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
  
Miguel Ojeda April 26, 2023, 9:28 p.m. UTC | #3
On Wed, Apr 26, 2023 at 11:04 PM Ariel Miculas <ariel.miculas@gmail.com> wrote:
>
> This is the format I see in https://docs.kernel.org/process/5.Posting.html#
> ```
> Link: https://example.com/somewhere.html  optional-other-stuff
> ```
> And looking briefly through the git log I see the simple `Link:
> www.example.com` format.

Indeed, the one you have in the commit is the right one :)

There are 5 commits in the kernel with the format mentioned by Martin,
but they were probably unintentional.

Cheers,
Miguel
  
Gary Guo April 27, 2023, 12:36 p.m. UTC | #4
On Wed, 26 Apr 2023 23:49:23 +0300
Ariel Miculas <amiculas@cisco.com> wrote:

> Sort the #include directives of rust/helpers.c alphabetically and add a
> comment specifying this. The reason for this is to improve readability
> and to be consistent with the other files with a similar approach within
> 'rust/'.
> 
> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1003
> Signed-off-by: Ariel Miculas <amiculas@cisco.com>

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
>  rust/helpers.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/rust/helpers.c b/rust/helpers.c
> index 81e80261d597..73c01db0c828 100644
> --- a/rust/helpers.c
> +++ b/rust/helpers.c
> @@ -16,15 +16,17 @@
>   *
>   * All symbols are exported as GPL-only to guarantee no GPL-only feature is
>   * accidentally exposed.
> + *
> + * Sorted alphabetically.
>   */
>  
>  #include <linux/bug.h>
>  #include <linux/build_bug.h>
>  #include <linux/err.h>
> -#include <linux/refcount.h>
>  #include <linux/mutex.h>
> -#include <linux/spinlock.h>
> +#include <linux/refcount.h>
>  #include <linux/sched/signal.h>
> +#include <linux/spinlock.h>
>  #include <linux/wait.h>
>  
>  __noreturn void rust_helper_BUG(void)
  
Miguel Ojeda July 19, 2023, 8:01 p.m. UTC | #5
On Wed, Apr 26, 2023 at 10:50 PM Ariel Miculas <amiculas@cisco.com> wrote:
>
> Sort the #include directives of rust/helpers.c alphabetically and add a
> comment specifying this. The reason for this is to improve readability
> and to be consistent with the other files with a similar approach within
> 'rust/'.
>
> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1003
> Signed-off-by: Ariel Miculas <amiculas@cisco.com>

Applied to `rust-next`, thanks!

Cheers,
Miguel
  

Patch

diff --git a/rust/helpers.c b/rust/helpers.c
index 81e80261d597..73c01db0c828 100644
--- a/rust/helpers.c
+++ b/rust/helpers.c
@@ -16,15 +16,17 @@ 
  *
  * All symbols are exported as GPL-only to guarantee no GPL-only feature is
  * accidentally exposed.
+ *
+ * Sorted alphabetically.
  */
 
 #include <linux/bug.h>
 #include <linux/build_bug.h>
 #include <linux/err.h>
-#include <linux/refcount.h>
 #include <linux/mutex.h>
-#include <linux/spinlock.h>
+#include <linux/refcount.h>
 #include <linux/sched/signal.h>
+#include <linux/spinlock.h>
 #include <linux/wait.h>
 
 __noreturn void rust_helper_BUG(void)