aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoecmd.c
diff options
context:
space:
mode:
authorecashin@coraid.com <ecashin@coraid.com>2005-04-19 01:00:20 -0400
committerGreg KH <greg@press.kroah.org>2005-04-19 01:00:20 -0400
commit63e9cc5d6fbe8b58ea1ee96439d356cbf726fbc0 (patch)
tree91d5831da4a99c3d9dafd8e8440516787a536f73 /drivers/block/aoe/aoecmd.c
parent03347936afcba990525736ae39daa13f643eac5f (diff)
[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>
Diffstat (limited to 'drivers/block/aoe/aoecmd.c')
-rw-r--r--drivers/block/aoe/aoecmd.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 5d437697c368..f810bd6bf87f 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -90,19 +90,16 @@ newtag(struct aoedev *d)
90static int 90static int
91aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) 91aoehdr_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 u32 host_tag = newtag(d); 93 u32 host_tag = newtag(d);
96 u32 tag = __cpu_to_be32(host_tag);
97 94
98 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 95 memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
99 memcpy(h->dst, d->addr, sizeof h->dst); 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 h->verfl = AOE_HVER; 98 h->verfl = AOE_HVER;
102 memcpy(h->major, &aoemajor, sizeof aoemajor); 99 h->major = cpu_to_be16(d->aoemajor);
103 h->minor = d->aoeminor; 100 h->minor = d->aoeminor;
104 h->cmd = AOECMD_ATA; 101 h->cmd = AOECMD_ATA;
105 memcpy(h->tag, &tag, sizeof tag); 102 h->tag = cpu_to_be32(host_tag);
106 103
107 return host_tag; 104 return host_tag;
108} 105}
@@ -215,7 +212,6 @@ rexmit(struct aoedev *d, struct frame *f)
215 struct aoe_hdr *h; 212 struct aoe_hdr *h;
216 char buf[128]; 213 char buf[128];
217 u32 n; 214 u32 n;
218 u32 net_tag;
219 215
220 n = newtag(d); 216 n = newtag(d);
221 217
@@ -227,8 +223,7 @@ rexmit(struct aoedev *d, struct frame *f)
227 223
228 h = (struct aoe_hdr *) f->data; 224 h = (struct aoe_hdr *) f->data;
229 f->tag = n; 225 f->tag = n;
230 net_tag = __cpu_to_be32(n); 226 h->tag = cpu_to_be32(n);
231 memcpy(h->tag, &net_tag, sizeof net_tag);
232 227
233 skb = skb_prepare(d, f); 228 skb = skb_prepare(d, f);
234 if (skb) { 229 if (skb) {
@@ -308,16 +303,16 @@ ataid_complete(struct aoedev *d, unsigned char *id)
308 u16 n; 303 u16 n;
309 304
310 /* word 83: command set supported */ 305 /* word 83: command set supported */
311 n = __le16_to_cpu(*((u16 *) &id[83<<1])); 306 n = le16_to_cpup((__le16 *) &id[83<<1]);
312 307
313 /* word 86: command set/feature enabled */ 308 /* word 86: command set/feature enabled */
314 n |= __le16_to_cpu(*((u16 *) &id[86<<1])); 309 n |= le16_to_cpup((__le16 *) &id[86<<1]);
315 310
316 if (n & (1<<10)) { /* bit 10: LBA 48 */ 311 if (n & (1<<10)) { /* bit 10: LBA 48 */
317 d->flags |= DEVFL_EXT; 312 d->flags |= DEVFL_EXT;
318 313
319 /* word 100: number lba48 sectors */ 314 /* word 100: number lba48 sectors */
320 ssize = __le64_to_cpu(*((u64 *) &id[100<<1])); 315 ssize = le64_to_cpup((__le64 *) &id[100<<1]);
321 316
322 /* set as in ide-disk.c:init_idedisk_capacity */ 317 /* set as in ide-disk.c:init_idedisk_capacity */
323 d->geo.cylinders = ssize; 318 d->geo.cylinders = ssize;
@@ -328,12 +323,12 @@ ataid_complete(struct aoedev *d, unsigned char *id)
328 d->flags &= ~DEVFL_EXT; 323 d->flags &= ~DEVFL_EXT;
329 324
330 /* number lba28 sectors */ 325 /* number lba28 sectors */
331 ssize = __le32_to_cpu(*((u32 *) &id[60<<1])); 326 ssize = le32_to_cpup((__le32 *) &id[60<<1]);
332 327
333 /* NOTE: obsolete in ATA 6 */ 328 /* NOTE: obsolete in ATA 6 */
334 d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1])); 329 d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]);
335 d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1])); 330 d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]);
336 d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1])); 331 d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]);
337 } 332 }
338 d->ssize = ssize; 333 d->ssize = ssize;
339 d->geo.start = 0; 334 d->geo.start = 0;
@@ -383,7 +378,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
383 u16 aoemajor; 378 u16 aoemajor;
384 379
385 hin = (struct aoe_hdr *) skb->mac.raw; 380 hin = (struct aoe_hdr *) skb->mac.raw;
386 aoemajor = __be16_to_cpu(*((u16 *) hin->major)); 381 aoemajor = be16_to_cpu(hin->major);
387 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 382 d = aoedev_by_aoeaddr(aoemajor, hin->minor);
388 if (d == NULL) { 383 if (d == NULL) {
389 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " 384 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
@@ -395,15 +390,15 @@ aoecmd_ata_rsp(struct sk_buff *skb)
395 390
396 spin_lock_irqsave(&d->lock, flags); 391 spin_lock_irqsave(&d->lock, flags);
397 392
398 f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag))); 393 f = getframe(d, be32_to_cpu(hin->tag));
399 if (f == NULL) { 394 if (f == NULL) {
400 spin_unlock_irqrestore(&d->lock, flags); 395 spin_unlock_irqrestore(&d->lock, flags);
401 snprintf(ebuf, sizeof ebuf, 396 snprintf(ebuf, sizeof ebuf,
402 "%15s e%d.%d tag=%08x@%08lx\n", 397 "%15s e%d.%d tag=%08x@%08lx\n",
403 "unexpected rsp", 398 "unexpected rsp",
404 __be16_to_cpu(*((u16 *) hin->major)), 399 be16_to_cpu(hin->major),
405 hin->minor, 400 hin->minor,
406 __be32_to_cpu(*((u32 *) hin->tag)), 401 be32_to_cpu(hin->tag),
407 jiffies); 402 jiffies);
408 aoechr_error(ebuf); 403 aoechr_error(ebuf);
409 return; 404 return;
@@ -453,7 +448,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
453 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 448 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
454 "outbound ata command %2.2Xh for %d.%d\n", 449 "outbound ata command %2.2Xh for %d.%d\n",
455 ahout->cmdstat, 450 ahout->cmdstat,
456 __be16_to_cpu(*((u16 *) hin->major)), 451 be16_to_cpu(hin->major),
457 hin->minor); 452 hin->minor);
458 } 453 }
459 } 454 }
@@ -487,8 +482,6 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
487 struct aoe_cfghdr *ch; 482 struct aoe_cfghdr *ch;
488 struct sk_buff *skb, *sl; 483 struct sk_buff *skb, *sl;
489 struct net_device *ifp; 484 struct net_device *ifp;
490 u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE);
491 u16 net_aoemajor = __cpu_to_be16(aoemajor);
492 485
493 sl = NULL; 486 sl = NULL;
494 487
@@ -508,9 +501,9 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
508 501
509 memset(h->dst, 0xff, sizeof h->dst); 502 memset(h->dst, 0xff, sizeof h->dst);
510 memcpy(h->src, ifp->dev_addr, sizeof h->src); 503 memcpy(h->src, ifp->dev_addr, sizeof h->src);
511 memcpy(h->type, &aoe_type, sizeof aoe_type); 504 h->type = __constant_cpu_to_be16(ETH_P_AOE);
512 h->verfl = AOE_HVER; 505 h->verfl = AOE_HVER;
513 memcpy(h->major, &net_aoemajor, sizeof net_aoemajor); 506 h->major = cpu_to_be16(aoemajor);
514 h->minor = aoeminor; 507 h->minor = aoeminor;
515 h->cmd = AOECMD_CFG; 508 h->cmd = AOECMD_CFG;
516 509
@@ -576,7 +569,8 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
576 struct aoedev *d; 569 struct aoedev *d;
577 struct aoe_hdr *h; 570 struct aoe_hdr *h;
578 struct aoe_cfghdr *ch; 571 struct aoe_cfghdr *ch;
579 ulong flags, bufcnt, sysminor, aoemajor; 572 ulong flags, sysminor, aoemajor;
573 u16 bufcnt;
580 struct sk_buff *sl; 574 struct sk_buff *sl;
581 enum { MAXFRAMES = 8 }; 575 enum { MAXFRAMES = 8 };
582 576
@@ -587,7 +581,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
587 * Enough people have their dip switches set backwards to 581 * Enough people have their dip switches set backwards to
588 * warrant a loud message for this special case. 582 * warrant a loud message for this special case.
589 */ 583 */
590 aoemajor = __be16_to_cpu(*((u16 *) h->major)); 584 aoemajor = be16_to_cpu(h->major);
591 if (aoemajor == 0xfff) { 585 if (aoemajor == 0xfff) {
592 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 586 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf "
593 "address is all ones. Check shelf dip switches\n"); 587 "address is all ones. Check shelf dip switches\n");
@@ -602,7 +596,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
602 return; 596 return;
603 } 597 }
604 598
605 bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt)); 599 bufcnt = be16_to_cpu(ch->bufcnt);
606 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 600 if (bufcnt > MAXFRAMES) /* keep it reasonable */
607 bufcnt = MAXFRAMES; 601 bufcnt = MAXFRAMES;
608 602
@@ -619,7 +613,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
619 return; 613 return;
620 } 614 }
621 615
622 d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver)); 616 d->fw_ver = be16_to_cpu(ch->fwver);
623 617
624 /* we get here only if the device is new */ 618 /* we get here only if the device is new */
625 sl = aoecmd_ata_id(d); 619 sl = aoecmd_ata_id(d);