[PATCH v2] rust: remove unnecessary header includes

Tamir Duberstein posted 1 patch 1 month, 2 weeks ago
rust/helpers/build_bug.c | 1 -
rust/helpers/err.c       | 1 -
rust/helpers/kunit.c     | 1 -
rust/helpers/mutex.c     | 1 -
rust/helpers/refcount.c  | 1 -
rust/helpers/signal.c    | 1 -
rust/helpers/spinlock.c  | 1 -
rust/helpers/task.c      | 1 -
rust/helpers/wait.c      | 1 -
rust/helpers/workqueue.c | 1 -
10 files changed, 10 deletions(-)
[PATCH v2] rust: remove unnecessary header includes
Posted by Tamir Duberstein 1 month, 2 weeks ago
Commit e26fa546042a ("rust: kbuild: auto generate helper exports")
removed the need for these by automatically generating the exports; it
removed the explicit uses of `EXPORT_SYMBOL_GPL` but didn't remove the
`#include <linux/export.h>`s.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
V1 -> V2: Split grammar improvement into separate patch.

 rust/helpers/build_bug.c | 1 -
 rust/helpers/err.c       | 1 -
 rust/helpers/kunit.c     | 1 -
 rust/helpers/mutex.c     | 1 -
 rust/helpers/refcount.c  | 1 -
 rust/helpers/signal.c    | 1 -
 rust/helpers/spinlock.c  | 1 -
 rust/helpers/task.c      | 1 -
 rust/helpers/wait.c      | 1 -
 rust/helpers/workqueue.c | 1 -
 10 files changed, 10 deletions(-)

diff --git a/rust/helpers/build_bug.c b/rust/helpers/build_bug.c
index e994f7b5928c..44e579488037 100644
--- a/rust/helpers/build_bug.c
+++ b/rust/helpers/build_bug.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/errname.h>
 
 const char *rust_helper_errname(int err)
