public inbox for linux-modules@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] params: Replace __modinit with __init_or_module
@ 2025-08-19 12:12 Petr Pavlu
  2025-08-21 23:10 ` Sami Tolvanen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Petr Pavlu @ 2025-08-19 12:12 UTC (permalink / raw)
  To: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen
  Cc: Shyam Saini, Rasmus Villemoes, linux-modules, linux-kernel

Remove the custom __modinit macro from kernel/params.c and instead use the
common __init_or_module macro from include/linux/module.h. Both provide the
same functionality.

Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
---
 kernel/params.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index b92d64161b75..19bb04f10372 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -595,12 +595,6 @@ static ssize_t param_attr_store(const struct module_attribute *mattr,
 }
 #endif
 
-#ifdef CONFIG_MODULES
-#define __modinit
-#else
-#define __modinit __init
-#endif
-
 #ifdef CONFIG_SYSFS
 void kernel_param_lock(struct module *mod)
 {
@@ -625,9 +619,9 @@ EXPORT_SYMBOL(kernel_param_unlock);
  * create file in sysfs.  Returns an error on out of memory.  Always cleans up
  * if there's an error.
  */
-static __modinit int add_sysfs_param(struct module_kobject *mk,
-				     const struct kernel_param *kp,
-				     const char *name)
+static __init_or_module int add_sysfs_param(struct module_kobject *mk,
+					    const struct kernel_param *kp,
+					    const char *name)
 {
 	struct module_param_attrs *new_mp;
 	struct attribute **new_attrs;
@@ -760,7 +754,8 @@ void destroy_params(const struct kernel_param *params, unsigned num)
 			params[i].ops->free(params[i].arg);
 }
 
-struct module_kobject __modinit * lookup_or_create_module_kobject(const char *name)
+struct module_kobject * __init_or_module
+lookup_or_create_module_kobject(const char *name)
 {
 	struct module_kobject *mk;
 	struct kobject *kobj;

base-commit: be48bcf004f9d0c9207ff21d0edb3b42f253829e
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] params: Replace __modinit with __init_or_module
  2025-08-19 12:12 [PATCH] params: Replace __modinit with __init_or_module Petr Pavlu
@ 2025-08-21 23:10 ` Sami Tolvanen
  2025-10-22 22:55 ` Daniel Gomez
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sami Tolvanen @ 2025-08-21 23:10 UTC (permalink / raw)
  To: Petr Pavlu
  Cc: Luis Chamberlain, Daniel Gomez, Shyam Saini, Rasmus Villemoes,
	linux-modules, linux-kernel

On Tue, Aug 19, 2025 at 5:13 AM Petr Pavlu <petr.pavlu@suse.com> wrote:
>
> Remove the custom __modinit macro from kernel/params.c and instead use the
> common __init_or_module macro from include/linux/module.h. Both provide the
> same functionality.
>
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] params: Replace __modinit with __init_or_module
  2025-08-19 12:12 [PATCH] params: Replace __modinit with __init_or_module Petr Pavlu
  2025-08-21 23:10 ` Sami Tolvanen
