[PATCH] aoe 6/12: Alexey Dobriyan sparse cleanup

Alexey Dobriyan sparse cleanup

Signed-off-by: Alexey Dobriyan <adobriyan@mail.ru>
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


authored by ecashin@coraid.com and committed by Greg KH 63e9cc5d 03347936

+32 -38
+5 -5
drivers/block/aoe/aoe.h
··· 39 39 struct aoe_hdr { 40 40 unsigned char dst[6]; 41 41 unsigned char src[6]; 42 - unsigned char type[2]; 42 + __be16 type; 43 43 unsigned char verfl; 44 44 unsigned char err; 45 - unsigned char major[2]; 45 + __be16 major; 46 46 unsigned char minor; 47 47 unsigned char cmd; 48 - unsigned char tag[4]; 48 + __be32 tag; 49 49 }; 50 50 51 51 struct aoe_atahdr { ··· 63 63 }; 64 64 65 65 struct aoe_cfghdr { 66 - unsigned char bufcnt[2]; 67 - unsigned char fwver[2]; 66 + __be16 bufcnt; 67 + __be16 fwver; 68 68 unsigned char res; 69 69 unsigned char aoeccmd; 70 70 unsigned char cslen[2];
+23 -29
drivers/block/aoe/aoecmd.c
··· 90 90 static int 91 91 aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) 92 92 { 93 - u16 type = __constant_cpu_to_be16(ETH_P_AOE); 94 - u16 aoemajor = __cpu_to_be16(d->aoemajor); 95 93 u32 host_tag = newtag(d); 96 - u32 tag = __cpu_to_be32(host_tag); 97 94 98 95 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 99 96 memcpy(h->dst, d->addr, sizeof h->dst); 100 - memcpy(h->type, &type, sizeof type); 97 + h->type = __constant_cpu_to_be16(ETH_P_AOE); 101 98 h->verfl = AOE_HVER; 102 - memcpy(h->major, &aoemajor, sizeof aoemajor); 99 + h->major = cpu_to_be16(d->aoemajor); 103 100 h->minor = d->aoeminor; 104 101 h->cmd = AOECMD_ATA; 105 - memcpy(h->tag, &tag, sizeof tag); 102 + h->tag = cpu_to_be32(host_tag); 106 103 107 104 return host_tag; 108 105 } ··· 212 215 struct aoe_hdr *h; 213 216 char buf[128]; 214 217 u32 n; 215 - u32 net_tag; 216 218 217 219 n = newtag(d); 218 220 ··· 223 227 224 228 h = (struct aoe_hdr *) f->data; 225 229 f->tag = n; 226 - net_tag = __cpu_to_be32(n); 227 - memcpy(h->tag, &net_tag, sizeof net_tag); 230 + h->tag = cpu_to_be32(n); 228 231 229 232 skb = skb_prepare(d, f); 230 233 if (skb) { ··· 303 308 u16 n; 304 309 305 310 /* word 83: command set supported */ 306 - n = __le16_to_cpu(*((u16 *) &id[83<<1])); 311 + n = le16_to_cpup((__le16 *) &id[83<<1]); 307 312 308 313 /* word 86: command set/feature enabled */ 309 - n |= __le16_to_cpu(*((u16 *) &id[86<<1])); 314 + n |= le16_to_cpup((__le16 *) &id[86<<1]); 310 315 311 316 if (n & (1<<10)) { /* bit 10: LBA 48 */ 312 317 d->flags |= DEVFL_EXT; 313 318 314 319 /* word 100: number lba48 sectors */ 315 - ssize = __le64_to_cpu(*((u64 *) &id[100<<1])); 320 + ssize = le64_to_cpup((__le64 *) &id[100<<1]); 316 321 317 322 /* set as in ide-disk.c:init_idedisk_capacity */ 318 323 d->geo.cylinders = ssize; ··· 323 328 d->flags &= ~DEVFL_EXT; 324 329 325 330 /* number lba28 sectors */ 326 - ssize = __le32_to_cpu(*((u32 *) &id[60<<1])); 331 + ssize = le32_to_cpup((__le32 *) &id[60<<1]); 327 332 328 333 /* NOTE: obsolete in ATA 6 */ 329 - d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1])); 330 - d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1])); 331 - d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1])); 334 + d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]); 335 + d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]); 336 + d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]); 332 337 } 333 338 d->ssize = ssize; 334 339 d->geo.start = 0; ··· 378 383 u16 aoemajor; 379 384 380 385 hin = (struct aoe_hdr *) skb->mac.raw; 381 - aoemajor = __be16_to_cpu(*((u16 *) hin->major)); 386 + aoemajor = be16_to_cpu(hin->major); 382 387 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 383 388 if (d == NULL) { 384 389 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " ··· 390 395 391 396 spin_lock_irqsave(&d->lock, flags); 392 397 393 - f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag))); 398 + f = getframe(d, be32_to_cpu(hin->tag)); 394 399 if (f == NULL) { 395 400 spin_unlock_irqrestore(&d->lock, flags); 396 401 snprintf(ebuf, sizeof ebuf, 397 402 "%15s e%d.%d tag=%08x@%08lx\n", 398 403 "unexpected rsp", 399 - __be16_to_cpu(*((u16 *) hin->major)), 404 + be16_to_cpu(hin->major), 400 405 hin->minor, 401 - __be32_to_cpu(*((u32 *) hin->tag)), 406 + be32_to_cpu(hin->tag), 402 407 jiffies); 403 408 aoechr_error(ebuf); 404 409 return; ··· 448 453 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 449 454 "outbound ata command %2.2Xh for %d.%d\n", 450 455 ahout->cmdstat, 451 - __be16_to_cpu(*((u16 *) hin->major)), 456 + be16_to_cpu(hin->major), 452 457 hin->minor); 453 458 } 454 459 } ··· 482 487 struct aoe_cfghdr *ch; 483 488 struct sk_buff *skb, *sl; 484 489 struct net_device *ifp; 485 - u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE); 486 - u16 net_aoemajor = __cpu_to_be16(aoemajor); 487 490 488 491 sl = NULL; 489 492 ··· 501 508 502 509 memset(h->dst, 0xff, sizeof h->dst); 503 510 memcpy(h->src, ifp->dev_addr, sizeof h->src); 504 - memcpy(h->type, &aoe_type, sizeof aoe_type); 511 + h->type = __constant_cpu_to_be16(ETH_P_AOE); 505 512 h->verfl = AOE_HVER; 506 - memcpy(h->major, &net_aoemajor, sizeof net_aoemajor); 513 + h->major = cpu_to_be16(aoemajor); 507 514 h->minor = aoeminor; 508 515 h->cmd = AOECMD_CFG; 509 516 ··· 569 576 struct aoedev *d; 570 577 struct aoe_hdr *h; 571 578 struct aoe_cfghdr *ch; 572 - ulong flags, bufcnt, sysminor, aoemajor; 579 + ulong flags, sysminor, aoemajor; 580 + u16 bufcnt; 573 581 struct sk_buff *sl; 574 582 enum { MAXFRAMES = 8 }; 575 583 ··· 581 587 * Enough people have their dip switches set backwards to 582 588 * warrant a loud message for this special case. 583 589 */ 584 - aoemajor = __be16_to_cpu(*((u16 *) h->major)); 590 + aoemajor = be16_to_cpu(h->major); 585 591 if (aoemajor == 0xfff) { 586 592 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 587 593 "address is all ones. Check shelf dip switches\n"); ··· 596 602 return; 597 603 } 598 604 599 - bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt)); 605 + bufcnt = be16_to_cpu(ch->bufcnt); 600 606 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 601 607 bufcnt = MAXFRAMES; 602 608 ··· 613 619 return; 614 620 } 615 621 616 - d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver)); 622 + d->fw_ver = be16_to_cpu(ch->fwver); 617 623 618 624 /* we get here only if the device is new */ 619 625 sl = aoecmd_ata_id(d);
+4 -4
drivers/block/aoe/aoenet.c
··· 69 69 u64 70 70 mac_addr(char addr[6]) 71 71 { 72 - u64 n = 0; 72 + __be64 n = 0; 73 73 char *p = (char *) &n; 74 74 75 75 memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */ ··· 108 108 aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) 109 109 { 110 110 struct aoe_hdr *h; 111 - ulong n; 111 + u32 n; 112 112 113 113 skb = skb_check(skb); 114 114 if (!skb) ··· 121 121 skb_push(skb, ETH_HLEN); /* (1) */ 122 122 123 123 h = (struct aoe_hdr *) skb->mac.raw; 124 - n = __be32_to_cpu(*((u32 *) h->tag)); 124 + n = be32_to_cpu(h->tag); 125 125 if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) 126 126 goto exit; 127 127 ··· 132 132 if (net_ratelimit()) 133 133 printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " 134 134 "ecode=%d '%s'\n", 135 - __be16_to_cpu(*((u16 *) h->major)), h->minor, 135 + be16_to_cpu(h->major), h->minor, 136 136 h->err, aoe_errlist[n]); 137 137 goto exit; 138 138 }