diff --git a/rust/helpers/err.c b/rust/helpers/err.c
index be3d45ef78a2..544c7cb86632 100644
--- a/rust/helpers/err.c
+++ b/rust/helpers/err.c
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include <linux/err.h>
-#include <linux/export.h>
 
 __force void *rust_helper_ERR_PTR(long err)
 {
diff --git a/rust/helpers/kunit.c b/rust/helpers/kunit.c
index 9d725067eb3b..b85a4d394c11 100644
--- a/rust/helpers/kunit.c
+++ b/rust/helpers/kunit.c
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include <kunit/test-bug.h>
-#include <linux/export.h>
 
 struct kunit *rust_helper_kunit_get_current_test(void)
 {
diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c
index a17ca8cdb50c..7e00680958ef 100644
--- a/rust/helpers/mutex.c
+++ b/rust/helpers/mutex.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/mutex.h>
 
 void rust_helper_mutex_lock(struct mutex *lock)
diff --git a/rust/helpers/refcount.c b/rust/helpers/refcount.c
index f47afc148ec3..d6adbd2e45a1 100644
--- a/rust/helpers/refcount.c
+++ b/rust/helpers/refcount.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/refcount.h>
 
 refcount_t rust_helper_REFCOUNT_INIT(int n)
diff --git a/rust/helpers/signal.c b/rust/helpers/signal.c
index 63c407f80c26..1a6bbe9438e2 100644
--- a/rust/helpers/signal.c
+++ b/rust/helpers/signal.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/sched/signal.h>
 
 int rust_helper_signal_pending(struct task_struct *t)
diff --git a/rust/helpers/spinlock.c b/rust/helpers/spinlock.c
index 775ed4d549ae..b7b0945e8b3c 100644
--- a/rust/helpers/spinlock.c
+++ b/rust/helpers/spinlock.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/spinlock.h>
 
 void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
diff --git a/rust/helpers/task.c b/rust/helpers/task.c
index 7ac789232d11..190fdb2c8e2f 100644
--- a/rust/helpers/task.c
+++ b/rust/helpers/task.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/sched/task.h>
 
 struct task_struct *rust_helper_get_current(void)
diff --git a/rust/helpers/wait.c b/rust/helpers/wait.c
index c7336bbf2750..ae48e33d9da3 100644
--- a/rust/helpers/wait.c
+++ b/rust/helpers/wait.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/wait.h>
 
 void rust_helper_init_wait(struct wait_queue_entry *wq_entry)
diff --git a/rust/helpers/workqueue.c b/rust/helpers/workqueue.c
index f59427acc323..b2b82753509b 100644
--- a/rust/helpers/workqueue.c
+++ b/rust/helpers/workqueue.c
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <linux/export.h>
 #include <linux/workqueue.h>
 
 void rust_helper_init_work_with_key(struct work_struct *work, work_func_t func,
-- 
2.47.0
Re: [PATCH v2] rust: remove unnecessary header includes
Posted by Miguel Ojeda 1 month ago
On Wed, Oct 9, 2024 at 6:26 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> Commit e26fa546042a ("rust: kbuild: auto generate helper exports")
> removed the need for these by automatically generating the exports; it
> removed the explicit uses of `EXPORT_SYMBOL_GPL` but didn't remove the
> `#include <linux/export.h>`s.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Applied to `rust-next` -- thanks everyone!

    [ Reworded title. - Miguel ]

Cheers,
Miguel
Re: [PATCH v2] rust: remove unnecessary header includes
Posted by Gary Guo 1 month, 2 weeks ago
On Wed,  9 Oct 2024 12:25:30 -0400
Tamir Duberstein <tamird@gmail.com> wrote:

> Commit e26fa546042a ("rust: kbuild: auto generate helper exports")
> removed the need for these by automatically generating the exports; it
> removed the explicit uses of `EXPORT_SYMBOL_GPL` but didn't remove the
> `#include <linux/export.h>`s.
> 
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

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

> ---
> V1 -> V2: Split grammar improvement into separate patch.
> 
>  rust/helpers/build_bug.c | 1 -
>  rust/helpers/err.c       | 1 -
>  rust/helpers/kunit.c     | 1 -
>  rust/helpers/mutex.c     | 1 -
>  rust/helpers/refcount.c  | 1 -
>  rust/helpers/signal.c    | 1 -
>  rust/helpers/spinlock.c  | 1 -
>  rust/helpers/task.c      | 1 -
>  rust/helpers/wait.c      | 1 -
>  rust/helpers/workqueue.c | 1 -
>  10 files changed, 10 deletions(-)
> 
> diff --git a/rust/helpers/build_bug.c b/rust/helpers/build_bug.c
> index e994f7b5928c..44e579488037 100644
> --- a/rust/helpers/build_bug.c
> +++ b/rust/helpers/build_bug.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/errname.h>
>  
>  const char *rust_helper_errname(int err)
> diff --git a/rust/helpers/err.c b/rust/helpers/err.c
> index be3d45ef78a2..544c7cb86632 100644
> --- a/rust/helpers/err.c
> +++ b/rust/helpers/err.c
> @@ -1,7 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
>  #include <linux/err.h>
> -#include <linux/export.h>
>  
>  __force void *rust_helper_ERR_PTR(long err)
>  {
> diff --git a/rust/helpers/kunit.c b/rust/helpers/kunit.c
> index 9d725067eb3b..b85a4d394c11 100644
> --- a/rust/helpers/kunit.c
> +++ b/rust/helpers/kunit.c
> @@ -1,7 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
>  #include <kunit/test-bug.h>
> -#include <linux/export.h>
>  
>  struct kunit *rust_helper_kunit_get_current_test(void)
>  {
> diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c
> index a17ca8cdb50c..7e00680958ef 100644
> --- a/rust/helpers/mutex.c
> +++ b/rust/helpers/mutex.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/mutex.h>
>  
>  void rust_helper_mutex_lock(struct mutex *lock)
> diff --git a/rust/helpers/refcount.c b/rust/helpers/refcount.c
> index f47afc148ec3..d6adbd2e45a1 100644
> --- a/rust/helpers/refcount.c
> +++ b/rust/helpers/refcount.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/refcount.h>
>  
>  refcount_t rust_helper_REFCOUNT_INIT(int n)
> diff --git a/rust/helpers/signal.c b/rust/helpers/signal.c
> index 63c407f80c26..1a6bbe9438e2 100644
> --- a/rust/helpers/signal.c
> +++ b/rust/helpers/signal.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/sched/signal.h>
>  
>  int rust_helper_signal_pending(struct task_struct *t)
> diff --git a/rust/helpers/spinlock.c b/rust/helpers/spinlock.c
> index 775ed4d549ae..b7b0945e8b3c 100644
> --- a/rust/helpers/spinlock.c
> +++ b/rust/helpers/spinlock.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/spinlock.h>
>  
>  void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
> diff --git a/rust/helpers/task.c b/rust/helpers/task.c
> index 7ac789232d11..190fdb2c8e2f 100644
> --- a/rust/helpers/task.c
> +++ b/rust/helpers/task.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/sched/task.h>
>  
>  struct task_struct *rust_helper_get_current(void)
> diff --git a/rust/helpers/wait.c b/rust/helpers/wait.c
> index c7336bbf2750..ae48e33d9da3 100644
> --- a/rust/helpers/wait.c
> +++ b/rust/helpers/wait.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/wait.h>
>  
>  void rust_helper_init_wait(struct wait_queue_entry *wq_entry)
> diff --git a/rust/helpers/workqueue.c b/rust/helpers/workqueue.c
> index f59427acc323..b2b82753509b 100644
> --- a/rust/helpers/workqueue.c
> +++ b/rust/helpers/workqueue.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> -#include <linux/export.h>
>  #include <linux/workqueue.h>
>  
>  void rust_helper_init_work_with_key(struct work_struct *work, work_func_t func,
Re: [PATCH v2] rust: remove unnecessary header includes
Posted by Andreas Hindborg 1 month, 2 weeks ago
"Tamir Duberstein" <tamird@gmail.com> writes:

> Commit e26fa546042a ("rust: kbuild: auto generate helper exports")
> removed the need for these by automatically generating the exports; it
> removed the explicit uses of `EXPORT_SYMBOL_GPL` but didn't remove the
> `#include <linux/export.h>`s.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>


Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>