@ 2025-10-22 22:55 ` Daniel Gomez
  2025-10-23  2:45 ` Aaron Tomlin
  2025-12-22 20:24 ` Sami Tolvanen
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Gomez @ 2025-10-22 22:55 UTC (permalink / raw)
  To: Petr Pavlu, Luis Chamberlain, Sami Tolvanen
  Cc: Shyam Saini, Rasmus Villemoes, linux-modules, linux-kernel

On 19/08/2025 14.12, Petr Pavlu wrote:
> Remove the custom __modinit macro from kernel/params.c and instead use the
> common __init_or_module macro from include/linux/module.h. Both provide the
> same functionality.
> 
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>

Reviewed-by: Daniel Gomez <da.gomez@samsung.com>

> ---
>  kernel/params.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/params.c b/kernel/params.c
> index b92d64161b75..19bb04f10372 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -595,12 +595,6 @@ static ssize_t param_attr_store(const struct module_attribute *mattr,
>  }
>  #endif
>  
> -#ifdef CONFIG_MODULES
> -#define __modinit
> -#else
> -#define __modinit __init
> -#endif
> -
>  #ifdef CONFIG_SYSFS
>  void kernel_param_lock(struct module *mod)
>  {
> @@ -625,9 +619,9 @@ EXPORT_SYMBOL(kernel_param_unlock);
>   * create file in sysfs.  Returns an error on out of memory.  Always cleans up
>   * if there's an error.
>   */
> -static __modinit int add_sysfs_param(struct module_kobject *mk,
> -				     const struct kernel_param *kp,
> -				     const char *name)
> +static __init_or_module int add_sysfs_param(struct module_kobject *mk,
> +					    const struct kernel_param *kp,
> +					    const char *name)
>  {
>  	struct module_param_attrs *new_mp;
>  	struct attribute **new_attrs;
> @@ -760,7 +754,8 @@ void destroy_params(const struct kernel_param *params, unsigned num)
>  			params[i].ops->free(params[i].arg);
>  }
>  
> -struct module_kobject __modinit * lookup_or_create_module_kobject(const char *name)
> +struct module_kobject * __init_or_module
> +lookup_or_create_module_kobject(const char *name)
>  {
>  	struct module_kobject *mk;
>  	struct kobject *kobj;
> 
> base-commit: be48bcf004f9d0c9207ff21d0edb3b42f253829e


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] params: Replace __modinit with __init_or_module
  2025-08-19 12:12 [PATCH] params: Replace __modinit with __init_or_module Petr Pavlu
  2025-08-21 23:10 ` Sami Tolvanen
  2025-10-22 22:55 ` Daniel Gomez
@ 2025-10-23  2:45 ` Aaron Tomlin
  2025-12-22 20:24 ` Sami Tolvanen
  3 siblings, 0 replies; 5+ messages in thread
From: Aaron Tomlin @ 2025-10-23  2:45 UTC (permalink / raw)
  To: Petr Pavlu
  Cc: Luis Chamberlain, Daniel Gomez, Sami Tolvanen, Shyam Saini,
	Rasmus Villemoes, linux-modules, linux-kernel

On Tue, Aug 19, 2025 at 02:12:09PM +0200, Petr Pavlu wrote:
> Remove the custom __modinit macro from kernel/params.c and instead use the
> common __init_or_module macro from include/linux/module.h. Both provide the
> same functionality.
> 
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
> ---
>  kernel/params.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/params.c b/kernel/params.c
> index b92d64161b75..19bb04f10372 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -595,12 +595,6 @@ static ssize_t param_attr_store(const struct module_attribute *mattr,
>  }
>  #endif
>  
> -#ifdef CONFIG_MODULES
> -#define __modinit
> -#else
> -#define __modinit __init
> -#endif
> -
>  #ifdef CONFIG_SYSFS
>  void kernel_param_lock(struct module *mod)
>  {
> @@ -625,9 +619,9 @@ EXPORT_SYMBOL(kernel_param_unlock);
>   * create file in sysfs.  Returns an error on out of memory.  Always cleans up
>   * if there's an error.
>   */
> -static __modinit int add_sysfs_param(struct module_kobject *mk,
> -				     const struct kernel_param *kp,
> -				     const char *name)
> +static __init_or_module int add_sysfs_param(struct module_kobject *mk,
> +					    const struct kernel_param *kp,
> +					    const char *name)
>  {
>  	struct module_param_attrs *new_mp;
>  	struct attribute **new_attrs;
> @@ -760,7 +754,8 @@ void destroy_params(const struct kernel_param *params, unsigned num)
>  			params[i].ops->free(params[i].arg);
>  }
>  
> -struct module_kobject __modinit * lookup_or_create_module_kobject(const char *name)
> +struct module_kobject * __init_or_module
> +lookup_or_create_module_kobject(const char *name)
>  {
>  	struct module_kobject *mk;
>  	struct kobject *kobj;
> 
> base-commit: be48bcf004f9d0c9207ff21d0edb3b42f253829e
> -- 
> 2.50.1
> 
> 

Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>

-- 
Aaron Tomlin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] params: Replace __modinit with __init_or_module
  2025-08-19 12:12 [PATCH] params: Replace __modinit with __init_or_module Petr Pavlu
                   ` (2 preceding siblings ...)
  2025-10-23  2:45 ` Aaron Tomlin
@ 2025-12-22 20:24 ` Sami Tolvanen
  3 siblings, 0 replies; 5+ messages in thread
From: Sami Tolvanen @ 2025-12-22 20:24 UTC (permalink / raw)
  To: Luis Chamberlain, Daniel Gomez, Petr Pavlu
  Cc: Sami Tolvanen, Shyam Saini, Rasmus Villemoes, linux-modules,
	linux-kernel

On Tue, 19 Aug 2025 14:12:09 +0200, Petr Pavlu wrote:
> Remove the custom __modinit macro from kernel/params.c and instead use the
> common __init_or_module macro from include/linux/module.h. Both provide the
> same functionality.
> 
> 

Applied to modules-next, thanks!

[1/1] params: Replace __modinit with __init_or_module
      commit: 3cb0c3bdea5388519bc1bf575dca6421b133302b

Best regards,

	Sami


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-12-22 20:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 12:12 [PATCH] params: Replace __modinit with __init_or_module Petr Pavlu
2025-08-21 23:10 ` Sami Tolvanen
2025-10-22 22:55 ` Daniel Gomez
2025-10-23  2:45 ` Aaron Tomlin
2025-12-22 20:24 ` Sami Tolvanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox