aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2007-04-27 07:13:33 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:07 -0400
commitabf17ffda7b7b6c83a29d7ccea91d46065c6ca3e (patch)
tree1ef35e54cb8bfc2fbaf9c1b2b821b5ef7f6bd1c5
parent27345bb684140f5f306963e0d6e25a60c7857dfe (diff)
Generic HDLC sparse annotations
Sparse annotations, including two minor bugfixes. Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/wan/hdlc_cisco.c29
-rw-r--r--drivers/net/wan/hdlc_fr.c18
-rw-r--r--include/linux/hdlc.h3
3 files changed, 25 insertions, 25 deletions
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 00e0aaadabcc..9ec6cf2e510e 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -37,16 +37,16 @@
37struct hdlc_header { 37struct hdlc_header {
38 u8 address; 38 u8 address;
39 u8 control; 39 u8 control;
40 u16 protocol; 40 __be16 protocol;
41}__attribute__ ((packed)); 41}__attribute__ ((packed));
42 42
43 43
44struct cisco_packet { 44struct cisco_packet {
45 u32 type; /* code */ 45 __be32 type; /* code */
46 u32 par1; 46 __be32 par1;
47 u32 par2; 47 __be32 par2;
48 u16 rel; /* reliability */ 48 __be16 rel; /* reliability */
49 u32 time; 49 __be32 time;
50}__attribute__ ((packed)); 50}__attribute__ ((packed));
51#define CISCO_PACKET_LEN 18 51#define CISCO_PACKET_LEN 18
52#define CISCO_BIG_PACKET_LEN 20 52#define CISCO_BIG_PACKET_LEN 20
@@ -97,7 +97,7 @@ static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev,
97 97
98 98
99static void cisco_keepalive_send(struct net_device *dev, u32 type, 99static void cisco_keepalive_send(struct net_device *dev, u32 type,
100 u32 par1, u32 par2) 100 __be32 par1, __be32 par2)
101{ 101{
102 struct sk_buff *skb; 102 struct sk_buff *skb;
103 struct cisco_packet *data; 103 struct cisco_packet *data;
@@ -115,9 +115,9 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
115 data = (struct cisco_packet*)(skb->data + 4); 115 data = (struct cisco_packet*)(skb->data + 4);
116 116
117 data->type = htonl(type); 117 data->type = htonl(type);
118 data->par1 = htonl(par1); 118 data->par1 = par1;
119 data->par2 = htonl(par2); 119 data->par2 = par2;
120 data->rel = 0xFFFF; 120 data->rel = __constant_htons(0xFFFF);
121 /* we will need do_div here if 1000 % HZ != 0 */ 121 /* we will need do_div here if 1000 % HZ != 0 */
122 data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ)); 122 data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ));
123 123
@@ -193,7 +193,7 @@ static int cisco_rx(struct sk_buff *skb)
193 case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */ 193 case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */
194 in_dev = dev->ip_ptr; 194 in_dev = dev->ip_ptr;
195 addr = 0; 195 addr = 0;
196 mask = ~0; /* is the mask correct? */ 196 mask = __constant_htonl(~0); /* is the mask correct? */
197 197
198 if (in_dev != NULL) { 198 if (in_dev != NULL) {
199 struct in_ifaddr **ifap = &in_dev->ifa_list; 199 struct in_ifaddr **ifap = &in_dev->ifa_list;
@@ -245,7 +245,7 @@ static int cisco_rx(struct sk_buff *skb)
245 } /* switch(protocol) */ 245 } /* switch(protocol) */
246 246
247 printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name, 247 printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name,
248 data->protocol); 248 ntohs(data->protocol));
249 dev_kfree_skb_any(skb); 249 dev_kfree_skb_any(skb);
250 return NET_RX_DROP; 250 return NET_RX_DROP;
251 251
@@ -270,8 +270,9 @@ static void cisco_timer(unsigned long arg)
270 netif_dormant_on(dev); 270 netif_dormant_on(dev);
271 } 271 }
272 272
273 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, ++state(hdlc)->txseq, 273 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ,
274 state(hdlc)->rxseq); 274 htonl(++state(hdlc)->txseq),
275 htonl(state(hdlc)->rxseq));
275 state(hdlc)->request_sent = 1; 276 state(hdlc)->request_sent = 1;
276 state(hdlc)->timer.expires = jiffies + 277 state(hdlc)->timer.expires = jiffies +
277 state(hdlc)->settings.interval * HZ; 278 state(hdlc)->settings.interval * HZ;
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index aeb2789adf26..15b6e07a4382 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -288,31 +288,31 @@ static int fr_hard_header(struct sk_buff **skb_p, u16 dlci)
288 struct sk_buff *skb = *skb_p; 288 struct sk_buff *skb = *skb_p;
289 289
290 switch (skb->protocol) { 290 switch (skb->protocol) {
291 case __constant_ntohs(NLPID_CCITT_ANSI_LMI): 291 case __constant_htons(NLPID_CCITT_ANSI_LMI):
292 head_len = 4; 292 head_len = 4;
293 skb_push(skb, head_len); 293 skb_push(skb, head_len);
294 skb->data[3] = NLPID_CCITT_ANSI_LMI; 294 skb->data[3] = NLPID_CCITT_ANSI_LMI;
295 break; 295 break;
296 296
297 case __constant_ntohs(NLPID_CISCO_LMI): 297 case __constant_htons(NLPID_CISCO_LMI):
298 head_len = 4; 298 head_len = 4;
299 skb_push(skb, head_len); 299 skb_push(skb, head_len);
300 skb->data[3] = NLPID_CISCO_LMI; 300 skb->data[3] = NLPID_CISCO_LMI;
301 break; 301 break;
302 302
303 case __constant_ntohs(ETH_P_IP): 303 case __constant_htons(ETH_P_IP):
304 head_len = 4; 304 head_len = 4;
305 skb_push(skb, head_len); 305 skb_push(skb, head_len);
306 skb->data[3] = NLPID_IP; 306 skb->data[3] = NLPID_IP;
307 break; 307 break;
308 308
309 case __constant_ntohs(ETH_P_IPV6): 309 case __constant_htons(ETH_P_IPV6):
310 head_len = 4; 310 head_len = 4;
311 skb_push(skb, head_len); 311 skb_push(skb, head_len);
312 skb->data[3] = NLPID_IPV6; 312 skb->data[3] = NLPID_IPV6;
313 break; 313 break;
314 314
315 case __constant_ntohs(ETH_P_802_3): 315 case __constant_htons(ETH_P_802_3):
316 head_len = 10; 316 head_len = 10;
317 if (skb_headroom(skb) < head_len) { 317 if (skb_headroom(skb) < head_len) {
318 struct sk_buff *skb2 = skb_realloc_headroom(skb, 318 struct sk_buff *skb2 = skb_realloc_headroom(skb,
@@ -340,7 +340,7 @@ static int fr_hard_header(struct sk_buff **skb_p, u16 dlci)
340 skb->data[5] = FR_PAD; 340 skb->data[5] = FR_PAD;
341 skb->data[6] = FR_PAD; 341 skb->data[6] = FR_PAD;
342 skb->data[7] = FR_PAD; 342 skb->data[7] = FR_PAD;
343 *(u16*)(skb->data + 8) = skb->protocol; 343 *(__be16*)(skb->data + 8) = skb->protocol;
344 } 344 }
345 345
346 dlci_to_q922(skb->data, dlci); 346 dlci_to_q922(skb->data, dlci);
@@ -974,8 +974,8 @@ static int fr_rx(struct sk_buff *skb)
974 974
975 } else if (skb->len > 10 && data[3] == FR_PAD && 975 } else if (skb->len > 10 && data[3] == FR_PAD &&
976 data[4] == NLPID_SNAP && data[5] == FR_PAD) { 976 data[4] == NLPID_SNAP && data[5] == FR_PAD) {
977 u16 oui = ntohs(*(u16*)(data + 6)); 977 u16 oui = ntohs(*(__be16*)(data + 6));
978 u16 pid = ntohs(*(u16*)(data + 8)); 978 u16 pid = ntohs(*(__be16*)(data + 8));
979 skb_pull(skb, 10); 979 skb_pull(skb, 10);
980 980
981 switch ((((u32)oui) << 16) | pid) { 981 switch ((((u32)oui) << 16) | pid) {
@@ -1127,7 +1127,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1127 memcpy(dev->dev_addr, "\x00\x01", 2); 1127 memcpy(dev->dev_addr, "\x00\x01", 2);
1128 get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2); 1128 get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2);
1129 } else { 1129 } else {
1130 *(u16*)dev->dev_addr = htons(dlci); 1130 *(__be16*)dev->dev_addr = htons(dlci);
1131 dlci_to_q922(dev->broadcast, dlci); 1131 dlci_to_q922(dev->broadcast, dlci);
1132 } 1132 }
1133 dev->hard_start_xmit = pvc_xmit; 1133 dev->hard_start_xmit = pvc_xmit;
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 0fe562af9c8c..db390c511ada 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,8 +43,7 @@ struct hdlc_proto {
43 void (*stop)(struct net_device *dev); /* if open & !DCD */ 43 void (*stop)(struct net_device *dev); /* if open & !DCD */
44 void (*detach)(struct net_device *dev); 44 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 unsigned short (*type_trans)(struct sk_buff *skb, 46 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
47 struct net_device *dev);
48 struct module *module; 47 struct module *module;
49 struct hdlc_proto *next; /* next protocol in the list */ 48 struct hdlc_proto *next; /* next protocol in the list */
50}; 49};