diff options
author | Martin Burnicki <martin.burnicki@meinberg.de> | 2023-07-07 16:00:05 +0200 |
---|---|---|
committer | Martin Burnicki <martin.burnicki@meinberg.de> | 2023-07-07 16:00:05 +0200 |
commit | c67930ecb04da58d5c16412f519407340966f4b4 (patch) | |
tree | 48707fef2b8c3659a4dbba9db692f9e2d0a8ce27 | |
parent | bd2b008b71b7ca7521c2d21accfa57f609ea98f4 (diff) | |
download | mbgtools-lx-c67930ecb04da58d5c16412f519407340966f4b4.tar.gz mbgtools-lx-c67930ecb04da58d5c16412f519407340966f4b4.zip |
Fix build on kernel 6.4 and newer
Commit 6e30a66433afee90e902ced95d7136e8f7edcc7e of the
kernel source removed the 'struct module *owner' parameter
from the __class_register() function. See the discussion at
https://lore.kernel.org/lkml/2023041123-tractor-quake-c44d@gregkh/
The change first appeared in v6.4-rc1~115^2~102
-rw-r--r-- | mbgclock/mbgclock_main.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/mbgclock/mbgclock_main.c b/mbgclock/mbgclock_main.c index 1b044ae..f810840 100644 --- a/mbgclock/mbgclock_main.c +++ b/mbgclock/mbgclock_main.c @@ -1,7 +1,7 @@ /************************************************************************** * - * $Id: mbgclock_main.c 1.43 2023/05/04 14:27:54 martin REL_M $ + * $Id: mbgclock_main.c 1.44 2023/07/07 11:44:36 martin REL_M $ * * Description: * Main file for the mbgclock driver for Linux which allows access to @@ -12,6 +12,8 @@ * * ----------------------------------------------------------------------- * $Log: mbgclock_main.c $ + * Revision 1.44 2023/07/07 11:44:36 martin + * Fixed build for kernel 6.4 and newer. * Revision 1.43 2023/05/04 14:27:54 martin * Fixed build for kernel 6.3 and newer. * Revision 1.42 2022/07/25 16:41:59 martin.burnicki @@ -254,6 +256,19 @@ #endif +// Commit 6e30a66433afee90e902ced95d7136e8f7edcc7e of the +// kernel source removed the struct module *owner parameter +// from the __class_register() function. See the discussion at +// https://lore.kernel.org/lkml/2023041123-tractor-quake-c44d@gregkh/ +// The change first appeared in v6.4-rc1~115^2~102 + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION( 6, 4, 0 ) ) + #define HAVE_CLASS_WITHOUT_OWNER 1 +#else + #define HAVE_CLASS_WITHOUT_OWNER 0 +#endif + + // Commit bc292ab00f6c of the kernel source introduced // vma->vm_flags wrapper functions to avoid race conditions // when the flags are updated. See the discussion at @@ -2683,7 +2698,11 @@ int __init mbgclock_init_module( void ) #if _PCPS_HAVE_LINUX_CLASS #if _PCPS_HAVE_LINUX_CLASS_CREATE - mbgclock_class = class_create( THIS_MODULE, mbgclock_class_name ); + #if HAVE_CLASS_WITHOUT_OWNER + mbgclock_class = class_create( mbgclock_class_name ); + #else + mbgclock_class = class_create( THIS_MODULE, mbgclock_class_name ); + #endif #elif _PCPS_HAVE_LINUX_CLASS_SIMPLE mbgclock_class = class_simple_create( THIS_MODULE, mbgclock_class_name ); #endif |