]> rtime.felk.cvut.cz Git - linux-lin.git/blobdiff - sllin/sllin.c
sllin: Fixed some issues reported by checkpatch.pl
[linux-lin.git] / sllin / sllin.c
index 601979a2213232c5beae2081126b2ef17ca3b591..58e59e4a5d04e04556158af25891b64851579b49 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
-#include <asm/system.h>
 #include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/string.h>
@@ -80,7 +79,7 @@ MODULE_AUTHOR("Pavel Pisa <pisa@cmp.felk.cvut.cz>");
 #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);
@@ -320,8 +319,7 @@ static void sllin_write_wakeup(struct tty_struct *tty)
        } 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;
        }
@@ -349,11 +347,11 @@ static netdev_tx_t sll_xmit(struct sk_buff *skb, struct net_device *dev)
 
        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;
        }
 
@@ -445,7 +443,7 @@ static void sll_setup(struct net_device *dev)
 
        /* New-style flags. */
        dev->flags              = IFF_NOARP;
-       dev->features           = NETIF_F_NO_CSUM;
+       dev->features           = NETIF_F_HW_CSUM; /* NETIF_F_NO_CSUM;*/
 }
 
 /******************************************
@@ -550,7 +548,7 @@ static void sllin_slave_receive_buf(struct tty_struct *tty,
 
                        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 {
@@ -641,12 +639,12 @@ static int sllin_configure_frame_cache(struct sllin *sl, struct can_frame *cf)
        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);
 
@@ -715,8 +713,9 @@ int sllin_setup_msg(struct sllin *sl, int mode, int id,
        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;
@@ -1003,7 +1002,7 @@ int sllin_kwthread(void *ptr)
                                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");
@@ -1134,8 +1133,7 @@ slstate_response_wait:
                                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 */
                        }
 
@@ -1431,14 +1429,14 @@ static int __init sllin_init(void)
 
        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);
        }
 
@@ -1494,7 +1492,7 @@ static void __exit sllin_exit(void)
 
                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;
@@ -1508,7 +1506,7 @@ static void __exit sllin_exit(void)
 
        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);