Commit a5cbe2b0 authored by Juan David González Cobas's avatar Juan David González Cobas

Merge branch 'updates-4.15'

parents e459ef1b ed527040
...@@ -222,7 +222,11 @@ static int spec_probe(struct pci_dev *pdev, ...@@ -222,7 +222,11 @@ static int spec_probe(struct pci_dev *pdev,
#if KERNEL_VERSION(3, 16, 0) > LINUX_VERSION_CODE #if KERNEL_VERSION(3, 16, 0) > LINUX_VERSION_CODE
ret = pci_enable_msi_block(pdev, 1); ret = pci_enable_msi_block(pdev, 1);
#else #else
#if KERNEL_VERSION(4,11,0) > LINUX_VERSION_CODE
ret = pci_enable_msi_exact(pdev, 1); ret = pci_enable_msi_exact(pdev, 1);
#else
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_LEGACY);
#endif
#endif #endif
if (ret < 0) if (ret < 0)
dev_err(&pdev->dev, "%s: enable msi block: error %i\n", dev_err(&pdev->dev, "%s: enable msi block: error %i\n",
...@@ -280,7 +284,11 @@ out_unmap: ...@@ -280,7 +284,11 @@ out_unmap:
} }
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
if (spec_use_msi) if (spec_use_msi)
#if KERNEL_VERSION(4,11,0) > LINUX_VERSION_CODE
pci_disable_msi(pdev); pci_disable_msi(pdev);
#else
pci_free_irq_vectors(pdev);
#endif
pci_disable_device(pdev); pci_disable_device(pdev);
kfree(spec); kfree(spec);
return ret; return ret;
...@@ -303,7 +311,11 @@ static void spec_remove(struct pci_dev *pdev) ...@@ -303,7 +311,11 @@ static void spec_remove(struct pci_dev *pdev)
} }
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(spec); kfree(spec);
#if KERNEL_VERSION(4,11,0) > LINUX_VERSION_CODE
//pci_disable_msi(pdev); //pci_disable_msi(pdev);
#else
pci_free_irq_vectors(pdev);
#endif
pci_disable_device(pdev); pci_disable_device(pdev);
} }
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
* by CERN, the European Institute for Nuclear Research. * by CERN, the European Institute for Nuclear Research.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#if KERNEL_VERSION(4,11,0) > LINUX_VERSION_CODE
#include <linux/sched.h> #include <linux/sched.h>
#else
#include <linux/sched/signal.h>
#endif
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/atomic.h> #include <linux/atomic.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -129,10 +130,17 @@ static void wrn_update_link_status(struct net_device *dev) ...@@ -129,10 +130,17 @@ static void wrn_update_link_status(struct net_device *dev)
} }
/* Actual timer function. Takes the lock and calls above function */ /* Actual timer function. Takes the lock and calls above function */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void wrn_ep_check_link(unsigned long dev_id) static void wrn_ep_check_link(unsigned long dev_id)
{ {
struct net_device *dev = (struct net_device *) dev_id; struct net_device *dev = (struct net_device *) dev_id;
struct wrn_ep *ep = netdev_priv(dev); struct wrn_ep *ep = netdev_priv(dev);
#else
static void wrn_ep_check_link(struct timer_list *t)
{
struct wrn_ep *ep = from_timer(ep, t, ep_link_timer);
struct net_device *dev = ep->mii.dev;
#endif
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ep->lock, flags); spin_lock_irqsave(&ep->lock, flags);
...@@ -146,7 +154,9 @@ static void wrn_ep_check_link(unsigned long dev_id) ...@@ -146,7 +154,9 @@ static void wrn_ep_check_link(unsigned long dev_id)
int wrn_ep_open(struct net_device *dev) int wrn_ep_open(struct net_device *dev)
{ {
struct wrn_ep *ep = netdev_priv(dev); struct wrn_ep *ep = netdev_priv(dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
unsigned long timerarg = (unsigned long)dev; unsigned long timerarg = (unsigned long)dev;
#endif
if (1) { if (1) {
netif_carrier_on(dev); netif_carrier_on(dev);
...@@ -177,7 +187,11 @@ int wrn_ep_open(struct net_device *dev) ...@@ -177,7 +187,11 @@ int wrn_ep_open(struct net_device *dev)
wrn_phy_write(dev, 0, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); wrn_phy_write(dev, 0, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART);
/* Prepare the timer for link-up notifications */ /* Prepare the timer for link-up notifications */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
setup_timer(&ep->ep_link_timer, wrn_ep_check_link, timerarg); setup_timer(&ep->ep_link_timer, wrn_ep_check_link, timerarg);
#else
timer_setup(&ep->ep_link_timer, wrn_ep_check_link, 0);
#endif
if (0) { if (0) {
/* not on spec */ /* not on spec */
mod_timer(&ep->ep_link_timer, jiffies + WRN_LINK_POLL_INTERVAL); mod_timer(&ep->ep_link_timer, jiffies + WRN_LINK_POLL_INTERVAL);
......
...@@ -425,7 +425,9 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc) ...@@ -425,7 +425,9 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
#if KERNEL_VERSION(4,11,0) > LINUX_VERSION_CODE
dev->last_rx = jiffies; dev->last_rx = jiffies;
#endif
ep->stats.rx_packets++; ep->stats.rx_packets++;
ep->stats.rx_bytes += len; ep->stats.rx_bytes += len;
netif_receive_skb(skb); netif_receive_skb(skb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment