ltq-vdsl: move to the default device name /dev/dsl_cpe_api/0
[openwrt/openwrt.git] / package / kernel / lantiq / ltq-vdsl / patches / 100-compat.patch
index a8ce61fa36c69c18e36536f3e0713f348beb147c..7670fe6a00e736e3fb85eb6de8ba4687b0a65ed5 100644 (file)
  #endif
  
     if (pINode == DSL_NULL)
-@@ -1203,6 +1197,9 @@ static void DSL_DRV_NlSendMsg(DSL_char_t
+@@ -491,7 +485,11 @@ DSL_void_t* DSL_DRV_VMalloc(
+    DSL_DRV_size_t    nSize)
+ {
+    /* VRX500-BU: Better to use vmalloc or vzmalloc here?! */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
+    return __vmalloc((unsigned long)nSize, GFP_KERNEL, PAGE_KERNEL);
++#else
++   return __vmalloc((unsigned long)nSize, GFP_KERNEL);
++#endif
+    /*   return vmalloc(nSize);*/
+ }
+@@ -917,12 +915,19 @@ DSL_int32_t DSL_DRV_ThreadShutdown(
+ DSL_uint32_t DSL_DRV_SysTimeGet(DSL_uint32_t nOffset)
+ {
+-   struct timeval tv;
+    DSL_uint32_t nTime = 0;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
++   struct timeval tv;
+    memset(&tv, 0, sizeof(tv));
+    do_gettimeofday(&tv);
+    nTime = (DSL_uint32_t)tv.tv_sec;
++#else
++   struct timespec64 now;
++
++   ktime_get_real_ts64(&now);
++   nTime = (DSL_uint32_t)now.tv_sec;
++#endif
+    if ( (nOffset == 0) || (nOffset > nTime) )
+    {
+@@ -1203,6 +1208,9 @@ static void DSL_DRV_NlSendMsg(DSL_char_t
  }
  #endif
  
  /* Entry point of driver */
  int __init DSL_ModuleInit(void)
  {
-@@ -1241,6 +1238,10 @@ int __init DSL_ModuleInit(void)
+@@ -1241,6 +1249,10 @@ int __init DSL_ModuleInit(void)
  
     DSL_DRV_DevNodeInit();
  
-+   dsl_class = class_create(THIS_MODULE, "dsl_cpe_api0");
++   dsl_class = class_create(THIS_MODULE, DRV_DSL_CPE_API_DEV_NAME);
 +   dsl_devt = MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0);
-+   device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api0");
++   device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api/0");
 +
     return 0;
  }
  
-@@ -1248,6 +1249,11 @@ void __exit DSL_ModuleCleanup(void)
+@@ -1248,6 +1260,11 @@ void __exit DSL_ModuleCleanup(void)
  {
     printk("Module will be unloaded"DSL_DRV_CRLF);