]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/nes/nes_verbs.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / nes / nes_verbs.c
index 7c27420c22405a0bfd1faaa9549915dd7f37e6ea..9ae397a0ff7e4d9d88155a1278ee3cc8b41540e7 100644 (file)
@@ -1976,7 +1976,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq)
 
        if (nescq->cq_mem_size)
                pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size,
-                               (void *)nescq->hw_cq.cq_vbase, nescq->hw_cq.cq_pbase);
+                                   nescq->hw_cq.cq_vbase, nescq->hw_cq.cq_pbase);
        kfree(nescq);
 
        return ret;
@@ -2377,7 +2377,7 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
        u8 single_page = 1;
        u8 stag_key;
 
-       region = ib_umem_get(pd->uobject->context, start, length, acc);
+       region = ib_umem_get(pd->uobject->context, start, length, acc, 0);
        if (IS_ERR(region)) {
                return (struct ib_mr *)region;
        }
@@ -2800,10 +2800,11 @@ static int nes_dereg_mr(struct ib_mr *ib_mr)
 /**
  * show_rev
  */
-static ssize_t show_rev(struct class_device *cdev, char *buf)
+static ssize_t show_rev(struct device *dev, struct device_attribute *attr,
+                       char *buf)
 {
        struct nes_ib_device *nesibdev =
-                       container_of(cdev, struct nes_ib_device, ibdev.class_dev);
+                       container_of(dev, struct nes_ib_device, ibdev.dev);
        struct nes_vnic *nesvnic = nesibdev->nesvnic;
 
        nes_debug(NES_DBG_INIT, "\n");
@@ -2814,10 +2815,11 @@ static ssize_t show_rev(struct class_device *cdev, char *buf)
 /**
  * show_fw_ver
  */
-static ssize_t show_fw_ver(struct class_device *cdev, char *buf)
+static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
+                          char *buf)
 {
        struct nes_ib_device *nesibdev =
-                       container_of(cdev, struct nes_ib_device, ibdev.class_dev);
+                       container_of(dev, struct nes_ib_device, ibdev.dev);
        struct nes_vnic *nesvnic = nesibdev->nesvnic;
 
        nes_debug(NES_DBG_INIT, "\n");
@@ -2831,7 +2833,8 @@ static ssize_t show_fw_ver(struct class_device *cdev, char *buf)
 /**
  * show_hca
  */
-static ssize_t show_hca(struct class_device *cdev, char *buf)
+static ssize_t show_hca(struct device *dev, struct device_attribute *attr,
+                       char *buf)
 {
        nes_debug(NES_DBG_INIT, "\n");
        return sprintf(buf, "NES020\n");
@@ -2841,23 +2844,24 @@ static ssize_t show_hca(struct class_device *cdev, char *buf)
 /**
  * show_board
  */
-static ssize_t show_board(struct class_device *cdev, char *buf)
+static ssize_t show_board(struct device *dev, struct device_attribute *attr,
+                         char *buf)
 {
        nes_debug(NES_DBG_INIT, "\n");
        return sprintf(buf, "%.*s\n", 32, "NES020 Board ID");
 }
 
 
-static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
-static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
-static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
-static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);
+static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
+static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
+static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
+static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);
 
-static struct class_device_attribute *nes_class_attributes[] = {
-       &class_device_attr_hw_rev,
-       &class_device_attr_fw_ver,
-       &class_device_attr_hca_type,
-       &class_device_attr_board_id
+static struct device_attribute *nes_dev_attributes[] = {
+       &dev_attr_hw_rev,
+       &dev_attr_fw_ver,
+       &dev_attr_hca_type,
+       &dev_attr_board_id
 };
 
 
@@ -3606,6 +3610,12 @@ static int nes_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry)
        while (cqe_count < num_entries) {
                if (le32_to_cpu(nescq->hw_cq.cq_vbase[head].cqe_words[NES_CQE_OPCODE_IDX]) &
                                NES_CQE_VALID) {
+                       /*
+                        * Make sure we read CQ entry contents *after*
+                        * we've checked the valid bit.
+                        */
+                       rmb();
+
                        cqe = nescq->hw_cq.cq_vbase[head];
                        nescq->hw_cq.cq_vbase[head].cqe_words[NES_CQE_OPCODE_IDX] = 0;
                        u32temp = le32_to_cpu(cqe.cqe_words[NES_CQE_COMP_COMP_CTX_LOW_IDX]);
@@ -3782,7 +3792,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
        nesibdev->ibdev.phys_port_cnt = 1;
        nesibdev->ibdev.num_comp_vectors = 1;
        nesibdev->ibdev.dma_device = &nesdev->pcidev->dev;
-       nesibdev->ibdev.class_dev.dev = &nesdev->pcidev->dev;
+       nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev;
        nesibdev->ibdev.query_device = nes_query_device;
        nesibdev->ibdev.query_port = nes_query_port;
        nesibdev->ibdev.modify_port = nes_modify_port;
@@ -3877,13 +3887,13 @@ int nes_register_ofa_device(struct nes_ib_device *nesibdev)
        nesibdev->max_qp = (nesadapter->max_qp-NES_FIRST_QPN) / nesadapter->port_count;
        nesibdev->max_pd = nesadapter->max_pd / nesadapter->port_count;
 
-       for (i = 0; i < ARRAY_SIZE(nes_class_attributes); ++i) {
-               ret = class_device_create_file(&nesibdev->ibdev.class_dev, nes_class_attributes[i]);
+       for (i = 0; i < ARRAY_SIZE(nes_dev_attributes); ++i) {
+               ret = device_create_file(&nesibdev->ibdev.dev, nes_dev_attributes[i]);
                if (ret) {
                        while (i > 0) {
                                i--;
-                               class_device_remove_file(&nesibdev->ibdev.class_dev,
-                                               nes_class_attributes[i]);
+                               device_remove_file(&nesibdev->ibdev.dev,
+                                                  nes_dev_attributes[i]);
                        }
                        ib_unregister_device(&nesibdev->ibdev);
                        return ret;
@@ -3904,8 +3914,8 @@ static void nes_unregister_ofa_device(struct nes_ib_device *nesibdev)
        struct nes_vnic *nesvnic = nesibdev->nesvnic;
        int i;
 
-       for (i = 0; i < ARRAY_SIZE(nes_class_attributes); ++i) {
-               class_device_remove_file(&nesibdev->ibdev.class_dev, nes_class_attributes[i]);
+       for (i = 0; i < ARRAY_SIZE(nes_dev_attributes); ++i) {
+               device_remove_file(&nesibdev->ibdev.dev, nes_dev_attributes[i]);
        }
 
        if (nesvnic->of_device_registered) {