@@ -90,19 +90,16 @@ newtag(struct aoedev *d)
9090static int
9191aoehdr_atainit (struct aoedev * d , struct aoe_hdr * h )
9292{
93- u16 type = __constant_cpu_to_be16 (ETH_P_AOE );
94- u16 aoemajor = __cpu_to_be16 (d -> aoemajor );
9593 u32 host_tag = newtag (d );
96- u32 tag = __cpu_to_be32 (host_tag );
9794
9895 memcpy (h -> src , d -> ifp -> dev_addr , sizeof h -> src );
9996 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 );
10198 h -> verfl = AOE_HVER ;
102- memcpy ( h -> major , & aoemajor , sizeof aoemajor );
99+ h -> major = cpu_to_be16 ( d -> aoemajor );
103100 h -> minor = d -> aoeminor ;
104101 h -> cmd = AOECMD_ATA ;
105- memcpy ( h -> tag , & tag , sizeof tag );
102+ h -> tag = cpu_to_be32 ( host_tag );
106103
107104 return host_tag ;
108105}
@@ -215,7 +212,6 @@ rexmit(struct aoedev *d, struct frame *f)
215212 struct aoe_hdr * h ;
216213 char buf [128 ];
217214 u32 n ;
218- u32 net_tag ;
219215
220216 n = newtag (d );
221217
@@ -227,8 +223,7 @@ rexmit(struct aoedev *d, struct frame *f)
227223
228224 h = (struct aoe_hdr * ) f -> data ;
229225 f -> tag = n ;
230- net_tag = __cpu_to_be32 (n );
231- memcpy (h -> tag , & net_tag , sizeof net_tag );
226+ h -> tag = cpu_to_be32 (n );
232227
233228 skb = skb_prepare (d , f );
234229 if (skb ) {
@@ -308,16 +303,16 @@ ataid_complete(struct aoedev *d, unsigned char *id)
308303 u16 n ;
309304
310305 /* word 83: command set supported */
311- n = __le16_to_cpu ( * (( u16 * ) & id [83 <<1 ]) );
306+ n = le16_to_cpup (( __le16 * ) & id [83 <<1 ]);
312307
313308 /* word 86: command set/feature enabled */
314- n |= __le16_to_cpu ( * (( u16 * ) & id [86 <<1 ]) );
309+ n |= le16_to_cpup (( __le16 * ) & id [86 <<1 ]);
315310
316311 if (n & (1 <<10 )) { /* bit 10: LBA 48 */
317312 d -> flags |= DEVFL_EXT ;
318313
319314 /* word 100: number lba48 sectors */
320- ssize = __le64_to_cpu ( * (( u64 * ) & id [100 <<1 ]) );
315+ ssize = le64_to_cpup (( __le64 * ) & id [100 <<1 ]);
321316
322317 /* set as in ide-disk.c:init_idedisk_capacity */
323318 d -> geo .cylinders = ssize ;
@@ -328,12 +323,12 @@ ataid_complete(struct aoedev *d, unsigned char *id)
328323 d -> flags &= ~DEVFL_EXT ;
329324
330325 /* number lba28 sectors */
331- ssize = __le32_to_cpu ( * (( u32 * ) & id [60 <<1 ]) );
326+ ssize = le32_to_cpup (( __le32 * ) & id [60 <<1 ]);
332327
333328 /* NOTE: obsolete in ATA 6 */
334- d -> geo .cylinders = __le16_to_cpu ( * (( u16 * ) & id [54 <<1 ]) );
335- d -> geo .heads = __le16_to_cpu ( * (( u16 * ) & id [55 <<1 ]) );
336- d -> geo .sectors = __le16_to_cpu ( * (( u16 * ) & id [56 <<1 ]) );
329+ d -> geo .cylinders = le16_to_cpup (( __le16 * ) & id [54 <<1 ]);
330+ d -> geo .heads = le16_to_cpup (( __le16 * ) & id [55 <<1 ]);
331+ d -> geo .sectors = le16_to_cpup (( __le16 * ) & id [56 <<1 ]);
337332 }
338333 d -> ssize = ssize ;
339334 d -> geo .start = 0 ;
@@ -383,7 +378,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
383378 u16 aoemajor ;
384379
385380 hin = (struct aoe_hdr * ) skb -> mac .raw ;
386- aoemajor = __be16_to_cpu ( * (( u16 * ) hin -> major ) );
381+ aoemajor = be16_to_cpu ( hin -> major );
387382 d = aoedev_by_aoeaddr (aoemajor , hin -> minor );
388383 if (d == NULL ) {
389384 snprintf (ebuf , sizeof ebuf , "aoecmd_ata_rsp: ata response "
@@ -395,15 +390,15 @@ aoecmd_ata_rsp(struct sk_buff *skb)
395390
396391 spin_lock_irqsave (& d -> lock , flags );
397392
398- f = getframe (d , __be32_to_cpu ( * (( u32 * ) hin -> tag ) ));
393+ f = getframe (d , be32_to_cpu ( hin -> tag ));
399394 if (f == NULL ) {
400395 spin_unlock_irqrestore (& d -> lock , flags );
401396 snprintf (ebuf , sizeof ebuf ,
402397 "%15s e%d.%d tag=%08x@%08lx\n" ,
403398 "unexpected rsp" ,
404- __be16_to_cpu ( * (( u16 * ) hin -> major ) ),
399+ be16_to_cpu ( hin -> major ),
405400 hin -> minor ,
406- __be32_to_cpu ( * (( u32 * ) hin -> tag ) ),
401+ be32_to_cpu ( hin -> tag ),
407402 jiffies );
408403 aoechr_error (ebuf );
409404 return ;
@@ -453,7 +448,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
453448 printk (KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
454449 "outbound ata command %2.2Xh for %d.%d\n" ,
455450 ahout -> cmdstat ,
456- __be16_to_cpu ( * (( u16 * ) hin -> major ) ),
451+ be16_to_cpu ( hin -> major ),
457452 hin -> minor );
458453 }
459454 }
@@ -487,8 +482,6 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
487482 struct aoe_cfghdr * ch ;
488483 struct sk_buff * skb , * sl ;
489484 struct net_device * ifp ;
490- u16 aoe_type = __constant_cpu_to_be16 (ETH_P_AOE );
491- u16 net_aoemajor = __cpu_to_be16 (aoemajor );
492485
493486 sl = NULL ;
494487
@@ -508,9 +501,9 @@ aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
508501
509502 memset (h -> dst , 0xff , sizeof h -> dst );
510503 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 );
512505 h -> verfl = AOE_HVER ;
513- memcpy ( h -> major , & net_aoemajor , sizeof net_aoemajor );
506+ h -> major = cpu_to_be16 ( aoemajor );
514507 h -> minor = aoeminor ;
515508 h -> cmd = AOECMD_CFG ;
516509
@@ -576,7 +569,8 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
576569 struct aoedev * d ;
577570 struct aoe_hdr * h ;
578571 struct aoe_cfghdr * ch ;
579- ulong flags , bufcnt , sysminor , aoemajor ;
572+ ulong flags , sysminor , aoemajor ;
573+ u16 bufcnt ;
580574 struct sk_buff * sl ;
581575 enum { MAXFRAMES = 8 };
582576
@@ -587,7 +581,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
587581 * Enough people have their dip switches set backwards to
588582 * warrant a loud message for this special case.
589583 */
590- aoemajor = __be16_to_cpu ( * (( u16 * ) h -> major ) );
584+ aoemajor = be16_to_cpu ( h -> major );
591585 if (aoemajor == 0xfff ) {
592586 printk (KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf "
593587 "address is all ones. Check shelf dip switches\n" );
@@ -602,7 +596,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
602596 return ;
603597 }
604598
605- bufcnt = __be16_to_cpu ( * (( u16 * ) ch -> bufcnt ) );
599+ bufcnt = be16_to_cpu ( ch -> bufcnt );
606600 if (bufcnt > MAXFRAMES ) /* keep it reasonable */
607601 bufcnt = MAXFRAMES ;
608602
@@ -619,7 +613,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
619613 return ;
620614 }
621615
622- d -> fw_ver = __be16_to_cpu ( * (( u16 * ) ch -> fwver ) );
616+ d -> fw_ver = be16_to_cpu ( ch -> fwver );
623617
624618 /* we get here only if the device is new */
625619 sl = aoecmd_ata_id (d );
0 commit comments