kernel: ltq-adsl: fix compilation warning on 6.6

Fix compilation warning:
./include/linux/export.h:29:22: error: passing argument 1 of 'class_create' from incompatible pointer type [-Werror=incompatible-pointer-types]
   29 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
/home/aleksander/workspace/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xway/ltq-dsl-ar9/drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c:1105:29: note: in expansion of macro 'THIS_MODULE'
 1105 |    dsl_class = class_create(THIS_MODULE, "dsl_cpe_api");
      |                             ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
                 from ./include/linux/platform_device.h:13,
                 from ./include/linux/of_device.h:5,
                 from ./include/linux/of_platform.h:10,
                 from /home/aleksander/workspace/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xway/ltq-dsl-ar9/drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c:15:
./include/linux/device/class.h:230:54: note: expected 'const char *' but argument is of type 'struct module *'
  230 | struct class * __must_check class_create(const char *name);
      |                                          ~~~~~~~~~~~~^~~~
/home/aleksander/workspace/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xway/ltq-dsl-ar9/drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c:1105:16: error: too many arguments to function 'class_>
 1105 |    dsl_class = class_create(THIS_MODULE, "dsl_cpe_api");
      |                ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
  230 | struct class * __must_check class_create(const char *name);
      |                             ^~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
This commit is contained in:
Aleksander Jan Bajkowski 2024-06-13 23:15:39 +02:00 committed by Hauke Mehrtens
parent fda7563c9a
commit 1b846fe208
3 changed files with 10 additions and 6 deletions

View File

@ -111,12 +111,16 @@
DSL_int_t i;
printk(DSL_DRV_CRLF DSL_DRV_CRLF "Infineon CPE API Driver version: %s" DSL_DRV_CRLF,
@@ -1104,7 +1119,8 @@ int __init DSL_ModuleInit(void)
@@ -1104,7 +1119,12 @@ int __init DSL_ModuleInit(void)
}
DSL_DRV_DevNodeInit();
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
+ dsl_class = class_create(THIS_MODULE, "dsl_cpe_api");
+#else
+ dsl_class = class_create("dsl_cpe_api");
+#endif
+ device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), NULL, "dsl_cpe_api");
return 0;
}

View File

@ -18,7 +18,7 @@
{
struct class *dsl_class;
DSL_int_t i;
@@ -1124,7 +1124,7 @@ int __init DSL_ModuleInit(void)
@@ -1128,7 +1128,7 @@ int __init DSL_ModuleInit(void)
return 0;
}
@ -27,7 +27,7 @@
{
printk("Module will be unloaded"DSL_DRV_CRLF);
@@ -1139,7 +1139,7 @@ void __exit DSL_ModuleCleanup(void)
@@ -1143,7 +1143,7 @@ void __exit DSL_ModuleCleanup(void)
(DSL_uint8_t**)&g_BndFpgaBase);
#endif /* defined(INCLUDE_DSL_CPE_API_VINAX) && defined(INCLUDE_DSL_BONDING)*/
@ -36,7 +36,7 @@
}
#ifndef _lint
@@ -1155,8 +1155,30 @@ module_param(debug_level, byte, 0);
@@ -1159,8 +1159,30 @@ module_param(debug_level, byte, 0);
MODULE_PARM_DESC(debug_level, "set to get more (1) or fewer (4) debug outputs");
#endif /* #ifndef DSL_DEBUG_DISABLE*/

View File

@ -95,7 +95,7 @@
&(dsl_cpe_api_version[4]));
DSL_DRV_MemSet( ifxDevices, 0, sizeof(DSL_devCtx_t) * DSL_DRV_MAX_DEVICE_NUMBER );
@@ -1124,7 +1099,7 @@ static int __devinit ltq_adsl_probe(stru
@@ -1128,7 +1103,7 @@ static int __devinit ltq_adsl_probe(stru
return 0;
}
@ -104,7 +104,7 @@
{
printk("Module will be unloaded"DSL_DRV_CRLF);
@@ -1169,7 +1144,7 @@ MODULE_DEVICE_TABLE(of, ltq_adsl_match);
@@ -1173,7 +1148,7 @@ MODULE_DEVICE_TABLE(of, ltq_adsl_match);
static struct platform_driver ltq_adsl_driver = {
.probe = ltq_adsl_probe,