diff options
author | Varka Bhadram <varkabhadram@gmail.com> | 2014-07-01 23:31:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-07 23:55:22 -0400 |
commit | 4710d806fcb825156e0a7b3a81104915c5e90f5d (patch) | |
tree | a34530ce364e0a6db136f3509141922e7172993f /net | |
parent | 46c9521fc245d91ff5b14cf246f28cee3f99a670 (diff) |
6lowpan: mac802154: fix coding style issues
This patch fixed the coding style issues reported by checkpatch.pl
following issues fixed:
CHECK: Alignment should match open parenthesis
WARNING: line over 80 characters
CHECK: Blank lines aren't necessary before a close brace '}'
WARNING: networking block comments don't use an empty /* line, use /* Comment...
WARNING: Missing a blank line after declarations
WARNING: networking block comments start with * on subsequent lines
CHECK: braces {} should be used on all arms of this statement
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Tested-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ieee802154/6lowpan_iphc.c | 113 | ||||
-rw-r--r-- | net/ieee802154/6lowpan_rtnl.c | 16 | ||||
-rw-r--r-- | net/ieee802154/af_ieee802154.c | 26 | ||||
-rw-r--r-- | net/ieee802154/dgram.c | 28 | ||||
-rw-r--r-- | net/ieee802154/ieee802154.h | 2 | ||||
-rw-r--r-- | net/ieee802154/netlink.c | 4 | ||||
-rw-r--r-- | net/ieee802154/nl-mac.c | 48 | ||||
-rw-r--r-- | net/ieee802154/nl-phy.c | 23 | ||||
-rw-r--r-- | net/ieee802154/raw.c | 14 | ||||
-rw-r--r-- | net/ieee802154/reassembly.c | 1 | ||||
-rw-r--r-- | net/ieee802154/wpan-class.c | 10 | ||||
-rw-r--r-- | net/mac802154/ieee802154_dev.c | 4 | ||||
-rw-r--r-- | net/mac802154/llsec.c | 1 | ||||
-rw-r--r-- | net/mac802154/mib.c | 7 | ||||
-rw-r--r-- | net/mac802154/tx.c | 1 |
15 files changed, 153 insertions, 145 deletions
diff --git a/net/ieee802154/6lowpan_iphc.c b/net/ieee802154/6lowpan_iphc.c index 211b5686d719..511ddeee7353 100644 --- a/net/ieee802154/6lowpan_iphc.c +++ b/net/ieee802154/6lowpan_iphc.c | |||
@@ -3,8 +3,7 @@ | |||
3 | * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com> | 3 | * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* | 6 | /* Based on patches from Jon Smirl <jonsmirl@gmail.com> |
7 | * Based on patches from Jon Smirl <jonsmirl@gmail.com> | ||
8 | * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com> | 7 | * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com> |
9 | * | 8 | * |
10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
@@ -58,16 +57,15 @@ | |||
58 | #include <net/ipv6.h> | 57 | #include <net/ipv6.h> |
59 | #include <net/af_ieee802154.h> | 58 | #include <net/af_ieee802154.h> |
60 | 59 | ||
61 | /* | 60 | /* Uncompress address function for source and |
62 | * Uncompress address function for source and | ||
63 | * destination address(non-multicast). | 61 | * destination address(non-multicast). |
64 | * | 62 | * |
65 | * address_mode is sam value or dam value. | 63 | * address_mode is sam value or dam value. |
66 | */ | 64 | */ |
67 | static int uncompress_addr(struct sk_buff *skb, | 65 | static int uncompress_addr(struct sk_buff *skb, |
68 | struct in6_addr *ipaddr, const u8 address_mode, | 66 | struct in6_addr *ipaddr, const u8 address_mode, |
69 | const u8 *lladdr, const u8 addr_type, | 67 | const u8 *lladdr, const u8 addr_type, |
70 | const u8 addr_len) | 68 | const u8 addr_len) |
71 | { | 69 | { |
72 | bool fail; | 70 | bool fail; |
73 | 71 | ||
@@ -140,13 +138,12 @@ static int uncompress_addr(struct sk_buff *skb, | |||
140 | return 0; | 138 | return 0; |
141 | } | 139 | } |
142 | 140 | ||
143 | /* | 141 | /* Uncompress address function for source context |
144 | * Uncompress address function for source context | ||
145 | * based address(non-multicast). | 142 | * based address(non-multicast). |
146 | */ | 143 | */ |
147 | static int uncompress_context_based_src_addr(struct sk_buff *skb, | 144 | static int uncompress_context_based_src_addr(struct sk_buff *skb, |
148 | struct in6_addr *ipaddr, | 145 | struct in6_addr *ipaddr, |
149 | const u8 sam) | 146 | const u8 sam) |
150 | { | 147 | { |
151 | switch (sam) { | 148 | switch (sam) { |
152 | case LOWPAN_IPHC_ADDR_00: | 149 | case LOWPAN_IPHC_ADDR_00: |
@@ -175,13 +172,13 @@ static int uncompress_context_based_src_addr(struct sk_buff *skb, | |||
175 | } | 172 | } |
176 | 173 | ||
177 | static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr, | 174 | static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr, |
178 | struct net_device *dev, skb_delivery_cb deliver_skb) | 175 | struct net_device *dev, skb_delivery_cb deliver_skb) |
179 | { | 176 | { |
180 | struct sk_buff *new; | 177 | struct sk_buff *new; |
181 | int stat; | 178 | int stat; |
182 | 179 | ||
183 | new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb), | 180 | new = skb_copy_expand(skb, sizeof(struct ipv6hdr), |
184 | GFP_ATOMIC); | 181 | skb_tailroom(skb), GFP_ATOMIC); |
185 | kfree_skb(skb); | 182 | kfree_skb(skb); |
186 | 183 | ||
187 | if (!new) | 184 | if (!new) |
@@ -196,7 +193,7 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr, | |||
196 | new->dev = dev; | 193 | new->dev = dev; |
197 | 194 | ||
198 | raw_dump_table(__func__, "raw skb data dump before receiving", | 195 | raw_dump_table(__func__, "raw skb data dump before receiving", |
199 | new->data, new->len); | 196 | new->data, new->len); |
200 | 197 | ||
201 | stat = deliver_skb(new, dev); | 198 | stat = deliver_skb(new, dev); |
202 | 199 | ||
@@ -210,8 +207,8 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr, | |||
210 | */ | 207 | */ |
211 | static int | 208 | static int |
212 | lowpan_uncompress_multicast_daddr(struct sk_buff *skb, | 209 | lowpan_uncompress_multicast_daddr(struct sk_buff *skb, |
213 | struct in6_addr *ipaddr, | 210 | struct in6_addr *ipaddr, |
214 | const u8 dam) | 211 | const u8 dam) |
215 | { | 212 | { |
216 | bool fail; | 213 | bool fail; |
217 | 214 | ||
@@ -314,8 +311,7 @@ uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) | |||
314 | fail |= lowpan_fetch_skb(skb, &uh->check, 2); | 311 | fail |= lowpan_fetch_skb(skb, &uh->check, 2); |
315 | } | 312 | } |
316 | 313 | ||
317 | /* | 314 | /* UDP lenght needs to be infered from the lower layers |
318 | * UDP lenght needs to be infered from the lower layers | ||
319 | * here, we obtain the hint from the remaining size of the | 315 | * here, we obtain the hint from the remaining size of the |
320 | * frame | 316 | * frame |
321 | */ | 317 | */ |
@@ -338,16 +334,17 @@ err: | |||
338 | static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 }; | 334 | static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 }; |
339 | 335 | ||
340 | int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | 336 | int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, |
341 | const u8 *saddr, const u8 saddr_type, const u8 saddr_len, | 337 | const u8 *saddr, const u8 saddr_type, |
342 | const u8 *daddr, const u8 daddr_type, const u8 daddr_len, | 338 | const u8 saddr_len, const u8 *daddr, |
343 | u8 iphc0, u8 iphc1, skb_delivery_cb deliver_skb) | 339 | const u8 daddr_type, const u8 daddr_len, |
340 | u8 iphc0, u8 iphc1, skb_delivery_cb deliver_skb) | ||
344 | { | 341 | { |
345 | struct ipv6hdr hdr = {}; | 342 | struct ipv6hdr hdr = {}; |
346 | u8 tmp, num_context = 0; | 343 | u8 tmp, num_context = 0; |
347 | int err; | 344 | int err; |
348 | 345 | ||
349 | raw_dump_table(__func__, "raw skb data dump uncompressed", | 346 | raw_dump_table(__func__, "raw skb data dump uncompressed", |
350 | skb->data, skb->len); | 347 | skb->data, skb->len); |
351 | 348 | ||
352 | /* another if the CID flag is set */ | 349 | /* another if the CID flag is set */ |
353 | if (iphc1 & LOWPAN_IPHC_CID) { | 350 | if (iphc1 & LOWPAN_IPHC_CID) { |
@@ -360,8 +357,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
360 | 357 | ||
361 | /* Traffic Class and Flow Label */ | 358 | /* Traffic Class and Flow Label */ |
362 | switch ((iphc0 & LOWPAN_IPHC_TF) >> 3) { | 359 | switch ((iphc0 & LOWPAN_IPHC_TF) >> 3) { |
363 | /* | 360 | /* Traffic Class and FLow Label carried in-line |
364 | * Traffic Class and FLow Label carried in-line | ||
365 | * ECN + DSCP + 4-bit Pad + Flow Label (4 bytes) | 361 | * ECN + DSCP + 4-bit Pad + Flow Label (4 bytes) |
366 | */ | 362 | */ |
367 | case 0: /* 00b */ | 363 | case 0: /* 00b */ |
@@ -374,8 +370,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
374 | hdr.flow_lbl[0] = ((tmp >> 2) & 0x30) | (tmp << 6) | | 370 | hdr.flow_lbl[0] = ((tmp >> 2) & 0x30) | (tmp << 6) | |
375 | (hdr.flow_lbl[0] & 0x0f); | 371 | (hdr.flow_lbl[0] & 0x0f); |
376 | break; | 372 | break; |
377 | /* | 373 | /* Traffic class carried in-line |
378 | * Traffic class carried in-line | ||
379 | * ECN + DSCP (1 byte), Flow Label is elided | 374 | * ECN + DSCP (1 byte), Flow Label is elided |
380 | */ | 375 | */ |
381 | case 2: /* 10b */ | 376 | case 2: /* 10b */ |
@@ -385,8 +380,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
385 | hdr.priority = ((tmp >> 2) & 0x0f); | 380 | hdr.priority = ((tmp >> 2) & 0x0f); |
386 | hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30); | 381 | hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30); |
387 | break; | 382 | break; |
388 | /* | 383 | /* Flow Label carried in-line |
389 | * Flow Label carried in-line | ||
390 | * ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided | 384 | * ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided |
391 | */ | 385 | */ |
392 | case 1: /* 01b */ | 386 | case 1: /* 01b */ |
@@ -415,9 +409,9 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
415 | } | 409 | } |
416 | 410 | ||
417 | /* Hop Limit */ | 411 | /* Hop Limit */ |
418 | if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I) | 412 | if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I) { |
419 | hdr.hop_limit = lowpan_ttl_values[iphc0 & 0x03]; | 413 | hdr.hop_limit = lowpan_ttl_values[iphc0 & 0x03]; |
420 | else { | 414 | } else { |
421 | if (lowpan_fetch_skb_u8(skb, &(hdr.hop_limit))) | 415 | if (lowpan_fetch_skb_u8(skb, &(hdr.hop_limit))) |
422 | goto drop; | 416 | goto drop; |
423 | } | 417 | } |
@@ -429,12 +423,12 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
429 | /* Source address context based uncompression */ | 423 | /* Source address context based uncompression */ |
430 | pr_debug("SAC bit is set. Handle context based source address.\n"); | 424 | pr_debug("SAC bit is set. Handle context based source address.\n"); |
431 | err = uncompress_context_based_src_addr( | 425 | err = uncompress_context_based_src_addr( |
432 | skb, &hdr.saddr, tmp); | 426 | skb, &hdr.saddr, tmp); |
433 | } else { | 427 | } else { |
434 | /* Source address uncompression */ | 428 | /* Source address uncompression */ |
435 | pr_debug("source address stateless compression\n"); | 429 | pr_debug("source address stateless compression\n"); |
436 | err = uncompress_addr(skb, &hdr.saddr, tmp, saddr, | 430 | err = uncompress_addr(skb, &hdr.saddr, tmp, saddr, |
437 | saddr_type, saddr_len); | 431 | saddr_type, saddr_len); |
438 | } | 432 | } |
439 | 433 | ||
440 | /* Check on error of previous branch */ | 434 | /* Check on error of previous branch */ |
@@ -457,9 +451,9 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
457 | } | 451 | } |
458 | } else { | 452 | } else { |
459 | err = uncompress_addr(skb, &hdr.daddr, tmp, daddr, | 453 | err = uncompress_addr(skb, &hdr.daddr, tmp, daddr, |
460 | daddr_type, daddr_len); | 454 | daddr_type, daddr_len); |
461 | pr_debug("dest: stateless compression mode %d dest %pI6c\n", | 455 | pr_debug("dest: stateless compression mode %d dest %pI6c\n", |
462 | tmp, &hdr.daddr); | 456 | tmp, &hdr.daddr); |
463 | if (err) | 457 | if (err) |
464 | goto drop; | 458 | goto drop; |
465 | } | 459 | } |
@@ -468,11 +462,11 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
468 | if (iphc0 & LOWPAN_IPHC_NH_C) { | 462 | if (iphc0 & LOWPAN_IPHC_NH_C) { |
469 | struct udphdr uh; | 463 | struct udphdr uh; |
470 | struct sk_buff *new; | 464 | struct sk_buff *new; |
465 | |||
471 | if (uncompress_udp_header(skb, &uh)) | 466 | if (uncompress_udp_header(skb, &uh)) |
472 | goto drop; | 467 | goto drop; |
473 | 468 | ||
474 | /* | 469 | /* replace the compressed UDP head by the uncompressed UDP |
475 | * replace the compressed UDP head by the uncompressed UDP | ||
476 | * header | 470 | * header |
477 | */ | 471 | */ |
478 | new = skb_copy_expand(skb, sizeof(struct udphdr), | 472 | new = skb_copy_expand(skb, sizeof(struct udphdr), |
@@ -489,7 +483,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
489 | skb_copy_to_linear_data(skb, &uh, sizeof(struct udphdr)); | 483 | skb_copy_to_linear_data(skb, &uh, sizeof(struct udphdr)); |
490 | 484 | ||
491 | raw_dump_table(__func__, "raw UDP header dump", | 485 | raw_dump_table(__func__, "raw UDP header dump", |
492 | (u8 *)&uh, sizeof(uh)); | 486 | (u8 *)&uh, sizeof(uh)); |
493 | 487 | ||
494 | hdr.nexthdr = UIP_PROTO_UDP; | 488 | hdr.nexthdr = UIP_PROTO_UDP; |
495 | } | 489 | } |
@@ -504,8 +498,8 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | |||
504 | hdr.version, ntohs(hdr.payload_len), hdr.nexthdr, | 498 | hdr.version, ntohs(hdr.payload_len), hdr.nexthdr, |
505 | hdr.hop_limit, &hdr.daddr); | 499 | hdr.hop_limit, &hdr.daddr); |
506 | 500 | ||
507 | raw_dump_table(__func__, "raw header dump", (u8 *)&hdr, | 501 | raw_dump_table(__func__, "raw header dump", |
508 | sizeof(hdr)); | 502 | (u8 *)&hdr, sizeof(hdr)); |
509 | 503 | ||
510 | return skb_deliver(skb, &hdr, dev, deliver_skb); | 504 | return skb_deliver(skb, &hdr, dev, deliver_skb); |
511 | 505 | ||
@@ -516,8 +510,8 @@ drop: | |||
516 | EXPORT_SYMBOL_GPL(lowpan_process_data); | 510 | EXPORT_SYMBOL_GPL(lowpan_process_data); |
517 | 511 | ||
518 | static u8 lowpan_compress_addr_64(u8 **hc06_ptr, u8 shift, | 512 | static u8 lowpan_compress_addr_64(u8 **hc06_ptr, u8 shift, |
519 | const struct in6_addr *ipaddr, | 513 | const struct in6_addr *ipaddr, |
520 | const unsigned char *lladdr) | 514 | const unsigned char *lladdr) |
521 | { | 515 | { |
522 | u8 val = 0; | 516 | u8 val = 0; |
523 | 517 | ||
@@ -530,14 +524,14 @@ static u8 lowpan_compress_addr_64(u8 **hc06_ptr, u8 shift, | |||
530 | *hc06_ptr += 2; | 524 | *hc06_ptr += 2; |
531 | val = 2; /* 16-bits */ | 525 | val = 2; /* 16-bits */ |
532 | raw_dump_inline(NULL, "Compressed ipv6 addr is (16 bits)", | 526 | raw_dump_inline(NULL, "Compressed ipv6 addr is (16 bits)", |
533 | *hc06_ptr - 2, 2); | 527 | *hc06_ptr - 2, 2); |
534 | } else { | 528 | } else { |
535 | /* do not compress IID => xxxx::IID */ | 529 | /* do not compress IID => xxxx::IID */ |
536 | memcpy(*hc06_ptr, &ipaddr->s6_addr16[4], 8); | 530 | memcpy(*hc06_ptr, &ipaddr->s6_addr16[4], 8); |
537 | *hc06_ptr += 8; | 531 | *hc06_ptr += 8; |
538 | val = 1; /* 64-bits */ | 532 | val = 1; /* 64-bits */ |
539 | raw_dump_inline(NULL, "Compressed ipv6 addr is (64 bits)", | 533 | raw_dump_inline(NULL, "Compressed ipv6 addr is (64 bits)", |
540 | *hc06_ptr - 8, 8); | 534 | *hc06_ptr - 8, 8); |
541 | } | 535 | } |
542 | 536 | ||
543 | return rol8(val, shift); | 537 | return rol8(val, shift); |
@@ -601,8 +595,8 @@ static void compress_udp_header(u8 **hc06_ptr, struct sk_buff *skb) | |||
601 | } | 595 | } |
602 | 596 | ||
603 | int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | 597 | int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, |
604 | unsigned short type, const void *_daddr, | 598 | unsigned short type, const void *_daddr, |
605 | const void *_saddr, unsigned int len) | 599 | const void *_saddr, unsigned int len) |
606 | { | 600 | { |
607 | u8 tmp, iphc0, iphc1, *hc06_ptr; | 601 | u8 tmp, iphc0, iphc1, *hc06_ptr; |
608 | struct ipv6hdr *hdr; | 602 | struct ipv6hdr *hdr; |
@@ -616,14 +610,13 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | |||
616 | 610 | ||
617 | pr_debug("IPv6 header dump:\n\tversion = %d\n\tlength = %d\n" | 611 | pr_debug("IPv6 header dump:\n\tversion = %d\n\tlength = %d\n" |
618 | "\tnexthdr = 0x%02x\n\thop_lim = %d\n\tdest = %pI6c\n", | 612 | "\tnexthdr = 0x%02x\n\thop_lim = %d\n\tdest = %pI6c\n", |
619 | hdr->version, ntohs(hdr->payload_len), hdr->nexthdr, | 613 | hdr->version, ntohs(hdr->payload_len), hdr->nexthdr, |
620 | hdr->hop_limit, &hdr->daddr); | 614 | hdr->hop_limit, &hdr->daddr); |
621 | 615 | ||
622 | raw_dump_table(__func__, "raw skb network header dump", | 616 | raw_dump_table(__func__, "raw skb network header dump", |
623 | skb_network_header(skb), sizeof(struct ipv6hdr)); | 617 | skb_network_header(skb), sizeof(struct ipv6hdr)); |
624 | 618 | ||
625 | /* | 619 | /* As we copy some bit-length fields, in the IPHC encoding bytes, |
626 | * As we copy some bit-length fields, in the IPHC encoding bytes, | ||
627 | * we sometimes use |= | 620 | * we sometimes use |= |
628 | * If the field is 0, and the current bit value in memory is 1, | 621 | * If the field is 0, and the current bit value in memory is 1, |
629 | * this does not work. We therefore reset the IPHC encoding here | 622 | * this does not work. We therefore reset the IPHC encoding here |
@@ -639,11 +632,10 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | |||
639 | (unsigned char *)_daddr, IEEE802154_ADDR_LEN); | 632 | (unsigned char *)_daddr, IEEE802154_ADDR_LEN); |
640 | 633 | ||
641 | raw_dump_table(__func__, | 634 | raw_dump_table(__func__, |
642 | "sending raw skb network uncompressed packet", | 635 | "sending raw skb network uncompressed packet", |
643 | skb->data, skb->len); | 636 | skb->data, skb->len); |
644 | 637 | ||
645 | /* | 638 | /* Traffic class, flow label |
646 | * Traffic class, flow label | ||
647 | * If flow label is 0, compress it. If traffic class is 0, compress it | 639 | * If flow label is 0, compress it. If traffic class is 0, compress it |
648 | * We have to process both in the same time as the offset of traffic | 640 | * We have to process both in the same time as the offset of traffic |
649 | * class depends on the presence of version and flow label | 641 | * class depends on the presence of version and flow label |
@@ -654,11 +646,11 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | |||
654 | tmp = ((tmp & 0x03) << 6) | (tmp >> 2); | 646 | tmp = ((tmp & 0x03) << 6) | (tmp >> 2); |
655 | 647 | ||
656 | if (((hdr->flow_lbl[0] & 0x0F) == 0) && | 648 | if (((hdr->flow_lbl[0] & 0x0F) == 0) && |
657 | (hdr->flow_lbl[1] == 0) && (hdr->flow_lbl[2] == 0)) { | 649 | (hdr->flow_lbl[1] == 0) && (hdr->flow_lbl[2] == 0)) { |
658 | /* flow label can be compressed */ | 650 | /* flow label can be compressed */ |
659 | iphc0 |= LOWPAN_IPHC_FL_C; | 651 | iphc0 |= LOWPAN_IPHC_FL_C; |
660 | if ((hdr->priority == 0) && | 652 | if ((hdr->priority == 0) && |
661 | ((hdr->flow_lbl[0] & 0xF0) == 0)) { | 653 | ((hdr->flow_lbl[0] & 0xF0) == 0)) { |
662 | /* compress (elide) all */ | 654 | /* compress (elide) all */ |
663 | iphc0 |= LOWPAN_IPHC_TC_C; | 655 | iphc0 |= LOWPAN_IPHC_TC_C; |
664 | } else { | 656 | } else { |
@@ -669,7 +661,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | |||
669 | } else { | 661 | } else { |
670 | /* Flow label cannot be compressed */ | 662 | /* Flow label cannot be compressed */ |
671 | if ((hdr->priority == 0) && | 663 | if ((hdr->priority == 0) && |
672 | ((hdr->flow_lbl[0] & 0xF0) == 0)) { | 664 | ((hdr->flow_lbl[0] & 0xF0) == 0)) { |
673 | /* compress only traffic class */ | 665 | /* compress only traffic class */ |
674 | iphc0 |= LOWPAN_IPHC_TC_C; | 666 | iphc0 |= LOWPAN_IPHC_TC_C; |
675 | *hc06_ptr = (tmp & 0xc0) | (hdr->flow_lbl[0] & 0x0F); | 667 | *hc06_ptr = (tmp & 0xc0) | (hdr->flow_lbl[0] & 0x0F); |
@@ -695,8 +687,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | |||
695 | hc06_ptr += 1; | 687 | hc06_ptr += 1; |
696 | } | 688 | } |
697 | 689 | ||
698 | /* | 690 | /* Hop limit |
699 | * Hop limit | ||
700 | * if 1: compress, encoding is 01 | 691 | * if 1: compress, encoding is 01 |
701 | * if 64: compress, encoding is 10 | 692 | * if 64: compress, encoding is 10 |
702 | * if 255: compress, encoding is 11 | 693 | * if 255: compress, encoding is 11 |
@@ -793,7 +784,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | |||
793 | pr_debug("header len %d skb %u\n", (int)(hc06_ptr - head), skb->len); | 784 | pr_debug("header len %d skb %u\n", (int)(hc06_ptr - head), skb->len); |
794 | 785 | ||
795 | raw_dump_table(__func__, "raw skb data dump compressed", | 786 | raw_dump_table(__func__, "raw skb data dump compressed", |
796 | skb->data, skb->len); | 787 | skb->data, skb->len); |
797 | return 0; | 788 | return 0; |
798 | } | 789 | } |
799 | EXPORT_SYMBOL_GPL(lowpan_header_compress); | 790 | EXPORT_SYMBOL_GPL(lowpan_header_compress); |
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c index fe6bd7a71081..016b77ee88f0 100644 --- a/net/ieee802154/6lowpan_rtnl.c +++ b/net/ieee802154/6lowpan_rtnl.c | |||
@@ -80,14 +80,14 @@ lowpan_dev_info *lowpan_dev_info(const struct net_device *dev) | |||
80 | static inline void lowpan_address_flip(u8 *src, u8 *dest) | 80 | static inline void lowpan_address_flip(u8 *src, u8 *dest) |
81 | { | 81 | { |
82 | int i; | 82 | int i; |
83 | |||
83 | for (i = 0; i < IEEE802154_ADDR_LEN; i++) | 84 | for (i = 0; i < IEEE802154_ADDR_LEN; i++) |
84 | (dest)[IEEE802154_ADDR_LEN - i - 1] = (src)[i]; | 85 | (dest)[IEEE802154_ADDR_LEN - i - 1] = (src)[i]; |
85 | } | 86 | } |
86 | 87 | ||
87 | static int lowpan_header_create(struct sk_buff *skb, | 88 | static int lowpan_header_create(struct sk_buff *skb, struct net_device *dev, |
88 | struct net_device *dev, | 89 | unsigned short type, const void *_daddr, |
89 | unsigned short type, const void *_daddr, | 90 | const void *_saddr, unsigned int len) |
90 | const void *_saddr, unsigned int len) | ||
91 | { | 91 | { |
92 | const u8 *saddr = _saddr; | 92 | const u8 *saddr = _saddr; |
93 | const u8 *daddr = _daddr; | 93 | const u8 *daddr = _daddr; |
@@ -144,7 +144,7 @@ static int lowpan_header_create(struct sk_buff *skb, | |||
144 | } | 144 | } |
145 | 145 | ||
146 | static int lowpan_give_skb_to_devices(struct sk_buff *skb, | 146 | static int lowpan_give_skb_to_devices(struct sk_buff *skb, |
147 | struct net_device *dev) | 147 | struct net_device *dev) |
148 | { | 148 | { |
149 | struct lowpan_dev_record *entry; | 149 | struct lowpan_dev_record *entry; |
150 | struct sk_buff *skb_cp; | 150 | struct sk_buff *skb_cp; |
@@ -368,24 +368,28 @@ static netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
368 | static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | 368 | static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) |
369 | { | 369 | { |
370 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | 370 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; |
371 | |||
371 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | 372 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); |
372 | } | 373 | } |
373 | 374 | ||
374 | static __le16 lowpan_get_pan_id(const struct net_device *dev) | 375 | static __le16 lowpan_get_pan_id(const struct net_device *dev) |
375 | { | 376 | { |
376 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | 377 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; |
378 | |||
377 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | 379 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); |
378 | } | 380 | } |
379 | 381 | ||
380 | static __le16 lowpan_get_short_addr(const struct net_device *dev) | 382 | static __le16 lowpan_get_short_addr(const struct net_device *dev) |
381 | { | 383 | { |
382 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | 384 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; |
385 | |||
383 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | 386 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); |
384 | } | 387 | } |
385 | 388 | ||
386 | static u8 lowpan_get_dsn(const struct net_device *dev) | 389 | static u8 lowpan_get_dsn(const struct net_device *dev) |
387 | { | 390 | { |
388 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | 391 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; |
392 | |||
389 | return ieee802154_mlme_ops(real_dev)->get_dsn(real_dev); | 393 | return ieee802154_mlme_ops(real_dev)->get_dsn(real_dev); |
390 | } | 394 | } |
391 | 395 | ||
@@ -454,7 +458,7 @@ static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
454 | } | 458 | } |
455 | 459 | ||
456 | static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev, | 460 | static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev, |
457 | struct packet_type *pt, struct net_device *orig_dev) | 461 | struct packet_type *pt, struct net_device *orig_dev) |
458 | { | 462 | { |
459 | struct ieee802154_hdr hdr; | 463 | struct ieee802154_hdr hdr; |
460 | int ret; | 464 | int ret; |
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index 351d9a94ec2f..29e0de63001b 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c | |||
@@ -40,9 +40,7 @@ | |||
40 | 40 | ||
41 | #include "af802154.h" | 41 | #include "af802154.h" |
42 | 42 | ||
43 | /* | 43 | /* Utility function for families */ |
44 | * Utility function for families | ||
45 | */ | ||
46 | struct net_device* | 44 | struct net_device* |
47 | ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr) | 45 | ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr) |
48 | { | 46 | { |
@@ -87,8 +85,8 @@ ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr) | |||
87 | rtnl_unlock(); | 85 | rtnl_unlock(); |
88 | break; | 86 | break; |
89 | default: | 87 | default: |
90 | pr_warning("Unsupported ieee802154 address type: %d\n", | 88 | pr_warn("Unsupported ieee802154 address type: %d\n", |
91 | addr->mode); | 89 | addr->mode); |
92 | break; | 90 | break; |
93 | } | 91 | } |
94 | 92 | ||
@@ -106,7 +104,7 @@ static int ieee802154_sock_release(struct socket *sock) | |||
106 | return 0; | 104 | return 0; |
107 | } | 105 | } |
108 | static int ieee802154_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | 106 | static int ieee802154_sock_sendmsg(struct kiocb *iocb, struct socket *sock, |
109 | struct msghdr *msg, size_t len) | 107 | struct msghdr *msg, size_t len) |
110 | { | 108 | { |
111 | struct sock *sk = sock->sk; | 109 | struct sock *sk = sock->sk; |
112 | 110 | ||
@@ -114,7 +112,7 @@ static int ieee802154_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
114 | } | 112 | } |
115 | 113 | ||
116 | static int ieee802154_sock_bind(struct socket *sock, struct sockaddr *uaddr, | 114 | static int ieee802154_sock_bind(struct socket *sock, struct sockaddr *uaddr, |
117 | int addr_len) | 115 | int addr_len) |
118 | { | 116 | { |
119 | struct sock *sk = sock->sk; | 117 | struct sock *sk = sock->sk; |
120 | 118 | ||
@@ -125,7 +123,7 @@ static int ieee802154_sock_bind(struct socket *sock, struct sockaddr *uaddr, | |||
125 | } | 123 | } |
126 | 124 | ||
127 | static int ieee802154_sock_connect(struct socket *sock, struct sockaddr *uaddr, | 125 | static int ieee802154_sock_connect(struct socket *sock, struct sockaddr *uaddr, |
128 | int addr_len, int flags) | 126 | int addr_len, int flags) |
129 | { | 127 | { |
130 | struct sock *sk = sock->sk; | 128 | struct sock *sk = sock->sk; |
131 | 129 | ||
@@ -139,7 +137,7 @@ static int ieee802154_sock_connect(struct socket *sock, struct sockaddr *uaddr, | |||
139 | } | 137 | } |
140 | 138 | ||
141 | static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | 139 | static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, |
142 | unsigned int cmd) | 140 | unsigned int cmd) |
143 | { | 141 | { |
144 | struct ifreq ifr; | 142 | struct ifreq ifr; |
145 | int ret = -ENOIOCTLCMD; | 143 | int ret = -ENOIOCTLCMD; |
@@ -167,7 +165,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
167 | } | 165 | } |
168 | 166 | ||
169 | static int ieee802154_sock_ioctl(struct socket *sock, unsigned int cmd, | 167 | static int ieee802154_sock_ioctl(struct socket *sock, unsigned int cmd, |
170 | unsigned long arg) | 168 | unsigned long arg) |
171 | { | 169 | { |
172 | struct sock *sk = sock->sk; | 170 | struct sock *sk = sock->sk; |
173 | 171 | ||
@@ -238,8 +236,7 @@ static const struct proto_ops ieee802154_dgram_ops = { | |||
238 | }; | 236 | }; |
239 | 237 | ||
240 | 238 | ||
241 | /* | 239 | /* Create a socket. Initialise the socket, blank the addresses |
242 | * Create a socket. Initialise the socket, blank the addresses | ||
243 | * set the state. | 240 | * set the state. |
244 | */ | 241 | */ |
245 | static int ieee802154_create(struct net *net, struct socket *sock, | 242 | static int ieee802154_create(struct net *net, struct socket *sock, |
@@ -301,13 +298,14 @@ static const struct net_proto_family ieee802154_family_ops = { | |||
301 | }; | 298 | }; |
302 | 299 | ||
303 | static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev, | 300 | static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev, |
304 | struct packet_type *pt, struct net_device *orig_dev) | 301 | struct packet_type *pt, struct net_device *orig_dev) |
305 | { | 302 | { |
306 | if (!netif_running(dev)) | 303 | if (!netif_running(dev)) |
307 | goto drop; | 304 | goto drop; |
308 | pr_debug("got frame, type %d, dev %p\n", dev->type, dev); | 305 | pr_debug("got frame, type %d, dev %p\n", dev->type, dev); |
309 | #ifdef DEBUG | 306 | #ifdef DEBUG |
310 | print_hex_dump_bytes("ieee802154_rcv ", DUMP_PREFIX_NONE, skb->data, skb->len); | 307 | print_hex_dump_bytes("ieee802154_rcv ", |
308 | DUMP_PREFIX_NONE, skb->data, skb->len); | ||
311 | #endif | 309 | #endif |
312 | 310 | ||
313 | if (!net_eq(dev_net(dev), &init_net)) | 311 | if (!net_eq(dev_net(dev), &init_net)) |
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 4f0ed8780194..ef2ad8aaef13 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -149,8 +149,7 @@ static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
149 | spin_lock_bh(&sk->sk_receive_queue.lock); | 149 | spin_lock_bh(&sk->sk_receive_queue.lock); |
150 | skb = skb_peek(&sk->sk_receive_queue); | 150 | skb = skb_peek(&sk->sk_receive_queue); |
151 | if (skb != NULL) { | 151 | if (skb != NULL) { |
152 | /* | 152 | /* We will only return the amount |
153 | * We will only return the amount | ||
154 | * of this packet since that is all | 153 | * of this packet since that is all |
155 | * that will be read. | 154 | * that will be read. |
156 | */ | 155 | */ |
@@ -161,12 +160,13 @@ static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
161 | } | 160 | } |
162 | 161 | ||
163 | } | 162 | } |
163 | |||
164 | return -ENOIOCTLCMD; | 164 | return -ENOIOCTLCMD; |
165 | } | 165 | } |
166 | 166 | ||
167 | /* FIXME: autobind */ | 167 | /* FIXME: autobind */ |
168 | static int dgram_connect(struct sock *sk, struct sockaddr *uaddr, | 168 | static int dgram_connect(struct sock *sk, struct sockaddr *uaddr, |
169 | int len) | 169 | int len) |
170 | { | 170 | { |
171 | struct sockaddr_ieee802154 *addr = (struct sockaddr_ieee802154 *)uaddr; | 171 | struct sockaddr_ieee802154 *addr = (struct sockaddr_ieee802154 *)uaddr; |
172 | struct dgram_sock *ro = dgram_sk(sk); | 172 | struct dgram_sock *ro = dgram_sk(sk); |
@@ -205,7 +205,7 @@ static int dgram_disconnect(struct sock *sk, int flags) | |||
205 | } | 205 | } |
206 | 206 | ||
207 | static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk, | 207 | static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk, |
208 | struct msghdr *msg, size_t size) | 208 | struct msghdr *msg, size_t size) |
209 | { | 209 | { |
210 | struct net_device *dev; | 210 | struct net_device *dev; |
211 | unsigned int mtu; | 211 | unsigned int mtu; |
@@ -248,8 +248,8 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
248 | hlen = LL_RESERVED_SPACE(dev); | 248 | hlen = LL_RESERVED_SPACE(dev); |
249 | tlen = dev->needed_tailroom; | 249 | tlen = dev->needed_tailroom; |
250 | skb = sock_alloc_send_skb(sk, hlen + tlen + size, | 250 | skb = sock_alloc_send_skb(sk, hlen + tlen + size, |
251 | msg->msg_flags & MSG_DONTWAIT, | 251 | msg->msg_flags & MSG_DONTWAIT, |
252 | &err); | 252 | &err); |
253 | if (!skb) | 253 | if (!skb) |
254 | goto out_dev; | 254 | goto out_dev; |
255 | 255 | ||
@@ -262,7 +262,8 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
262 | cb->ackreq = ro->want_ack; | 262 | cb->ackreq = ro->want_ack; |
263 | 263 | ||
264 | if (msg->msg_name) { | 264 | if (msg->msg_name) { |
265 | DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); | 265 | DECLARE_SOCKADDR(struct sockaddr_ieee802154*, |
266 | daddr, msg->msg_name); | ||
266 | 267 | ||
267 | ieee802154_addr_from_sa(&dst_addr, &daddr->addr); | 268 | ieee802154_addr_from_sa(&dst_addr, &daddr->addr); |
268 | } else { | 269 | } else { |
@@ -304,8 +305,8 @@ out: | |||
304 | } | 305 | } |
305 | 306 | ||
306 | static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk, | 307 | static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk, |
307 | struct msghdr *msg, size_t len, int noblock, int flags, | 308 | struct msghdr *msg, size_t len, int noblock, |
308 | int *addr_len) | 309 | int flags, int *addr_len) |
309 | { | 310 | { |
310 | size_t copied = 0; | 311 | size_t copied = 0; |
311 | int err = -EOPNOTSUPP; | 312 | int err = -EOPNOTSUPP; |
@@ -398,6 +399,7 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb) | |||
398 | dgram_sk(sk))) { | 399 | dgram_sk(sk))) { |
399 | if (prev) { | 400 | if (prev) { |
400 | struct sk_buff *clone; | 401 | struct sk_buff *clone; |
402 | |||
401 | clone = skb_clone(skb, GFP_ATOMIC); | 403 | clone = skb_clone(skb, GFP_ATOMIC); |
402 | if (clone) | 404 | if (clone) |
403 | dgram_rcv_skb(prev, clone); | 405 | dgram_rcv_skb(prev, clone); |
@@ -407,9 +409,9 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb) | |||
407 | } | 409 | } |
408 | } | 410 | } |
409 | 411 | ||
410 | if (prev) | 412 | if (prev) { |
411 | dgram_rcv_skb(prev, skb); | 413 | dgram_rcv_skb(prev, skb); |
412 | else { | 414 | } else { |
413 | kfree_skb(skb); | 415 | kfree_skb(skb); |
414 | ret = NET_RX_DROP; | 416 | ret = NET_RX_DROP; |
415 | } | 417 | } |
@@ -419,7 +421,7 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb) | |||
419 | } | 421 | } |
420 | 422 | ||
421 | static int dgram_getsockopt(struct sock *sk, int level, int optname, | 423 | static int dgram_getsockopt(struct sock *sk, int level, int optname, |
422 | char __user *optval, int __user *optlen) | 424 | char __user *optval, int __user *optlen) |
423 | { | 425 | { |
424 | struct dgram_sock *ro = dgram_sk(sk); | 426 | struct dgram_sock *ro = dgram_sk(sk); |
425 | 427 | ||
@@ -463,7 +465,7 @@ static int dgram_getsockopt(struct sock *sk, int level, int optname, | |||
463 | } | 465 | } |
464 | 466 | ||
465 | static int dgram_setsockopt(struct sock *sk, int level, int optname, | 467 | static int dgram_setsockopt(struct sock *sk, int level, int optname, |
466 | char __user *optval, unsigned int optlen) | 468 | char __user *optval, unsigned int optlen) |
467 | { | 469 | { |
468 | struct dgram_sock *ro = dgram_sk(sk); | 470 | struct dgram_sock *ro = dgram_sk(sk); |
469 | struct net *net = sock_net(sk); | 471 | struct net *net = sock_net(sk); |
diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h index 8b83a231299e..5d352f86979e 100644 --- a/net/ieee802154/ieee802154.h +++ b/net/ieee802154/ieee802154.h | |||
@@ -43,7 +43,7 @@ struct genl_info; | |||
43 | struct sk_buff *ieee802154_nl_create(int flags, u8 req); | 43 | struct sk_buff *ieee802154_nl_create(int flags, u8 req); |
44 | int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group); | 44 | int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group); |
45 | struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, | 45 | struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, |
46 | int flags, u8 req); | 46 | int flags, u8 req); |
47 | int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info); | 47 | int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info); |
48 | 48 | ||
49 | extern struct genl_family nl802154_family; | 49 | extern struct genl_family nl802154_family; |
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c index 26efcf4fd2ff..9222966f5e6d 100644 --- a/net/ieee802154/netlink.c +++ b/net/ieee802154/netlink.c | |||
@@ -52,7 +52,7 @@ struct sk_buff *ieee802154_nl_create(int flags, u8 req) | |||
52 | 52 | ||
53 | spin_lock_irqsave(&ieee802154_seq_lock, f); | 53 | spin_lock_irqsave(&ieee802154_seq_lock, f); |
54 | hdr = genlmsg_put(msg, 0, ieee802154_seq_num++, | 54 | hdr = genlmsg_put(msg, 0, ieee802154_seq_num++, |
55 | &nl802154_family, flags, req); | 55 | &nl802154_family, flags, req); |
56 | spin_unlock_irqrestore(&ieee802154_seq_lock, f); | 56 | spin_unlock_irqrestore(&ieee802154_seq_lock, f); |
57 | if (!hdr) { | 57 | if (!hdr) { |
58 | nlmsg_free(msg); | 58 | nlmsg_free(msg); |
@@ -86,7 +86,7 @@ struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info, | |||
86 | return NULL; | 86 | return NULL; |
87 | 87 | ||
88 | hdr = genlmsg_put_reply(msg, info, | 88 | hdr = genlmsg_put_reply(msg, info, |
89 | &nl802154_family, flags, req); | 89 | &nl802154_family, flags, req); |
90 | if (!hdr) { | 90 | if (!hdr) { |
91 | nlmsg_free(msg); | 91 | nlmsg_free(msg); |
92 | return NULL; | 92 | return NULL; |
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index a3281b8bfd5b..c6bfe22bfa5e 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c | |||
@@ -60,7 +60,8 @@ static __le16 nla_get_shortaddr(const struct nlattr *nla) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | int ieee802154_nl_assoc_indic(struct net_device *dev, | 62 | int ieee802154_nl_assoc_indic(struct net_device *dev, |
63 | struct ieee802154_addr *addr, u8 cap) | 63 | struct ieee802154_addr *addr, |
64 | u8 cap) | ||
64 | { | 65 | { |
65 | struct sk_buff *msg; | 66 | struct sk_buff *msg; |
66 | 67 | ||
@@ -93,7 +94,7 @@ nla_put_failure: | |||
93 | EXPORT_SYMBOL(ieee802154_nl_assoc_indic); | 94 | EXPORT_SYMBOL(ieee802154_nl_assoc_indic); |
94 | 95 | ||
95 | int ieee802154_nl_assoc_confirm(struct net_device *dev, __le16 short_addr, | 96 | int ieee802154_nl_assoc_confirm(struct net_device *dev, __le16 short_addr, |
96 | u8 status) | 97 | u8 status) |
97 | { | 98 | { |
98 | struct sk_buff *msg; | 99 | struct sk_buff *msg; |
99 | 100 | ||
@@ -119,7 +120,8 @@ nla_put_failure: | |||
119 | EXPORT_SYMBOL(ieee802154_nl_assoc_confirm); | 120 | EXPORT_SYMBOL(ieee802154_nl_assoc_confirm); |
120 | 121 | ||
121 | int ieee802154_nl_disassoc_indic(struct net_device *dev, | 122 | int ieee802154_nl_disassoc_indic(struct net_device *dev, |
122 | struct ieee802154_addr *addr, u8 reason) | 123 | struct ieee802154_addr *addr, |
124 | u8 reason) | ||
123 | { | 125 | { |
124 | struct sk_buff *msg; | 126 | struct sk_buff *msg; |
125 | 127 | ||
@@ -205,8 +207,9 @@ nla_put_failure: | |||
205 | EXPORT_SYMBOL(ieee802154_nl_beacon_indic); | 207 | EXPORT_SYMBOL(ieee802154_nl_beacon_indic); |
206 | 208 | ||
207 | int ieee802154_nl_scan_confirm(struct net_device *dev, | 209 | int ieee802154_nl_scan_confirm(struct net_device *dev, |
208 | u8 status, u8 scan_type, u32 unscanned, u8 page, | 210 | u8 status, u8 scan_type, |
209 | u8 *edl/* , struct list_head *pan_desc_list */) | 211 | u32 unscanned, u8 page, |
212 | u8 *edl/* , struct list_head *pan_desc_list */) | ||
210 | { | 213 | { |
211 | struct sk_buff *msg; | 214 | struct sk_buff *msg; |
212 | 215 | ||
@@ -260,7 +263,7 @@ nla_put_failure: | |||
260 | EXPORT_SYMBOL(ieee802154_nl_start_confirm); | 263 | EXPORT_SYMBOL(ieee802154_nl_start_confirm); |
261 | 264 | ||
262 | static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, | 265 | static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, |
263 | u32 seq, int flags, struct net_device *dev) | 266 | u32 seq, int flags, struct net_device *dev) |
264 | { | 267 | { |
265 | void *hdr; | 268 | void *hdr; |
266 | struct wpan_phy *phy; | 269 | struct wpan_phy *phy; |
@@ -270,7 +273,7 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, | |||
270 | pr_debug("%s\n", __func__); | 273 | pr_debug("%s\n", __func__); |
271 | 274 | ||
272 | hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags, | 275 | hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags, |
273 | IEEE802154_LIST_IFACE); | 276 | IEEE802154_LIST_IFACE); |
274 | if (!hdr) | 277 | if (!hdr) |
275 | goto out; | 278 | goto out; |
276 | 279 | ||
@@ -330,14 +333,16 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info) | |||
330 | 333 | ||
331 | if (info->attrs[IEEE802154_ATTR_DEV_NAME]) { | 334 | if (info->attrs[IEEE802154_ATTR_DEV_NAME]) { |
332 | char name[IFNAMSIZ + 1]; | 335 | char name[IFNAMSIZ + 1]; |
336 | |||
333 | nla_strlcpy(name, info->attrs[IEEE802154_ATTR_DEV_NAME], | 337 | nla_strlcpy(name, info->attrs[IEEE802154_ATTR_DEV_NAME], |
334 | sizeof(name)); | 338 | sizeof(name)); |
335 | dev = dev_get_by_name(&init_net, name); | 339 | dev = dev_get_by_name(&init_net, name); |
336 | } else if (info->attrs[IEEE802154_ATTR_DEV_INDEX]) | 340 | } else if (info->attrs[IEEE802154_ATTR_DEV_INDEX]) { |
337 | dev = dev_get_by_index(&init_net, | 341 | dev = dev_get_by_index(&init_net, |
338 | nla_get_u32(info->attrs[IEEE802154_ATTR_DEV_INDEX])); | 342 | nla_get_u32(info->attrs[IEEE802154_ATTR_DEV_INDEX])); |
339 | else | 343 | } else { |
340 | return NULL; | 344 | return NULL; |
345 | } | ||
341 | 346 | ||
342 | if (!dev) | 347 | if (!dev) |
343 | return NULL; | 348 | return NULL; |
@@ -435,7 +440,7 @@ int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info) | |||
435 | int ret = -EOPNOTSUPP; | 440 | int ret = -EOPNOTSUPP; |
436 | 441 | ||
437 | if ((!info->attrs[IEEE802154_ATTR_DEST_HW_ADDR] && | 442 | if ((!info->attrs[IEEE802154_ATTR_DEST_HW_ADDR] && |
438 | !info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]) || | 443 | !info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]) || |
439 | !info->attrs[IEEE802154_ATTR_REASON]) | 444 | !info->attrs[IEEE802154_ATTR_REASON]) |
440 | return -EINVAL; | 445 | return -EINVAL; |
441 | 446 | ||
@@ -464,8 +469,7 @@ out: | |||
464 | return ret; | 469 | return ret; |
465 | } | 470 | } |
466 | 471 | ||
467 | /* | 472 | /* PANid, channel, beacon_order = 15, superframe_order = 15, |
468 | * PANid, channel, beacon_order = 15, superframe_order = 15, | ||
469 | * PAN_coordinator, battery_life_extension = 0, | 473 | * PAN_coordinator, battery_life_extension = 0, |
470 | * coord_realignment = 0, security_enable = 0 | 474 | * coord_realignment = 0, security_enable = 0 |
471 | */ | 475 | */ |
@@ -559,8 +563,8 @@ int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) | |||
559 | page = 0; | 563 | page = 0; |
560 | 564 | ||
561 | 565 | ||
562 | ret = ieee802154_mlme_ops(dev)->scan_req(dev, type, channels, page, | 566 | ret = ieee802154_mlme_ops(dev)->scan_req(dev, type, channels, |
563 | duration); | 567 | page, duration); |
564 | 568 | ||
565 | out: | 569 | out: |
566 | dev_put(dev); | 570 | dev_put(dev); |
@@ -570,7 +574,8 @@ out: | |||
570 | int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info) | 574 | int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info) |
571 | { | 575 | { |
572 | /* Request for interface name, index, type, IEEE address, | 576 | /* Request for interface name, index, type, IEEE address, |
573 | PAN Id, short address */ | 577 | * PAN Id, short address |
578 | */ | ||
574 | struct sk_buff *msg; | 579 | struct sk_buff *msg; |
575 | struct net_device *dev = NULL; | 580 | struct net_device *dev = NULL; |
576 | int rc = -ENOBUFS; | 581 | int rc = -ENOBUFS; |
@@ -586,7 +591,7 @@ int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info) | |||
586 | goto out_dev; | 591 | goto out_dev; |
587 | 592 | ||
588 | rc = ieee802154_nl_fill_iface(msg, info->snd_portid, info->snd_seq, | 593 | rc = ieee802154_nl_fill_iface(msg, info->snd_portid, info->snd_seq, |
589 | 0, dev); | 594 | 0, dev); |
590 | if (rc < 0) | 595 | if (rc < 0) |
591 | goto out_free; | 596 | goto out_free; |
592 | 597 | ||
@@ -598,7 +603,6 @@ out_free: | |||
598 | out_dev: | 603 | out_dev: |
599 | dev_put(dev); | 604 | dev_put(dev); |
600 | return rc; | 605 | return rc; |
601 | |||
602 | } | 606 | } |
603 | 607 | ||
604 | int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb) | 608 | int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb) |
@@ -616,7 +620,8 @@ int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb) | |||
616 | goto cont; | 620 | goto cont; |
617 | 621 | ||
618 | if (ieee802154_nl_fill_iface(skb, NETLINK_CB(cb->skb).portid, | 622 | if (ieee802154_nl_fill_iface(skb, NETLINK_CB(cb->skb).portid, |
619 | cb->nlh->nlmsg_seq, NLM_F_MULTI, dev) < 0) | 623 | cb->nlh->nlmsg_seq, |
624 | NLM_F_MULTI, dev) < 0) | ||
620 | break; | 625 | break; |
621 | cont: | 626 | cont: |
622 | idx++; | 627 | idx++; |
@@ -765,6 +770,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, | |||
765 | case IEEE802154_SCF_KEY_SHORT_INDEX: | 770 | case IEEE802154_SCF_KEY_SHORT_INDEX: |
766 | { | 771 | { |
767 | u32 source = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT]); | 772 | u32 source = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT]); |
773 | |||
768 | desc->short_source = cpu_to_le32(source); | 774 | desc->short_source = cpu_to_le32(source); |
769 | break; | 775 | break; |
770 | } | 776 | } |
@@ -842,7 +848,7 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info) | |||
842 | goto out_dev; | 848 | goto out_dev; |
843 | 849 | ||
844 | hdr = genlmsg_put(msg, 0, info->snd_seq, &nl802154_family, 0, | 850 | hdr = genlmsg_put(msg, 0, info->snd_seq, &nl802154_family, 0, |
845 | IEEE802154_LLSEC_GETPARAMS); | 851 | IEEE802154_LLSEC_GETPARAMS); |
846 | if (!hdr) | 852 | if (!hdr) |
847 | goto out_free; | 853 | goto out_free; |
848 | 854 | ||
@@ -946,7 +952,7 @@ struct llsec_dump_data { | |||
946 | 952 | ||
947 | static int | 953 | static int |
948 | ieee802154_llsec_dump_table(struct sk_buff *skb, struct netlink_callback *cb, | 954 | ieee802154_llsec_dump_table(struct sk_buff *skb, struct netlink_callback *cb, |
949 | int (*step)(struct llsec_dump_data*)) | 955 | int (*step)(struct llsec_dump_data *)) |
950 | { | 956 | { |
951 | struct net *net = sock_net(skb->sk); | 957 | struct net *net = sock_net(skb->sk); |
952 | struct net_device *dev; | 958 | struct net_device *dev; |
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index 89b265aea151..972baf83411a 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "ieee802154.h" | 36 | #include "ieee802154.h" |
37 | 37 | ||
38 | static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid, | 38 | static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid, |
39 | u32 seq, int flags, struct wpan_phy *phy) | 39 | u32 seq, int flags, struct wpan_phy *phy) |
40 | { | 40 | { |
41 | void *hdr; | 41 | void *hdr; |
42 | int i, pages = 0; | 42 | int i, pages = 0; |
@@ -48,7 +48,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid, | |||
48 | return -EMSGSIZE; | 48 | return -EMSGSIZE; |
49 | 49 | ||
50 | hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags, | 50 | hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags, |
51 | IEEE802154_LIST_PHY); | 51 | IEEE802154_LIST_PHY); |
52 | if (!hdr) | 52 | if (!hdr) |
53 | goto out; | 53 | goto out; |
54 | 54 | ||
@@ -80,7 +80,8 @@ out: | |||
80 | int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info) | 80 | int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info) |
81 | { | 81 | { |
82 | /* Request for interface name, index, type, IEEE address, | 82 | /* Request for interface name, index, type, IEEE address, |
83 | PAN Id, short address */ | 83 | * PAN Id, short address |
84 | */ | ||
84 | struct sk_buff *msg; | 85 | struct sk_buff *msg; |
85 | struct wpan_phy *phy; | 86 | struct wpan_phy *phy; |
86 | const char *name; | 87 | const char *name; |
@@ -105,7 +106,7 @@ int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info) | |||
105 | goto out_dev; | 106 | goto out_dev; |
106 | 107 | ||
107 | rc = ieee802154_nl_fill_phy(msg, info->snd_portid, info->snd_seq, | 108 | rc = ieee802154_nl_fill_phy(msg, info->snd_portid, info->snd_seq, |
108 | 0, phy); | 109 | 0, phy); |
109 | if (rc < 0) | 110 | if (rc < 0) |
110 | goto out_free; | 111 | goto out_free; |
111 | 112 | ||
@@ -117,7 +118,6 @@ out_free: | |||
117 | out_dev: | 118 | out_dev: |
118 | wpan_phy_put(phy); | 119 | wpan_phy_put(phy); |
119 | return rc; | 120 | return rc; |
120 | |||
121 | } | 121 | } |
122 | 122 | ||
123 | struct dump_phy_data { | 123 | struct dump_phy_data { |
@@ -137,10 +137,10 @@ static int ieee802154_dump_phy_iter(struct wpan_phy *phy, void *_data) | |||
137 | return 0; | 137 | return 0; |
138 | 138 | ||
139 | rc = ieee802154_nl_fill_phy(data->skb, | 139 | rc = ieee802154_nl_fill_phy(data->skb, |
140 | NETLINK_CB(data->cb->skb).portid, | 140 | NETLINK_CB(data->cb->skb).portid, |
141 | data->cb->nlh->nlmsg_seq, | 141 | data->cb->nlh->nlmsg_seq, |
142 | NLM_F_MULTI, | 142 | NLM_F_MULTI, |
143 | phy); | 143 | phy); |
144 | 144 | ||
145 | if (rc < 0) { | 145 | if (rc < 0) { |
146 | data->idx--; | 146 | data->idx--; |
@@ -238,10 +238,9 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info) | |||
238 | 238 | ||
239 | addr.sa_family = ARPHRD_IEEE802154; | 239 | addr.sa_family = ARPHRD_IEEE802154; |
240 | nla_memcpy(&addr.sa_data, info->attrs[IEEE802154_ATTR_HW_ADDR], | 240 | nla_memcpy(&addr.sa_data, info->attrs[IEEE802154_ATTR_HW_ADDR], |
241 | IEEE802154_ADDR_LEN); | 241 | IEEE802154_ADDR_LEN); |
242 | 242 | ||
243 | /* | 243 | /* strangely enough, some callbacks (inetdev_event) from |
244 | * strangely enough, some callbacks (inetdev_event) from | ||
245 | * dev_set_mac_address require RTNL_LOCK | 244 | * dev_set_mac_address require RTNL_LOCK |
246 | */ | 245 | */ |
247 | rtnl_lock(); | 246 | rtnl_lock(); |
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c index 74d54fae33d7..9d1f64806f02 100644 --- a/net/ieee802154/raw.c +++ b/net/ieee802154/raw.c | |||
@@ -96,7 +96,7 @@ out: | |||
96 | } | 96 | } |
97 | 97 | ||
98 | static int raw_connect(struct sock *sk, struct sockaddr *uaddr, | 98 | static int raw_connect(struct sock *sk, struct sockaddr *uaddr, |
99 | int addr_len) | 99 | int addr_len) |
100 | { | 100 | { |
101 | return -ENOTSUPP; | 101 | return -ENOTSUPP; |
102 | } | 102 | } |
@@ -106,8 +106,8 @@ static int raw_disconnect(struct sock *sk, int flags) | |||
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 109 | static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, |
110 | size_t size) | 110 | struct msghdr *msg, size_t size) |
111 | { | 111 | { |
112 | struct net_device *dev; | 112 | struct net_device *dev; |
113 | unsigned int mtu; | 113 | unsigned int mtu; |
@@ -145,7 +145,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
145 | hlen = LL_RESERVED_SPACE(dev); | 145 | hlen = LL_RESERVED_SPACE(dev); |
146 | tlen = dev->needed_tailroom; | 146 | tlen = dev->needed_tailroom; |
147 | skb = sock_alloc_send_skb(sk, hlen + tlen + size, | 147 | skb = sock_alloc_send_skb(sk, hlen + tlen + size, |
148 | msg->msg_flags & MSG_DONTWAIT, &err); | 148 | msg->msg_flags & MSG_DONTWAIT, &err); |
149 | if (!skb) | 149 | if (!skb) |
150 | goto out_dev; | 150 | goto out_dev; |
151 | 151 | ||
@@ -235,7 +235,6 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb) | |||
235 | bh_lock_sock(sk); | 235 | bh_lock_sock(sk); |
236 | if (!sk->sk_bound_dev_if || | 236 | if (!sk->sk_bound_dev_if || |
237 | sk->sk_bound_dev_if == dev->ifindex) { | 237 | sk->sk_bound_dev_if == dev->ifindex) { |
238 | |||
239 | struct sk_buff *clone; | 238 | struct sk_buff *clone; |
240 | 239 | ||
241 | clone = skb_clone(skb, GFP_ATOMIC); | 240 | clone = skb_clone(skb, GFP_ATOMIC); |
@@ -248,13 +247,13 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb) | |||
248 | } | 247 | } |
249 | 248 | ||
250 | static int raw_getsockopt(struct sock *sk, int level, int optname, | 249 | static int raw_getsockopt(struct sock *sk, int level, int optname, |
251 | char __user *optval, int __user *optlen) | 250 | char __user *optval, int __user *optlen) |
252 | { | 251 | { |
253 | return -EOPNOTSUPP; | 252 | return -EOPNOTSUPP; |
254 | } | 253 | } |
255 | 254 | ||
256 | static int raw_setsockopt(struct sock *sk, int level, int optname, | 255 | static int raw_setsockopt(struct sock *sk, int level, int optname, |
257 | char __user *optval, unsigned int optlen) | 256 | char __user *optval, unsigned int optlen) |
258 | { | 257 | { |
259 | return -EOPNOTSUPP; | 258 | return -EOPNOTSUPP; |
260 | } | 259 | } |
@@ -274,4 +273,3 @@ struct proto ieee802154_raw_prot = { | |||
274 | .getsockopt = raw_getsockopt, | 273 | .getsockopt = raw_getsockopt, |
275 | .setsockopt = raw_setsockopt, | 274 | .setsockopt = raw_setsockopt, |
276 | }; | 275 | }; |
277 | |||
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c index 6f1428c4870b..b85bd3f7048e 100644 --- a/net/ieee802154/reassembly.c +++ b/net/ieee802154/reassembly.c | |||
@@ -378,6 +378,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, const u8 frag_type) | |||
378 | fq = fq_find(net, frag_info, &source, &dest); | 378 | fq = fq_find(net, frag_info, &source, &dest); |
379 | if (fq != NULL) { | 379 | if (fq != NULL) { |
380 | int ret; | 380 | int ret; |
381 | |||
381 | spin_lock(&fq->q.lock); | 382 | spin_lock(&fq->q.lock); |
382 | ret = lowpan_frag_queue(fq, skb, frag_type); | 383 | ret = lowpan_frag_queue(fq, skb, frag_type); |
383 | spin_unlock(&fq->q.lock); | 384 | spin_unlock(&fq->q.lock); |
diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index 8d6f6704da84..4955e0fe5883 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c | |||
@@ -48,7 +48,8 @@ MASTER_SHOW(transmit_power, "%d +- 1 dB"); | |||
48 | MASTER_SHOW(cca_mode, "%d"); | 48 | MASTER_SHOW(cca_mode, "%d"); |
49 | 49 | ||
50 | static ssize_t channels_supported_show(struct device *dev, | 50 | static ssize_t channels_supported_show(struct device *dev, |
51 | struct device_attribute *attr, char *buf) | 51 | struct device_attribute *attr, |
52 | char *buf) | ||
52 | { | 53 | { |
53 | struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); | 54 | struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); |
54 | int ret; | 55 | int ret; |
@@ -57,7 +58,7 @@ static ssize_t channels_supported_show(struct device *dev, | |||
57 | mutex_lock(&phy->pib_lock); | 58 | mutex_lock(&phy->pib_lock); |
58 | for (i = 0; i < 32; i++) { | 59 | for (i = 0; i < 32; i++) { |
59 | ret = snprintf(buf + len, PAGE_SIZE - len, | 60 | ret = snprintf(buf + len, PAGE_SIZE - len, |
60 | "%#09x\n", phy->channels_supported[i]); | 61 | "%#09x\n", phy->channels_supported[i]); |
61 | if (ret < 0) | 62 | if (ret < 0) |
62 | break; | 63 | break; |
63 | len += ret; | 64 | len += ret; |
@@ -80,6 +81,7 @@ ATTRIBUTE_GROUPS(pmib); | |||
80 | static void wpan_phy_release(struct device *d) | 81 | static void wpan_phy_release(struct device *d) |
81 | { | 82 | { |
82 | struct wpan_phy *phy = container_of(d, struct wpan_phy, dev); | 83 | struct wpan_phy *phy = container_of(d, struct wpan_phy, dev); |
84 | |||
83 | kfree(phy); | 85 | kfree(phy); |
84 | } | 86 | } |
85 | 87 | ||
@@ -121,11 +123,12 @@ static int wpan_phy_iter(struct device *dev, void *_data) | |||
121 | { | 123 | { |
122 | struct wpan_phy_iter_data *wpid = _data; | 124 | struct wpan_phy_iter_data *wpid = _data; |
123 | struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); | 125 | struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); |
126 | |||
124 | return wpid->fn(phy, wpid->data); | 127 | return wpid->fn(phy, wpid->data); |
125 | } | 128 | } |
126 | 129 | ||
127 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), | 130 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), |
128 | void *data) | 131 | void *data) |
129 | { | 132 | { |
130 | struct wpan_phy_iter_data wpid = { | 133 | struct wpan_phy_iter_data wpid = { |
131 | .fn = fn, | 134 | .fn = fn, |
@@ -197,6 +200,7 @@ EXPORT_SYMBOL(wpan_phy_free); | |||
197 | static int __init wpan_phy_class_init(void) | 200 | static int __init wpan_phy_class_init(void) |
198 | { | 201 | { |
199 | int rc; | 202 | int rc; |
203 | |||
200 | rc = class_register(&wpan_phy_class); | 204 | rc = class_register(&wpan_phy_class); |
201 | if (rc) | 205 | if (rc) |
202 | goto err; | 206 | goto err; |
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c index 2cf66d885e68..c4d4568611ca 100644 --- a/net/mac802154/ieee802154_dev.c +++ b/net/mac802154/ieee802154_dev.c | |||
@@ -143,6 +143,7 @@ static void | |||
143 | mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev) | 143 | mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev) |
144 | { | 144 | { |
145 | struct mac802154_sub_if_data *sdata; | 145 | struct mac802154_sub_if_data *sdata; |
146 | |||
146 | ASSERT_RTNL(); | 147 | ASSERT_RTNL(); |
147 | 148 | ||
148 | sdata = netdev_priv(dev); | 149 | sdata = netdev_priv(dev); |
@@ -276,7 +277,8 @@ ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops) | |||
276 | } | 277 | } |
277 | 278 | ||
278 | priv = wpan_phy_priv(phy); | 279 | priv = wpan_phy_priv(phy); |
279 | priv->hw.phy = priv->phy = phy; | 280 | priv->phy = phy; |
281 | priv->hw.phy = priv->phy; | ||
280 | priv->hw.priv = (char *)priv + ALIGN(sizeof(*priv), NETDEV_ALIGN); | 282 | priv->hw.priv = (char *)priv + ALIGN(sizeof(*priv), NETDEV_ALIGN); |
281 | priv->ops = ops; | 283 | priv->ops = ops; |
282 | 284 | ||
diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c index 1456f73b02b9..457058142098 100644 --- a/net/mac802154/llsec.c +++ b/net/mac802154/llsec.c | |||
@@ -538,6 +538,7 @@ static int llsec_recover_addr(struct mac802154_llsec *sec, | |||
538 | struct ieee802154_addr *addr) | 538 | struct ieee802154_addr *addr) |
539 | { | 539 | { |
540 | __le16 caddr = sec->params.coord_shortaddr; | 540 | __le16 caddr = sec->params.coord_shortaddr; |
541 | |||
541 | addr->pan_id = sec->params.pan_id; | 542 | addr->pan_id = sec->params.pan_id; |
542 | 543 | ||
543 | if (caddr == cpu_to_le16(IEEE802154_ADDR_BROADCAST)) { | 544 | if (caddr == cpu_to_le16(IEEE802154_ADDR_BROADCAST)) { |
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c index 15aa2f2b03a7..868a040fd422 100644 --- a/net/mac802154/mib.c +++ b/net/mac802154/mib.c | |||
@@ -175,9 +175,9 @@ static void phy_chan_notify(struct work_struct *work) | |||
175 | 175 | ||
176 | mutex_lock(&priv->hw->phy->pib_lock); | 176 | mutex_lock(&priv->hw->phy->pib_lock); |
177 | res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan); | 177 | res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan); |
178 | if (res) | 178 | if (res) { |
179 | pr_debug("set_channel failed\n"); | 179 | pr_debug("set_channel failed\n"); |
180 | else { | 180 | } else { |
181 | priv->hw->phy->current_channel = priv->chan; | 181 | priv->hw->phy->current_channel = priv->chan; |
182 | priv->hw->phy->current_page = priv->page; | 182 | priv->hw->phy->current_page = priv->page; |
183 | } | 183 | } |
@@ -210,8 +210,9 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) | |||
210 | INIT_WORK(&work->work, phy_chan_notify); | 210 | INIT_WORK(&work->work, phy_chan_notify); |
211 | work->dev = dev; | 211 | work->dev = dev; |
212 | queue_work(priv->hw->dev_workqueue, &work->work); | 212 | queue_work(priv->hw->dev_workqueue, &work->work); |
213 | } else | 213 | } else { |
214 | mutex_unlock(&priv->hw->phy->pib_lock); | 214 | mutex_unlock(&priv->hw->phy->pib_lock); |
215 | } | ||
215 | } | 216 | } |
216 | 217 | ||
217 | 218 | ||
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 6d1647399d4f..8124353646ae 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c | |||
@@ -98,6 +98,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, | |||
98 | if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { | 98 | if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { |
99 | u16 crc = crc_ccitt(0, skb->data, skb->len); | 99 | u16 crc = crc_ccitt(0, skb->data, skb->len); |
100 | u8 *data = skb_put(skb, 2); | 100 | u8 *data = skb_put(skb, 2); |
101 | |||
101 | data[0] = crc & 0xff; | 102 | data[0] = crc & 0xff; |
102 | data[1] = crc >> 8; | 103 | data[1] = crc >> 8; |
103 | } | 104 | } |