#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <asm/system.h>
#include <linux/uaccess.h>
#include <linux/bitops.h>
#include <linux/string.h>
#define SLLIN_MAGIC 0x53CA
/* #define BREAK_BY_BAUD */
-static int master = true;
+static bool master = true;
static int baudrate; /* Use LIN_DEFAULT_BAUDRATE when not set */
module_param(master, bool, 0);
} while (unlikely(test_bit(SLF_TXBUFF_RQ, &sl->flags)));
if ((remains > 0) && (actual >= 0)) {
- pr_debug("sllin: sllin_write_wakeup sent %d, "
- "remains %d, waiting\n",
+ pr_debug("sllin: sllin_write_wakeup sent %d, remains %d, waiting\n",
sl->tx_cnt, sl->tx_lim - sl->tx_cnt);
return;
}
spin_lock(&sl->lock);
if (!netif_running(dev)) {
- printk(KERN_WARNING "%s: xmit: iface is down\n", dev->name);
+ pr_warn("%s: xmit: iface is down\n", dev->name);
goto err_out_unlock;
}
if (sl->tty == NULL) {
- printk(KERN_WARNING "%s: xmit: no tty device connected\n", dev->name);
+ pr_warn("%s: xmit: no tty device connected\n", dev->name);
goto err_out_unlock;
}
/* New-style flags. */
dev->flags = IFF_NOARP;
- dev->features = NETIF_F_NO_CSUM;
+ dev->features = NETIF_F_HW_CSUM; /* NETIF_F_NO_CSUM;*/
}
/******************************************
spin_lock_irqsave(&sl->linfr_lock, flags);
/* Is the length of data set in frame cache? */
- if (sce->frame_fl & LIN_LOC_SLAVE_CACHE) {
+ if (sce->frame_fl & LIN_CACHE_RESPONSE) {
sl->rx_expect += sce->dlc;
sl->rx_len_unknown = false;
} else {
unsigned long flags;
struct sllin_conf_entry *sce;
- if (!(cf->can_id & LIN_ID_CONF))
+ if (!(cf->can_id & LIN_CTRL_FRAME))
return -1;
sce = &sl->linfr_cache[cf->can_id & LIN_ID_MASK];
- pr_debug("sllin: Setting frame cache with EFF CAN frame. "
- "LIN ID = %d\n", cf->can_id & LIN_ID_MASK);
+ pr_debug("sllin: Setting frame cache with EFF CAN frame. LIN ID = %d\n",
+ cf->can_id & LIN_ID_MASK);
spin_lock_irqsave(&sl->linfr_lock, flags);
if ((data != NULL) && len) {
sl->tx_lim += len;
memcpy(sl->tx_buff + SLLIN_BUFF_DATA, data, len);
- sl->tx_buff[sl->tx_lim++] = sllin_checksum(sl->tx_buff,
+ sl->tx_buff[sl->tx_lim] = sllin_checksum(sl->tx_buff,
sl->tx_lim, mode & SLLIN_STPMSG_CHCKSUM_ENH);
+ sl->tx_lim++;
}
if (len != 0)
sl->rx_lim = SLLIN_BUFF_DATA + len + 1;
spin_lock_irqsave(&sl->linfr_lock, flags);
/* Is there Slave response in linfr_cache to be sent? */
- if ((sce->frame_fl & LIN_LOC_SLAVE_CACHE)
+ if ((sce->frame_fl & LIN_CACHE_RESPONSE)
&& (sce->dlc > 0)) {
pr_debug("sllin: Sending LIN response from linfr_cache\n");
sllin_report_error(sl, LIN_ERR_CHECKSUM);
} else {
/* Send CAN non-RTR frame with data */
- pr_debug("sllin: sending NON-RTR CAN"
- "frame with LIN payload.");
+ pr_debug("sllin: sending NON-RTR CAN frame with LIN payload.");
sll_bump(sl); /* send packet to the network layer */
}
sllin_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL);
if (!sllin_devs) {
- printk(KERN_ERR "sllin: can't allocate sllin device array!\n");
+ pr_err("sllin: can't allocate sllin device array!\n");
return -ENOMEM;
}
/* Fill in our line protocol discipline, and register it */
status = tty_register_ldisc(N_SLLIN, &sll_ldisc);
if (status) {
- printk(KERN_ERR "sllin: can't register line discipline\n");
+ pr_err("sllin: can't register line discipline\n");
kfree(sllin_devs);
}
sl = netdev_priv(dev);
if (sl->tty) {
- printk(KERN_ERR "%s: tty discipline still running\n",
+ pr_err("%s: tty discipline still running\n",
dev->name);
/* Intentionally leak the control block. */
dev->destructor = NULL;
i = tty_unregister_ldisc(N_SLLIN);
if (i)
- printk(KERN_ERR "sllin: can't unregister ldisc (err %d)\n", i);
+ pr_err("sllin: can't unregister ldisc (err %d)\n", i);
}
module_init(sllin_init);