summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/hfi1/user_exp_rcv.h
diff options
context:
space:
mode:
authorHarish Chegondi <harish.chegondi@intel.com>2017-08-22 04:27:16 +0300
committerDoug Ledford <dledford@redhat.com>2017-08-29 02:12:21 +0300
commitddd3affb50015c3c7ee218b83e73e646aa48e212 (patch)
treeb421c8029bc7580c193d0d21c6acf2c8f96e6bd7 /drivers/infiniband/hw/hfi1/user_exp_rcv.h
parent04a646df12766e4e11ecf09cd0336dab69d75034 (diff)
downloadlinux-ddd3affb50015c3c7ee218b83e73e646aa48e212.tar.xz
IB/hfi1: Remove duplicate definitions of num_user_pages() function
num_user_pages() function has been defined in both user_exp_rcv.c file and user_sdma.c file. Move the function definition to a header file so there is only one definition in the source repo. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/user_exp_rcv.h')
-rw-r--r--drivers/infiniband/hw/hfi1/user_exp_rcv.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.h b/drivers/infiniband/hw/hfi1/user_exp_rcv.h
index 8c4eb5d8547e..7461d11b01c4 100644
--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.h
+++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.h
@@ -60,6 +60,15 @@ struct tid_user_buf {
unsigned int n_psets;
};
+static inline int num_user_pages(unsigned long addr,
+ unsigned long len)
+{
+ const unsigned long spage = addr & PAGE_MASK;
+ const unsigned long epage = (addr + len - 1) & PAGE_MASK;
+
+ return 1 + ((epage - spage) >> PAGE_SHIFT);
+}
+
int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd,
struct hfi1_ctxtdata *uctxt);
void hfi1_user_exp_rcv_free(struct hfi1_filedata *fd);