Commit 7136b807 authored by Ben Collins's avatar Ben Collins

eth1394: replace __constant_htons by htons

...and __constant_ntohs, __constant_ntohl, __constant_cpu_to_be32 too
where possible.  Htons and friends are resolved to constants in these
places anyway.  Also fix an endianess glitch in a log message, spotted
by Alexey Dobriyan.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarBen Collins <bcollins@ubuntu.com>
parent 2c4b69bd
...@@ -770,7 +770,7 @@ static int ether1394_rebuild_header(struct sk_buff *skb) ...@@ -770,7 +770,7 @@ static int ether1394_rebuild_header(struct sk_buff *skb)
default: default:
ETH1394_PRINT(KERN_DEBUG, dev->name, ETH1394_PRINT(KERN_DEBUG, dev->name,
"unable to resolve type %04x addresses.\n", "unable to resolve type %04x addresses.\n",
eth->h_proto); ntohs(eth->h_proto));
break; break;
} }
...@@ -792,9 +792,8 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh) ...@@ -792,9 +792,8 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh)
(16 - ETH1394_HLEN)); (16 - ETH1394_HLEN));
struct net_device *dev = neigh->dev; struct net_device *dev = neigh->dev;
if (type == __constant_htons(ETH_P_802_3)) { if (type == htons(ETH_P_802_3))
return -1; return -1;
}
eth->h_proto = type; eth->h_proto = type;
memcpy(eth->h_dest, neigh->ha, dev->addr_len); memcpy(eth->h_dest, neigh->ha, dev->addr_len);
...@@ -883,7 +882,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb, ...@@ -883,7 +882,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
/* If this is an ARP packet, convert it. First, we want to make /* If this is an ARP packet, convert it. First, we want to make
* use of some of the fields, since they tell us a little bit * use of some of the fields, since they tell us a little bit
* about the sending machine. */ * about the sending machine. */
if (ether_type == __constant_htons (ETH_P_ARP)) { if (ether_type == htons(ETH_P_ARP)) {
struct eth1394_arp *arp1394 = (struct eth1394_arp*)skb->data; struct eth1394_arp *arp1394 = (struct eth1394_arp*)skb->data;
struct arphdr *arp = (struct arphdr *)skb->data; struct arphdr *arp = (struct arphdr *)skb->data;
unsigned char *arp_ptr = (unsigned char *)(arp + 1); unsigned char *arp_ptr = (unsigned char *)(arp + 1);
...@@ -939,8 +938,8 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb, ...@@ -939,8 +938,8 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
} }
/* Now add the ethernet header. */ /* Now add the ethernet header. */
if (dev->hard_header (skb, dev, __constant_ntohs (ether_type), if (dev->hard_header(skb, dev, ntohs(ether_type), &dest_hw, NULL,
&dest_hw, NULL, skb->len) >= 0) skb->len) >= 0)
ret = ether1394_type_trans(skb, dev); ret = ether1394_type_trans(skb, dev);
return ret; return ret;
...@@ -1510,8 +1509,8 @@ static inline void ether1394_prep_gasp_packet(struct hpsb_packet *p, ...@@ -1510,8 +1509,8 @@ static inline void ether1394_prep_gasp_packet(struct hpsb_packet *p,
p->data = ((quadlet_t*)skb->data) - 2; p->data = ((quadlet_t*)skb->data) - 2;
p->data[0] = cpu_to_be32((priv->host->node_id << 16) | p->data[0] = cpu_to_be32((priv->host->node_id << 16) |
ETHER1394_GASP_SPECIFIER_ID_HI); ETHER1394_GASP_SPECIFIER_ID_HI);
p->data[1] = __constant_cpu_to_be32((ETHER1394_GASP_SPECIFIER_ID_LO << 24) | p->data[1] = cpu_to_be32((ETHER1394_GASP_SPECIFIER_ID_LO << 24) |
ETHER1394_GASP_VERSION); ETHER1394_GASP_VERSION);
/* Setting the node id to ALL_NODES (not LOCAL_BUS | ALL_NODES) /* Setting the node id to ALL_NODES (not LOCAL_BUS | ALL_NODES)
* prevents hpsb_send_packet() from setting the speed to an arbitrary * prevents hpsb_send_packet() from setting the speed to an arbitrary
...@@ -1666,9 +1665,9 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev) ...@@ -1666,9 +1665,9 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
/* Set the transmission type for the packet. ARP packets and IP /* Set the transmission type for the packet. ARP packets and IP
* broadcast packets are sent via GASP. */ * broadcast packets are sent via GASP. */
if (memcmp(eth->h_dest, dev->broadcast, ETH1394_ALEN) == 0 || if (memcmp(eth->h_dest, dev->broadcast, ETH1394_ALEN) == 0 ||
proto == __constant_htons(ETH_P_ARP) || proto == htons(ETH_P_ARP) ||
(proto == __constant_htons(ETH_P_IP) && (proto == htons(ETH_P_IP) &&
IN_MULTICAST(__constant_ntohl(skb->nh.iph->daddr)))) { IN_MULTICAST(ntohl(skb->nh.iph->daddr)))) {
tx_type = ETH1394_GASP; tx_type = ETH1394_GASP;
dest_node = LOCAL_BUS | ALL_NODES; dest_node = LOCAL_BUS | ALL_NODES;
max_payload = priv->bc_maxpayload - ETHER1394_GASP_OVERHEAD; max_payload = priv->bc_maxpayload - ETHER1394_GASP_OVERHEAD;
...@@ -1700,7 +1699,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev) ...@@ -1700,7 +1699,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
} }
/* If this is an ARP packet, convert it */ /* If this is an ARP packet, convert it */
if (proto == __constant_htons (ETH_P_ARP)) if (proto == htons(ETH_P_ARP))
ether1394_arp_to_1394arp (skb, dev); ether1394_arp_to_1394arp (skb, dev);
ptask->hdr.words.word1 = 0; ptask->hdr.words.word1 = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment