Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / ieee1394 / eth1394.c
index 30fa0d4..2d5b57b 100644 (file)
@@ -367,7 +367,7 @@ static int eth1394_probe(struct device *dev)
        spin_lock_init(&node_info->pdg.lock);
        INIT_LIST_HEAD(&node_info->pdg.list);
        node_info->pdg.sz = 0;
-       node_info->fifo = ETHER1394_INVALID_ADDR;
+       node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
 
        ud->device.driver_data = node_info;
        new_node->ud = ud;
@@ -502,10 +502,8 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
 
        /* Determine speed limit */
        for (i = 0; i < host->node_count; i++)
-               if (max_speed > host->speed_map[NODEID_TO_NODE(host->node_id) *
-                                               64 + i])
-                       max_speed = host->speed_map[NODEID_TO_NODE(host->node_id) *
-                                                   64 + i];
+               if (max_speed > host->speed[i])
+                       max_speed = host->speed[i];
        priv->bc_sspd = max_speed;
 
        /* We'll use our maxpayload as the default mtu */
@@ -568,13 +566,11 @@ static void ether1394_add_host (struct hpsb_host *host)
        if (!(host->config_roms & HPSB_CONFIG_ROM_ENTRY_IP1394))
                return;
 
-       fifo_addr = hpsb_allocate_and_register_addrspace(&eth1394_highlevel,
-                                                        host,
-                                                        &addr_ops,
-                                                        ETHER1394_REGION_ADDR_LEN,
-                                                        ETHER1394_REGION_ADDR_LEN,
-                                                        -1, -1);
-       if (fifo_addr == ~0ULL)
+       fifo_addr = hpsb_allocate_and_register_addrspace(
+                       &eth1394_highlevel, host, &addr_ops,
+                       ETHER1394_REGION_ADDR_LEN, ETHER1394_REGION_ADDR_LEN,
+                       CSR1212_INVALID_ADDR_SPACE, CSR1212_INVALID_ADDR_SPACE);
+       if (fifo_addr == CSR1212_INVALID_ADDR_SPACE)
                goto out;
 
        /* We should really have our own alloc_hpsbdev() function in
@@ -774,7 +770,7 @@ static int ether1394_rebuild_header(struct sk_buff *skb)
        default:
                ETH1394_PRINT(KERN_DEBUG, dev->name,
                              "unable to resolve type %04x addresses.\n",
-                             eth->h_proto);
+                             ntohs(eth->h_proto));
                break;
        }
 
@@ -796,9 +792,8 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh)
                                                      (16 - ETH1394_HLEN));
        struct net_device *dev = neigh->dev;
 
-       if (type == __constant_htons(ETH_P_802_3)) {
+       if (type == htons(ETH_P_802_3))
                return -1;
-       }
 
        eth->h_proto = type;
        memcpy(eth->h_dest, neigh->ha, dev->addr_len);
@@ -887,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
         * use of some of the fields, since they tell us a little bit
         * 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 arphdr *arp = (struct arphdr *)skb->data;
                unsigned char *arp_ptr = (unsigned char *)(arp + 1);
@@ -935,7 +930,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
                *(u32*)arp_ptr = arp1394->sip;  /* move sender IP addr */
                arp_ptr += arp->ar_pln;         /* skip over sender IP addr */
 
-               if (arp->ar_op == 1)
+               if (arp->ar_op == htons(ARPOP_REQUEST))
                        /* just set ARP req target unique ID to 0 */
                        *((u64*)arp_ptr) = 0;
                else
@@ -943,8 +938,8 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
        }
 
        /* Now add the ethernet header. */
-       if (dev->hard_header (skb, dev, __constant_ntohs (ether_type),
-                             &dest_hw, NULL, skb->len) >= 0)
+       if (dev->hard_header(skb, dev, ntohs(ether_type), &dest_hw, NULL,
+                            skb->len) >= 0)
                ret = ether1394_type_trans(skb, dev);
 
        return ret;
@@ -1079,8 +1074,7 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he
 
        /* Move list entry to beginnig of list so that oldest partial
         * datagrams percolate to the end of the list */
-       list_del(lh);
-       list_add(lh, pdgl);
+       list_move(lh, pdgl);
 
        return 0;
 }
@@ -1395,7 +1389,7 @@ static inline void ether1394_arp_to_1394arp(struct sk_buff *skb,
 /* We need to encapsulate the standard header with our own. We use the
  * ethernet header's proto for our own. */
 static inline unsigned int ether1394_encapsulate_prep(unsigned int max_payload,
-                                                     int proto,
+                                                     __be16 proto,
                                                      union eth1394_hdr *hdr,
                                                      u16 dg_size, u16 dgl)
 {
@@ -1514,8 +1508,8 @@ static inline void ether1394_prep_gasp_packet(struct hpsb_packet *p,
        p->data = ((quadlet_t*)skb->data) - 2;
        p->data[0] = cpu_to_be32((priv->host->node_id << 16) |
                                 ETHER1394_GASP_SPECIFIER_ID_HI);
-       p->data[1] = __constant_cpu_to_be32((ETHER1394_GASP_SPECIFIER_ID_LO << 24) |
-                                           ETHER1394_GASP_VERSION);
+       p->data[1] = cpu_to_be32((ETHER1394_GASP_SPECIFIER_ID_LO << 24) |
+                                ETHER1394_GASP_VERSION);
 
        /* Setting the node id to ALL_NODES (not LOCAL_BUS | ALL_NODES)
         * prevents hpsb_send_packet() from setting the speed to an arbitrary
@@ -1626,7 +1620,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
        gfp_t kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
        struct eth1394hdr *eth;
        struct eth1394_priv *priv = netdev_priv(dev);
-       int proto;
+       __be16 proto;
        unsigned long flags;
        nodeid_t dest_node;
        eth1394_tx_type tx_type;
@@ -1670,9 +1664,9 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
        /* Set the transmission type for the packet.  ARP packets and IP
         * broadcast packets are sent via GASP. */
        if (memcmp(eth->h_dest, dev->broadcast, ETH1394_ALEN) == 0 ||
-           proto == __constant_htons(ETH_P_ARP) ||
-           (proto == __constant_htons(ETH_P_IP) &&
-            IN_MULTICAST(__constant_ntohl(skb->nh.iph->daddr)))) {
+           proto == htons(ETH_P_ARP) ||
+           (proto == htons(ETH_P_IP) &&
+            IN_MULTICAST(ntohl(skb->nh.iph->daddr)))) {
                tx_type = ETH1394_GASP;
                dest_node = LOCAL_BUS | ALL_NODES;
                max_payload = priv->bc_maxpayload - ETHER1394_GASP_OVERHEAD;
@@ -1688,7 +1682,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
                        goto fail;
                }
                node_info = (struct eth1394_node_info*)node->ud->device.driver_data;
-               if (node_info->fifo == ETHER1394_INVALID_ADDR) {
+               if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) {
                        ret = -EAGAIN;
                        goto fail;
                }
@@ -1704,7 +1698,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
        }
 
        /* 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);
 
        ptask->hdr.words.word1 = 0;