Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
[linux-2.6-block.git] / drivers / staging / rdma / hfi1 / user_sdma.c
index 46e254d52dadd514e9fa7abcc433f4f6cbfdc313..ab6b6a42000f709020a001a2aa9594d0f2f5b851 100644 (file)
@@ -64,7 +64,6 @@
 #include "hfi.h"
 #include "sdma.h"
 #include "user_sdma.h"
-#include "sdma.h"
 #include "verbs.h"  /* for the headers */
 #include "common.h" /* for struct hfi1_tid_info */
 #include "trace.h"
@@ -351,7 +350,7 @@ static void activate_packet_queue(struct iowait *wait, int reason)
 
 static void sdma_kmem_cache_ctor(void *obj)
 {
-       struct user_sdma_txreq *tx = (struct user_sdma_txreq *)obj;
+       struct user_sdma_txreq *tx = obj;
 
        memset(tx, 0, sizeof(*tx));
 }
@@ -422,8 +421,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)
        if (!cq)
                goto cq_nomem;
 
-       memsize = ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size,
-                       PAGE_SIZE);
+       memsize = PAGE_ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size);
        cq->comps = vmalloc_user(memsize);
        if (!cq->comps)
                goto cq_comps_nomem;
@@ -483,8 +481,7 @@ int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd)
                fd->pq = NULL;
        }
        if (fd->cq) {
-               if (fd->cq->comps)
-                       vfree(fd->cq->comps);
+               vfree(fd->cq->comps);
                kfree(fd->cq);
                fd->cq = NULL;
        }
@@ -945,8 +942,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
                        unsigned pageidx, len;
 
                        base = (unsigned long)iovec->iov.iov_base;
-                       offset = ((base + iovec->offset + iov_offset) &
-                                 ~PAGE_MASK);
+                       offset = offset_in_page(base + iovec->offset +
+                                               iov_offset);
                        pageidx = (((iovec->offset + iov_offset +
                                     base) - (base & PAGE_MASK)) >> PAGE_SHIFT);
                        len = offset + req->info.fragsize > PAGE_SIZE ?