ltq-adsl: fix compilation with Linux 5.0+
[openwrt/staging/dedeckeh.git] / package / kernel / lantiq / ltq-adsl / patches / 120-platform.patch
1 --- a/src/common/drv_dsl_cpe_os_linux.c
2 +++ b/src/common/drv_dsl_cpe_os_linux.c
3 @@ -11,7 +11,7 @@
4 #ifdef __LINUX__
5
6 #define DSL_INTERN
7 -#include <linux/device.h>
8 +#include <linux/of_platform.h>
9
10 #include "drv_dsl_cpe_api.h"
11 #include "drv_dsl_cpe_api_ioctl.h"
12 @@ -1070,7 +1070,7 @@ static void DSL_DRV_DebugInit(void)
13 #endif
14
15 /* Entry point of driver */
16 -int __init DSL_ModuleInit(void)
17 +static int __devinit ltq_adsl_probe(struct platform_device *pdev)
18 {
19 struct class *dsl_class;
20 DSL_int_t i;
21 @@ -1124,7 +1124,7 @@ int __init DSL_ModuleInit(void)
22 return 0;
23 }
24
25 -void __exit DSL_ModuleCleanup(void)
26 +static int __devexit ltq_adsl_remove(struct platform_device *pdev)
27 {
28 printk("Module will be unloaded"DSL_DRV_CRLF);
29
30 @@ -1139,7 +1139,7 @@ void __exit DSL_ModuleCleanup(void)
31 (DSL_uint8_t**)&g_BndFpgaBase);
32 #endif /* defined(INCLUDE_DSL_CPE_API_VINAX) && defined(INCLUDE_DSL_BONDING)*/
33
34 - return;
35 + return 0;
36 }
37
38 #ifndef _lint
39 @@ -1155,8 +1155,30 @@ module_param(debug_level, byte, 0);
40 MODULE_PARM_DESC(debug_level, "set to get more (1) or fewer (4) debug outputs");
41 #endif /* #ifndef DSL_DEBUG_DISABLE*/
42
43 -module_init(DSL_ModuleInit);
44 -module_exit(DSL_ModuleCleanup);
45 +static const struct of_device_id ltq_adsl_match[] = {
46 +#ifdef CONFIG_DANUBE
47 + { .compatible = "lantiq,adsl-danube"},
48 +#elif defined CONFIG_AMAZON_SE
49 + { .compatible = "lantiq,adsl-ase"},
50 +#elif defined CONFIG_AR9
51 + { .compatible = "lantiq,adsl-arx100"},
52 +#endif
53 + {},
54 +};
55 +MODULE_DEVICE_TABLE(of, ltq_adsl_match);
56 +
57 +static struct platform_driver ltq_adsl_driver = {
58 + .probe = ltq_adsl_probe,
59 + .remove = __devexit_p(ltq_adsl_remove),
60 + .driver = {
61 + .name = "adsl",
62 + .owner = THIS_MODULE,
63 + .of_match_table = ltq_adsl_match,
64 + },
65 +};
66 +
67 +module_platform_driver(ltq_adsl_driver);
68 +
69 #endif /* #ifndef _lint*/
70
71 //EXPORT_SYMBOL(DSL_ModuleInit);