From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Aaron Tomlin <atomlin@atomlin.com>,
Shyam Saini <shyamsaini@linux.microsoft.com>,
Kees Cook <kees@kernel.org>,
Thorsten Blum <thorsten.blum@linux.dev>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] module: remove MODULE_VERSION()
Date: Fri, 13 Mar 2026 16:46:06 +0100 [thread overview]
Message-ID: <2026031303-prelaunch-creation-3fce@gregkh> (raw)
In-Reply-To: <2026031341-evolve-repeater-987b@gregkh>
On Fri, Mar 13, 2026 at 03:20:42PM +0100, Greg Kroah-Hartman wrote:
> Module "versions" do not make sense as the kernel is built all at once,
> the "version" is the overall kernel version number, so modules can not
> really be described as having a unique version given that they rely on
> the infrastructure of the whole kernel.
>
> For now, just make this an "empty" define, to keep existing code
> building properly as the tree is slowly purged of the use of this over
> time.
>
> This macro will be removed entirely in the future when there are no
> in-tree users.
>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Petr Pavlu <petr.pavlu@suse.com>
> Cc: Daniel Gomez <da.gomez@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Aaron Tomlin <atomlin@atomlin.com>
> Cc: Shyam Saini <shyamsaini@linux.microsoft.com>
> Cc: Kees Cook <kees@kernel.org>
> Cc: Thorsten Blum <thorsten.blum@linux.dev>
> Cc: Christoph Hellwig <hch@infradead.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> include/linux/module.h | 56 +++++++++---------------------------------
> kernel/params.c | 30 ----------------------
> 2 files changed, 11 insertions(+), 75 deletions(-)
Sami just pointed out to me off-list that maybe I should also drop the
srcversion stuff too. I'll gladly do that too, does anyone know if
anyone even uses that anymore?
thanks,
greg k-h
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 14f391b186c6..37cb369b4c3a 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -62,15 +62,6 @@ struct module_attribute {
> void (*free)(struct module *);
> };
>
> -struct module_version_attribute {
> - struct module_attribute mattr;
> - const char *module_name;
> - const char *version;
> -};
> -
> -extern ssize_t __modver_version_show(const struct module_attribute *,
> - struct module_kobject *, char *);
> -
> extern const struct module_attribute module_uevent;
>
> /* These are either module local, or the kernel's dummy ones. */
> @@ -256,43 +247,18 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name);
> static typeof(name) __mod_device_table(type, name) \
> __attribute__ ((used, alias(__stringify(name))))
>
> -/* Version of form [<epoch>:]<version>[-<extra-version>].
> - * Or for CVS/RCS ID version, everything but the number is stripped.
> - * <epoch>: A (small) unsigned integer which allows you to start versions
> - * anew. If not mentioned, it's zero. eg. "2:1.0" is after
> - * "1:2.0".
> -
> - * <version>: The <version> may contain only alphanumerics and the
> - * character `.'. Ordered by numeric sort for numeric parts,
> - * ascii sort for ascii parts (as per RPM or DEB algorithm).
> -
> - * <extraversion>: Like <version>, but inserted for local
> - * customizations, eg "rh3" or "rusty1".
> -
> - * Using this automatically adds a checksum of the .c files and the
> - * local headers in "srcversion".
> +/*
> + * Module "versions" do not make sense as the kernel is built all at once, the
> + * "version" is the overall kernel version number, so modules can not really be
> + * described as having a unique version given that they rely on the
> + * infrastructure of the whole kernel.
> + *
> + * For now, just make this an "empty" define, to keep existing code building
> + * properly as the tree is slowly purged of the use of this over time.
> + *
> + * It will be removed in the future when there are no in-tree users.
> */
> -
> -#if defined(MODULE) || !defined(CONFIG_SYSFS)
> -#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
> -#else
> -#define MODULE_VERSION(_version) \
> - MODULE_INFO(version, _version); \
> - static const struct module_version_attribute __modver_attr \
> - __used __section("__modver") \
> - __aligned(__alignof__(struct module_version_attribute)) \
> - = { \
> - .mattr = { \
> - .attr = { \
> - .name = "version", \
> - .mode = S_IRUGO, \
> - }, \
> - .show = __modver_version_show, \
> - }, \
> - .module_name = KBUILD_MODNAME, \
> - .version = _version, \
> - }
> -#endif
> +#define MODULE_VERSION(_version)
>
> /* Optional firmware file (or files) needed by the module
> * format is simply firmware file name. Multiple firmware
> diff --git a/kernel/params.c b/kernel/params.c
> index 7188a12dbe86..1b14b1ab5fcb 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -846,35 +846,6 @@ static void __init param_sysfs_builtin(void)
> }
> }
>
> -ssize_t __modver_version_show(const struct module_attribute *mattr,
> - struct module_kobject *mk, char *buf)
> -{
> - const struct module_version_attribute *vattr =
> - container_of_const(mattr, struct module_version_attribute, mattr);
> -
> - return scnprintf(buf, PAGE_SIZE, "%s\n", vattr->version);
> -}
> -
> -extern const struct module_version_attribute __start___modver[];
> -extern const struct module_version_attribute __stop___modver[];
> -
> -static void __init version_sysfs_builtin(void)
> -{
> - const struct module_version_attribute *vattr;
> - struct module_kobject *mk;
> - int err;
> -
> - for (vattr = __start___modver; vattr < __stop___modver; vattr++) {
> - mk = lookup_or_create_module_kobject(vattr->module_name);
> - if (mk) {
> - err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
> - WARN_ON_ONCE(err);
> - kobject_uevent(&mk->kobj, KOBJ_ADD);
> - kobject_put(&mk->kobj);
> - }
> - }
> -}
> -
> /* module-related sysfs stuff */
>
> static ssize_t module_attr_show(struct kobject *kobj,
> @@ -977,7 +948,6 @@ static int __init param_sysfs_builtin_init(void)
> if (!module_kset)
> return -ENOMEM;
>
> - version_sysfs_builtin();
> param_sysfs_builtin();
>
> return 0;
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-03-13 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 14:20 [PATCH] module: remove MODULE_VERSION() Greg Kroah-Hartman
2026-03-13 15:46 ` Greg Kroah-Hartman [this message]
2026-03-13 17:28 ` Sami Tolvanen
2026-03-14 10:22 ` Christophe Leroy (CS GROUP)
2026-03-16 8:58 ` Christoph Hellwig
2026-03-16 17:25 ` Sami Tolvanen
2026-03-16 10:48 ` Petr Pavlu
2026-03-13 17:07 ` Sami Tolvanen
2026-03-16 8:57 ` Christoph Hellwig
2026-03-16 9:37 ` Petr Pavlu
2026-03-16 10:03 ` Greg Kroah-Hartman
2026-03-17 12:50 ` Petr Pavlu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026031303-prelaunch-creation-3fce@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=atomlin@atomlin.com \
--cc=da.gomez@kernel.org \
--cc=hch@infradead.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=samitolvanen@google.com \
--cc=shyamsaini@linux.microsoft.com \
--cc=thorsten.blum@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox