#define CPC_HEADER_SIZE 4
#define MAX_RX_URBS 10
-#define MAX_TX_URBS CAN_ECHO_SKB_MAX
+#define MAX_TX_URBS 4
struct ems_usb;
netif_rx(skb);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
dev->netdev->last_rx = jiffies;
+#endif
stats->rx_packets++;
stats->rx_bytes += cf->can_dlc;
}
netif_rx(skb);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
dev->netdev->last_rx = jiffies;
+#endif
stats->rx_packets++;
stats->rx_bytes += cf->can_dlc;
}
return 0;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
static int ems_usb_start_xmit(struct sk_buff *skb, struct net_device *netdev)
+#else
+static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb,
+ struct net_device *netdev)
+#endif
{
struct ems_usb *dev = netdev_priv(netdev);
struct ems_tx_urb_context *context = NULL;
return NETDEV_TX_OK;
}
-static int ems_usb_close(struct net_device *dev)
+static int ems_usb_close(struct net_device *netdev)
{
- struct ems_usb *priv = netdev_priv(dev);
+ struct ems_usb *dev = netdev_priv(netdev);
- netif_stop_queue(dev);
+ netif_stop_queue(netdev);
/* Stop polling */
- unlink_all_urbs(priv);
+ unlink_all_urbs(dev);
/* Set CAN controller to reset mode */
- if (ems_usb_write_mode(priv, SJA1000_MOD_RM))
- dev_warn(ND2D(dev), "couldn't stop device");
+ if (ems_usb_write_mode(dev, SJA1000_MOD_RM))
+ dev_warn(ND2D(netdev), "couldn't stop device");
- close_candev(dev);
+ close_candev(netdev);
- priv->open_time = 0;
+ dev->open_time = 0;
return 0;
}
.brp_inc = 1,
};
-static int ems_usb_set_mode(struct net_device *dev, enum can_mode mode)
+static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode)
{
- struct ems_usb *priv = netdev_priv(dev);
+ struct ems_usb *dev = netdev_priv(netdev);
- if (!priv->open_time)
+ if (!dev->open_time)
return -EINVAL;
switch (mode) {
case CAN_MODE_START:
- if (ems_usb_write_mode(priv, SJA1000_MOD_NORMAL))
- dev_warn(ND2D(dev), "couldn't start device");
+ if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL))
+ dev_warn(ND2D(netdev), "couldn't start device");
- if (netif_queue_stopped(dev))
- netif_wake_queue(dev);
+ if (netif_queue_stopped(netdev))
+ netif_wake_queue(netdev);
break;
default:
struct ems_usb *dev;
int i, err;
- netdev = alloc_candev(sizeof(struct ems_usb));
+ netdev = alloc_candev(sizeof(struct ems_usb), MAX_TX_URBS);
if (!netdev) {
dev_err(ND2D(netdev), "Couldn't alloc candev\n");
return -ENOMEM;