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