arcnet: Expand odd BUGLVL macro with if and uses
[cascardo/linux.git] / drivers / net / arcnet / rfc1051.c
index f81db40..824d71f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Linux ARCnet driver - RFC1051 ("simple" standard) packet encapsulation
- * 
+ *
  * Written 1994-1999 by Avery Pennarun.
  * Derived from skeleton.c by Donald Becker.
  *
@@ -34,7 +34,6 @@
 
 #define VERSION "arcnet: RFC1051 \"simple standard\" (`s') encapsulation support loaded.\n"
 
-
 static __be16 type_trans(struct sk_buff *skb, struct net_device *dev);
 static void rx(struct net_device *dev, int bufnum,
               struct archdr *pkthdr, int length);
@@ -43,9 +42,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
                      int bufnum);
 
-
-static struct ArcProto rfc1051_proto =
-{
+static struct ArcProto rfc1051_proto = {
        .suffix         = 's',
        .mtu            = XMTU - RFC1051_HDR_SIZE,
        .is_ip          = 1,
@@ -56,7 +53,6 @@ static struct ArcProto rfc1051_proto =
        .ack_tx         = NULL
 };
 
-
 static int __init arcnet_rfc1051_init(void)
 {
        printk(VERSION);
@@ -82,14 +78,13 @@ module_exit(arcnet_rfc1051_exit);
 
 MODULE_LICENSE("GPL");
 
-/*
- * Determine a packet's protocol ID.
- * 
+/* Determine a packet's protocol ID.
+ *
  * With ARCnet we have to convert everything to Ethernet-style stuff.
  */
 static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
 {
-       struct archdr *pkt = (struct archdr *) skb->data;
+       struct archdr *pkt = (struct archdr *)skb->data;
        struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
        int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
 
@@ -97,9 +92,9 @@ static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
        skb_reset_mac_header(skb);
        skb_pull(skb, hdr_size);
 
-       if (pkt->hard.dest == 0)
+       if (pkt->hard.dest == 0) {
                skb->pkt_type = PACKET_BROADCAST;
-       else if (dev->flags & IFF_PROMISC) {
+       else if (dev->flags & IFF_PROMISC) {
                /* if we're not sending to ourselves :) */
                if (pkt->hard.dest != dev->dev_addr[0])
                        skb->pkt_type = PACKET_OTHERHOST;
@@ -120,7 +115,6 @@ static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
        return htons(ETH_P_IP);
 }
 
-
 /* packet receiver */
 static void rx(struct net_device *dev, int bufnum,
               struct archdr *pkthdr, int length)
@@ -146,7 +140,7 @@ static void rx(struct net_device *dev, int bufnum,
        skb_put(skb, length + ARC_HDR_SIZE);
        skb->dev = dev;
 
-       pkt = (struct archdr *) skb->data;
+       pkt = (struct archdr *)skb->data;
 
        /* up to sizeof(pkt->soft) has already been copied from the card */
        memcpy(pkt, pkthdr, sizeof(struct archdr));
@@ -155,21 +149,19 @@ static void rx(struct net_device *dev, int bufnum,
                                      pkt->soft.raw + sizeof(pkt->soft),
                                      length - sizeof(pkt->soft));
 
-       BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
+       if (BUGLVL(D_SKB))
+               arcnet_dump_skb(dev, skb, "rx");
 
        skb->protocol = type_trans(skb, dev);
        netif_rx(skb);
 }
 
-
-/*
- * Create the ARCnet hard/soft headers for RFC1051.
- */
+/* Create the ARCnet hard/soft headers for RFC1051 */
 static int build_header(struct sk_buff *skb, struct net_device *dev,
                        unsigned short type, uint8_t daddr)
 {
        int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
-       struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
+       struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
        struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
 
        /* set the protocol ID according to RFC1051 */
@@ -188,22 +180,19 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
                return 0;
        }
 
-
-       /*
-        * Set the source hardware address.
+       /* Set the source hardware address.
         *
         * This is pretty pointless for most purposes, but it can help in
-        * debugging.  ARCnet does not allow us to change the source address in
-        * the actual packet sent)
+        * debugging.  ARCnet does not allow us to change the source address
+        * in the actual packet sent.
         */
        pkt->hard.source = *dev->dev_addr;
 
        /* see linux/net/ethernet/eth.c to see where I got the following */
 
        if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
-               /* 
-                * FIXME: fill in the last byte of the dest ipaddr here to better
-                * comply with RFC1051 in "noarp" mode.
+               /* FIXME: fill in the last byte of the dest ipaddr here to
+                * better comply with RFC1051 in "noarp" mode.
                 */
                pkt->hard.dest = 0;
                return hdr_size;
@@ -214,7 +203,6 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
        return hdr_size;        /* success */
 }
 
-
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
                      int bufnum)
 {
@@ -239,8 +227,9 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
        } else if (length > MTU) {
                hard->offset[0] = 0;
                hard->offset[1] = ofs = 512 - length - 3;
-       } else
+       } else {
                hard->offset[0] = ofs = 256 - length;
+       }
 
        lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
        lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft, length);