EXPORT_SYMBOL(can_set_bittiming);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-static struct net_device_stats *can_get_stats(struct net_device *dev)
+struct net_device_stats *can_get_stats(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
return &priv->net_stats;
}
+EXPORT_SYMBOL(can_get_stats);
#endif
static void can_setup(struct net_device *dev)
/* New-style flags. */
dev->flags = IFF_NOARP;
dev->features = NETIF_F_NO_CSUM;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
- dev->get_stats = can_get_stats;
-#endif
}
/*
{
struct can_priv *priv = netdev_priv(dev);
#ifdef FIXME
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
#endif
int i;
int can_restart_now(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
struct sk_buff *skb;
struct can_frame *cf;
int err;
int quota = min(dev->quota, *budget);
#endif
struct mscan_regs *regs = (struct mscan_regs *)dev->base_addr;
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
int npackets = 0;
int ret = 1;
struct sk_buff *skb;
struct net_device *dev = (struct net_device *)dev_id;
struct mscan_priv *priv = netdev_priv(dev);
struct mscan_regs *regs = (struct mscan_regs *)dev->base_addr;
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
u8 cantier, cantflg, canrflg;
irqreturn_t ret = IRQ_NONE;
static int can_set_drv_name(void);
int set_reset_mode(struct net_device *dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+static struct net_device_stats *can_get_stats(struct net_device *dev)
+{
+ struct can_priv *priv = netdev_priv(dev);
+
+ /* TODO: read statistics from chip */
+ return &priv->stats;
+}
+#endif
+
static int i82527_probe_chip(unsigned long base)
{
// Check if hardware reset is still inactive OR
*/
static int can_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
struct can_frame *cf = (struct can_frame*)skb->data;
unsigned long base = dev->base_addr;
uint8_t dlc;
static void can_tx_timeout(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
stats->tx_errors++;
*/
static void can_rx(struct net_device *dev, int obj)
{
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
unsigned long base = dev->base_addr;
struct can_frame *cf;
struct sk_buff *skb;
stats->rx_bytes += dlc;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-static struct net_device_stats *can_get_stats(struct net_device *dev)
-{
- struct can_priv *priv = netdev_priv(dev);
-
- /* TODO: read statistics from chip */
- return &priv->stats;
-}
-#endif
-
/*
* I82527 interrupt handler
*/
{
struct net_device *dev = (struct net_device*)dev_id;
struct can_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
unsigned long base = dev->base_addr;
uint8_t irqreg;
uint8_t lastIrqreg;
dev->open = can_open;
dev->stop = can_close;
dev->hard_start_xmit = can_start_xmit;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
- dev->get_stats = can_get_stats;
-#endif
dev->tx_timeout = can_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
static int can_set_drv_name(void);
int set_reset_mode(struct net_device *dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+static struct net_device_stats *can_get_stats(struct net_device *dev)
+{
+ struct can_priv *priv = netdev_priv(dev);
+
+ /* TODO: read statistics from chip */
+ return &priv->stats;
+}
+#endif
+
static int sja1000_probe_chip(unsigned long base)
{
if (base && (hw_readreg(base, 0) == 0xFF)) {
static int can_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
struct can_frame *cf = (struct can_frame*)skb->data;
unsigned long base = dev->base_addr;
uint8_t fi;
static void can_tx_timeout(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
stats->tx_errors++;
static void can_rx(struct net_device *dev)
{
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
unsigned long base = dev->base_addr;
struct can_frame *cf;
struct sk_buff *skb;
stats->rx_bytes += dlc;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-static struct net_device_stats *can_get_stats(struct net_device *dev)
-{
- struct can_priv *priv = netdev_priv(dev);
-
- /* TODO: read statistics from chip */
- return &priv->stats;
-}
-#endif
-
/*
* SJA1000 interrupt handler
*/
{
struct net_device *dev = (struct net_device*)dev_id;
struct can_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
unsigned long base = dev->base_addr;
uint8_t isrc, status, ecc, alc;
int n = 0;
dev->open = can_open;
dev->stop = can_close;
dev->hard_start_xmit = can_start_xmit;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
- dev->get_stats = can_get_stats;
-#endif
dev->tx_timeout = can_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
static int sja1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct sja1000_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
struct can_frame *cf = (struct can_frame *)skb->data;
uint8_t fi;
uint8_t dlc;
static void sja1000_rx(struct net_device *dev)
{
struct sja1000_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
struct can_frame *cf;
struct sk_buff *skb;
uint8_t fi;
uint8_t isrc, uint8_t status, int n)
{
struct sja1000_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
struct can_frame *cf;
struct sk_buff *skb;
enum can_state state = priv->can.state;
{
struct net_device *dev = (struct net_device *)dev_id;
struct sja1000_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = dev->get_stats(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = can_get_stats(dev);
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
uint8_t isrc, status;
int n = 0;
static struct net_device **slcan_devs;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+/* Netdevice get statistics request */
+static struct net_device_stats *slc_get_stats(struct net_device *dev)
+{
+ struct slcan *sl = netdev_priv(dev);
+
+ return &sl->stats;
+}
+#endif
+
/************************************************************************
* SLCAN ENCAPSULATION FORMAT *
************************************************************************/
/* Send one completely decapsulated can_frame to the network layer */
static void slc_bump(struct slcan *sl)
{
- struct net_device_stats *stats = sl->dev->get_stats(sl->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = slc_get_stats(sl->dev);
+#else
+ struct net_device_stats *stats = &sl->dev->stats;
+#endif
struct sk_buff *skb;
struct can_frame cf;
int i, dlc_pos, tmp;
/* parse tty input stream */
static void slcan_unesc(struct slcan *sl, unsigned char s)
{
- struct net_device_stats *stats = sl->dev->get_stats(sl->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = slc_get_stats(sl->dev);
+#else
+ struct net_device_stats *stats = &sl->dev->stats;
+#endif
if ((s == '\r') || (s == '\a')) { /* CR or BEL ends the pdu */
if (!test_and_clear_bit(SLF_ERROR, &sl->flags) &&
/* Encapsulate one can_frame and stuff into a TTY queue. */
static void slc_encaps(struct slcan *sl, struct can_frame *cf)
{
- struct net_device_stats *stats = sl->dev->get_stats(sl->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = slc_get_stats(sl->dev);
+#else
+ struct net_device_stats *stats = &sl->dev->stats;
+#endif
int actual, idx, i;
char cmd;
{
int actual;
struct slcan *sl = (struct slcan *) tty->disc_data;
- struct net_device_stats *stats = sl->dev->get_stats(sl->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = slc_get_stats(sl->dev);
+#else
+ struct net_device_stats *stats = &sl->dev->stats;
+#endif
/* First make sure we're connected. */
if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev))
return 0;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-/* Netdevice get statistics request */
-static struct net_device_stats *slc_get_stats(struct net_device *dev)
-{
- struct slcan *sl = netdev_priv(dev);
-
- return (&sl->stats);
-}
-#endif
-
/* Netdevice register callback */
static void slc_setup(struct net_device *dev)
{
dev->open = slc_open;
dev->destructor = free_netdev;
dev->stop = slc_close;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
- dev->get_stats = slc_get_stats;
-#endif
dev->hard_start_xmit = slc_xmit;
dev->hard_header_len = 0;
const unsigned char *cp, char *fp, int count)
{
struct slcan *sl = (struct slcan *) tty->disc_data;
- struct net_device_stats *stats = sl->dev->get_stats(sl->dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ struct net_device_stats *stats = slc_get_stats(sl->dev);
+#else
+ struct net_device_stats *stats = &sl->dev->stats;
+#endif
if (!sl || sl->magic != SLCAN_MAGIC ||
!netif_running(sl->dev))
if (cmd & CMD_BUS2)
bus = card->bus[1];
- stats = bus->netdev->get_stats(bus->netdev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+ stats = can_get_stats(bus->netdev);
+#else
+ stats = &bus->netdev->stats;
+#endif
if (cmd & CMD_ERR) {
u8 can_state;
u8 state;
#define IFF_ECHO IFF_LOOPBACK
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+struct net_device_stats *can_get_stats(struct net_device *dev);
+#endif
+
struct net_device *alloc_candev(int sizeof_priv);
void free_candev(struct net_device *dev);