ieee1394: eth1394: trivial sparse annotations
authorHarvey Harrison <harvey.harrison@gmail.com>
Sat, 13 Dec 2008 23:03:06 +0000 (15:03 -0800)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 4 Jan 2009 22:50:35 +0000 (23:50 +0100)
Mostly annotations of ether_type as a be16.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/ieee1394/eth1394.c
drivers/ieee1394/eth1394.h

index 7ae8bce..a074bfd 100644 (file)
@@ -92,7 +92,7 @@ struct partial_datagram {
        struct list_head list;
        u16 dgl;
        u16 dg_size;
-       u16 ether_type;
+       __be16 ether_type;
        struct sk_buff *skb;
        char *pbuf;
        struct list_head frag_info;
@@ -767,7 +767,7 @@ static int ether1394_header_parse(const struct sk_buff *skb,
 static int ether1394_header_cache(const struct neighbour *neigh,
                                  struct hh_cache *hh)
 {
-       unsigned short type = hh->hh_type;
+       __be16 type = hh->hh_type;
        struct net_device *dev = neigh->dev;
        struct eth1394hdr *eth =
                (struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN);
@@ -795,7 +795,7 @@ static void ether1394_header_cache_update(struct hh_cache *hh,
  ******************************************/
 
 /* Copied from net/ethernet/eth.c */
-static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev)
+static __be16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
        struct eth1394hdr *eth;
        unsigned char *rawp;
@@ -829,17 +829,17 @@ static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev)
 
 /* Parse an encapsulated IP1394 header into an ethernet frame packet.
  * We also perform ARP translation here, if need be.  */
-static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
+static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
                                 nodeid_t srcid, nodeid_t destid,
-                                u16 ether_type)
+                                __be16 ether_type)
 {
        struct eth1394_priv *priv = netdev_priv(dev);
-       u64 dest_hw;
-       unsigned short ret = 0;
+       __be64 dest_hw;
+       __be16 ret = 0;
 
        /* Setup our hw addresses. We use these to build the ethernet header. */
        if (destid == (LOCAL_BUS | ALL_NODES))
-               dest_hw = ~0ULL;  /* broadcast */
+               dest_hw = ~cpu_to_be64(0);  /* broadcast */
        else
                dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 |
                                      priv->host->csr.guid_lo);
@@ -873,7 +873,7 @@ static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
                node = eth1394_find_node_guid(&priv->ip_node_list,
                                              be64_to_cpu(guid));
                if (!node)
-                       return 0;
+                       return cpu_to_be16(0);
 
                node_info =
                    (struct eth1394_node_info *)node->ud->device.driver_data;
@@ -1063,7 +1063,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
        unsigned long flags;
        struct eth1394_priv *priv = netdev_priv(dev);
        union eth1394_hdr *hdr = (union eth1394_hdr *)buf;
-       u16 ether_type = 0;  /* initialized to clear warning */
+       __be16 ether_type = cpu_to_be16(0);  /* initialized to clear warning */
        int hdr_len;
        struct unit_directory *ud = priv->ud_list[NODEID_TO_NODE(srcid)];
        struct eth1394_node_info *node_info;
@@ -1259,7 +1259,7 @@ static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
 
 static void ether1394_iso(struct hpsb_iso *iso)
 {
-       quadlet_t *data;
+       __be32 *data;
        char *buf;
        struct eth1394_host_info *hi;
        struct net_device *dev;
@@ -1283,7 +1283,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
        for (i = 0; i < nready; i++) {
                struct hpsb_iso_packet_info *info =
                        &iso->infos[(iso->first_packet + i) % iso->buf_packets];
-               data = (quadlet_t *)(iso->data_buf.kvirt + info->offset);
+               data = (__be32 *)(iso->data_buf.kvirt + info->offset);
 
                /* skip over GASP header */
                buf = (char *)data + 8;
@@ -1614,7 +1614,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
                if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])
                        priv->bc_dgl++;
        } else {
-               __be64 guid = get_unaligned((u64 *)hdr_buf.h_dest);
+               __be64 guid = get_unaligned((__be64 *)hdr_buf.h_dest);
 
                node = eth1394_find_node_guid(&priv->ip_node_list,
                                              be64_to_cpu(guid));
index 4f3e2dd..e1b5ea8 100644 (file)
@@ -82,7 +82,7 @@ struct eth1394_priv {
 
 struct eth1394hdr {
        unsigned char   h_dest[ETH1394_ALEN];   /* destination eth1394 addr     */
-       unsigned short  h_proto;                /* packet type ID field */
+       __be16          h_proto;                /* packet type ID field */
 }  __attribute__((packed));
 
 static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb)
@@ -99,13 +99,13 @@ typedef enum {ETH1394_GASP, ETH1394_WRREQ} eth1394_tx_type;
 struct eth1394_uf_hdr {
        u16 lf:2;
        u16 res:14;
-       u16 ether_type;         /* Ethernet packet type */
+       __be16 ether_type;              /* Ethernet packet type */
 } __attribute__((packed));
 #elif defined __LITTLE_ENDIAN_BITFIELD
 struct eth1394_uf_hdr {
        u16 res:14;
        u16 lf:2;
-       u16 ether_type;
+       __be16 ether_type;
 } __attribute__((packed));
 #else
 #error Unknown bit field type
@@ -117,7 +117,7 @@ struct eth1394_ff_hdr {
        u16 lf:2;
        u16 res1:2;
        u16 dg_size:12;         /* Datagram size */
-       u16 ether_type;         /* Ethernet packet type */
+       __be16 ether_type;              /* Ethernet packet type */
        u16 dgl;                /* Datagram label */
        u16 res2;
 } __attribute__((packed));
@@ -126,7 +126,7 @@ struct eth1394_ff_hdr {
        u16 dg_size:12;
        u16 res1:2;
        u16 lf:2;
-       u16 ether_type;
+       __be16 ether_type;
        u16 dgl;
        u16 res2;
 } __attribute__((packed));
@@ -207,11 +207,11 @@ struct eth1394_arp {
        u16 opcode;             /* ARP Opcode   */
        /* Above is exactly the same format as struct arphdr */
 
-       u64 s_uniq_id;          /* Sender's 64bit EUI                   */
+       __be64 s_uniq_id;       /* Sender's 64bit EUI           */
        u8 max_rec;             /* Sender's max packet size             */
        u8 sspd;                /* Sender's max speed                   */
-       u16 fifo_hi;            /* hi 16bits of sender's FIFO addr      */
-       u32 fifo_lo;            /* lo 32bits of sender's FIFO addr      */
+       __be16 fifo_hi;         /* hi 16bits of sender's FIFO addr      */
+       __be32 fifo_lo;         /* lo 32bits of sender's FIFO addr      */
        u32 sip;                /* Sender's IP Address                  */
        u32 tip;                /* IP Address of requested hw addr      */
 };