lantiq: Make ATM and PTM drivers compatible with kernel 4.1
[lede-git/.git] / package / kernel / lantiq / ltq-ptm / src / ifxmips_ptm_vdsl.c
index 745eb03321d5f3a376c2a04034e733766526dfc5..9adeba4d00c7c50b946d5d3e209dba9bba699633 100644 (file)
@@ -256,8 +256,8 @@ static int ptm_napi_poll(struct napi_struct *napi, int budget)
     //  clear interrupt
     IFX_REG_W32_MASK(0, 1, MBOX_IGU1_ISRC);
     //  no more traffic
-    if ( WAN_RX_DESC_BASE[g_ptm_priv_data.itf[0].rx_desc_pos].own ) {   //  if PP32 hold descriptor
-        napi_complete(napi);
+    if (work_done < budget) {
+       napi_complete(napi);
         IFX_REG_W32_MASK(0, 1, MBOX_IGU1_IER);
         return work_done;
     }
@@ -951,7 +951,7 @@ static int ifx_ptm_init(void)
     }
 
     for ( i = 0; i < ARRAY_SIZE(g_net_dev); i++ ) {
-        g_net_dev[i] = alloc_netdev(0, g_net_dev_name[i], ether_setup);
+        g_net_dev[i] = alloc_netdev(0, g_net_dev_name[i], NET_NAME_UNKNOWN, ether_setup);
         if ( g_net_dev[i] == NULL )
             goto ALLOC_NETDEV_FAIL;
         ptm_setup(g_net_dev[i], i);
@@ -964,7 +964,11 @@ static int ifx_ptm_init(void)
     }
 
     /*  register interrupt handler  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
+    ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, "ptm_mailbox_isr", &g_ptm_priv_data);
+#else
     ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, IRQF_DISABLED, "ptm_mailbox_isr", &g_ptm_priv_data);
+#endif
     if ( ret ) {
         if ( ret == -EBUSY ) {
             err("IRQ may be occupied by other driver, please reconfig to disable it.");