Sparse annotations, including two minor bugfixes.
Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
 struct hdlc_header {
        u8 address;
        u8 control;
-       u16 protocol;
+       __be16 protocol;
 }__attribute__ ((packed));
 
 
 struct cisco_packet {
-       u32 type;               /* code */
-       u32 par1;
-       u32 par2;
-       u16 rel;                /* reliability */
-       u32 time;
+       __be32 type;            /* code */
+       __be32 par1;
+       __be32 par2;
+       __be16 rel;             /* reliability */
+       __be32 time;
 }__attribute__ ((packed));
 #define        CISCO_PACKET_LEN        18
 #define        CISCO_BIG_PACKET_LEN    20
 
 
 static void cisco_keepalive_send(struct net_device *dev, u32 type,
-                                u32 par1, u32 par2)
+                                __be32 par1, __be32 par2)
 {
        struct sk_buff *skb;
        struct cisco_packet *data;
        data = (struct cisco_packet*)(skb->data + 4);
 
        data->type = htonl(type);
-       data->par1 = htonl(par1);
-       data->par2 = htonl(par2);
-       data->rel = 0xFFFF;
+       data->par1 = par1;
+       data->par2 = par2;
+       data->rel = __constant_htons(0xFFFF);
        /* we will need do_div here if 1000 % HZ != 0 */
        data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ));
 
                case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */
                        in_dev = dev->ip_ptr;
                        addr = 0;
-                       mask = ~0; /* is the mask correct? */
+                       mask = __constant_htonl(~0); /* is the mask correct? */
 
                        if (in_dev != NULL) {
                                struct in_ifaddr **ifap = &in_dev->ifa_list;
        } /* switch(protocol) */
 
        printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name,
-              data->protocol);
+              ntohs(data->protocol));
        dev_kfree_skb_any(skb);
        return NET_RX_DROP;
 
                netif_dormant_on(dev);
        }
 
-       cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, ++state(hdlc)->txseq,
-                            state(hdlc)->rxseq);
+       cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ,
+                            htonl(++state(hdlc)->txseq),
+                            htonl(state(hdlc)->rxseq));
        state(hdlc)->request_sent = 1;
        state(hdlc)->timer.expires = jiffies +
                state(hdlc)->settings.interval * HZ;
 
        struct sk_buff *skb = *skb_p;
 
        switch (skb->protocol) {
-       case __constant_ntohs(NLPID_CCITT_ANSI_LMI):
+       case __constant_htons(NLPID_CCITT_ANSI_LMI):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_CCITT_ANSI_LMI;
                break;
 
-       case __constant_ntohs(NLPID_CISCO_LMI):
+       case __constant_htons(NLPID_CISCO_LMI):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_CISCO_LMI;
                break;
 
-       case __constant_ntohs(ETH_P_IP):
+       case __constant_htons(ETH_P_IP):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_IP;
                break;
 
-       case __constant_ntohs(ETH_P_IPV6):
+       case __constant_htons(ETH_P_IPV6):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_IPV6;
                break;
 
-       case __constant_ntohs(ETH_P_802_3):
+       case __constant_htons(ETH_P_802_3):
                head_len = 10;
                if (skb_headroom(skb) < head_len) {
                        struct sk_buff *skb2 = skb_realloc_headroom(skb,
                skb->data[5] = FR_PAD;
                skb->data[6] = FR_PAD;
                skb->data[7] = FR_PAD;
-               *(u16*)(skb->data + 8) = skb->protocol;
+               *(__be16*)(skb->data + 8) = skb->protocol;
        }
 
        dlci_to_q922(skb->data, dlci);
 
        } else if (skb->len > 10 && data[3] == FR_PAD &&
                   data[4] == NLPID_SNAP && data[5] == FR_PAD) {
-               u16 oui = ntohs(*(u16*)(data + 6));
-               u16 pid = ntohs(*(u16*)(data + 8));
+               u16 oui = ntohs(*(__be16*)(data + 6));
+               u16 pid = ntohs(*(__be16*)(data + 8));
                skb_pull(skb, 10);
 
                switch ((((u32)oui) << 16) | pid) {
                memcpy(dev->dev_addr, "\x00\x01", 2);
                 get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2);
        } else {
-               *(u16*)dev->dev_addr = htons(dlci);
+               *(__be16*)dev->dev_addr = htons(dlci);
                dlci_to_q922(dev->broadcast, dlci);
        }
        dev->hard_start_xmit = pvc_xmit;
 
        void (*stop)(struct net_device *dev); /* if open & !DCD */
        void (*detach)(struct net_device *dev);
        int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
-       unsigned short (*type_trans)(struct sk_buff *skb,
-                                    struct net_device *dev);
+       __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
        struct module *module;
        struct hdlc_proto *next; /* next protocol in the list */
 };