IB/core: Fix build failure without hugepages
authorArnd Bergmann <arnd@arndb.de>
Thu, 9 Jan 2020 08:47:30 +0000 (09:47 +0100)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 9 Jan 2020 15:59:56 +0000 (11:59 -0400)
HPAGE_SHIFT is only defined on architectures that support hugepages:

drivers/infiniband/core/umem_odp.c: In function 'ib_umem_odp_get':
drivers/infiniband/core/umem_odp.c:245:26: error: 'HPAGE_SHIFT' undeclared (first use in this function); did you mean 'PAGE_SHIFT'?

Enclose this in an #ifdef.

Fixes: 9ff1b6466a29 ("IB/core: Fix ODP with IB_ACCESS_HUGETLB handling")
Link: https://lore.kernel.org/r/20200109084740.2872079-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/umem_odp.c

index f42fa31c24a29a34e83a6a985e068d0acc407da5..b9baf7d0a5cb79cc8bea7397e22e75fb49d5fb89 100644 (file)
@@ -241,10 +241,11 @@ struct ib_umem_odp *ib_umem_odp_get(struct ib_udata *udata, unsigned long addr,
        umem_odp->umem.owning_mm = mm = current->mm;
        umem_odp->notifier.ops = ops;
 
+       umem_odp->page_shift = PAGE_SHIFT;
+#ifdef CONFIG_HUGETLB_PAGE
        if (access & IB_ACCESS_HUGETLB)
                umem_odp->page_shift = HPAGE_SHIFT;
-       else
-               umem_odp->page_shift = PAGE_SHIFT;
+#endif
 
        umem_odp->tgid = get_task_pid(current->group_leader, PIDTYPE_PID);
        ret = ib_init_umem_odp(umem_odp, ops);