diff options
author | Krzysztof Halasa <khc@pm.waw.pl> | 2007-04-27 07:13:33 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:01:07 -0400 |
commit | abf17ffda7b7b6c83a29d7ccea91d46065c6ca3e (patch) | |
tree | 1ef35e54cb8bfc2fbaf9c1b2b821b5ef7f6bd1c5 /drivers/net/wan/hdlc_cisco.c | |
parent | 27345bb684140f5f306963e0d6e25a60c7857dfe (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>
Diffstat (limited to 'drivers/net/wan/hdlc_cisco.c')
-rw-r--r-- | drivers/net/wan/hdlc_cisco.c | 29 |
1 files changed, 15 insertions, 14 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 @@ | |||
37 | struct hdlc_header { | 37 | struct 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 | ||
44 | struct cisco_packet { | 44 | struct 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 | ||
99 | static void cisco_keepalive_send(struct net_device *dev, u32 type, | 99 | static 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; |