msm8916-openwrt/package/kernel/lantiq/ltq-adsl/patches/120-platform.patch
Aleksander Jan Bajkowski 1b846fe208 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>
2024-06-14 14:32:28 +02:00

72 lines
1.8 KiB
Diff

--- a/src/common/drv_dsl_cpe_os_linux.c
+++ b/src/common/drv_dsl_cpe_os_linux.c
@@ -11,7 +11,7 @@
#ifdef __LINUX__
#define DSL_INTERN
-#include <linux/device.h>
+#include <linux/of_platform.h>
#include "drv_dsl_cpe_api.h"
#include "drv_dsl_cpe_api_ioctl.h"
@@ -1070,7 +1070,7 @@ static void DSL_DRV_DebugInit(void)
#endif
/* Entry point of driver */
-int __init DSL_ModuleInit(void)
+static int __devinit ltq_adsl_probe(struct platform_device *pdev)
{
struct class *dsl_class;
DSL_int_t i;
@@ -1128,7 +1128,7 @@ int __init DSL_ModuleInit(void)
return 0;
}
-void __exit DSL_ModuleCleanup(void)
+static int __devexit ltq_adsl_remove(struct platform_device *pdev)
{
printk("Module will be unloaded"DSL_DRV_CRLF);
@@ -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)*/
- return;
+ return 0;
}
#ifndef _lint
@@ -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*/
-module_init(DSL_ModuleInit);
-module_exit(DSL_ModuleCleanup);
+static const struct of_device_id ltq_adsl_match[] = {
+#ifdef CONFIG_DANUBE
+ { .compatible = "lantiq,adsl-danube"},
+#elif defined CONFIG_AMAZON_SE
+ { .compatible = "lantiq,adsl-ase"},
+#elif defined CONFIG_AR9
+ { .compatible = "lantiq,adsl-arx100"},
+#endif
+ {},
+};
+MODULE_DEVICE_TABLE(of, ltq_adsl_match);
+
+static struct platform_driver ltq_adsl_driver = {
+ .probe = ltq_adsl_probe,
+ .remove = __devexit_p(ltq_adsl_remove),
+ .driver = {
+ .name = "adsl",
+ .owner = THIS_MODULE,
+ .of_match_table = ltq_adsl_match,
+ },
+};
+
+module_platform_driver(ltq_adsl_driver);
+
#endif /* #ifndef _lint*/
//EXPORT_SYMBOL(DSL_ModuleInit);