Re: [PATCH v2 10/10] kernel: fix duplicate extern declarations

From: Andy Shevchenko

Date: Fri Nov 13 2026 - 07:53:14 EST


On Fri, Nov 13, 2026 at 05:06:15AM +0400, Safocl Stollmannovic wrote:
> Compiling a kernel module with a C++ compiler results in a "duplicate
> extern specifier" error.
> This occurs because the code contains `extern asmlinkage`, and `asmlinkage`
> expands to `extern C` when processed by a C++ compiler.
> Since the code already contains sections that respond to a C++ compiler,
> I believe it is a perfectly valid approach to gradually move toward a state
> where kernel modules can be compiled by a C++ compiler without any issues.
> The `extern` specifier must be removed.

Do you have any use case in mind?

> Link: https://bugzilla.kernel.org/show_bug.cgi?id=222257

>

No blank line in a tag block.

> Signed-off-by: Safocl Stollmannovic <safocl88@xxxxxxxxx>
> ---
> include/linux/lockdep.h | 2 +-
> include/linux/printk.h | 6 +++---
> include/linux/sched/task.h | 2 +-
> include/linux/start_kernel.h | 2 +-
> include/linux/suspend.h | 4 ++--

This should be 5 patches I think.

--
With Best Regards,
Andy Shevchenko