Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26077182rwd; Mon, 3 Jul 2023 05:16:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdDB6i/hDPfUATP4+cPLzF+ha1S7k+RTLSHUFr0QPpnUgVbq6ylFUku7e/FxEB8NDj/zh2 X-Received: by 2002:a17:902:7b84:b0:1ac:6d4c:c24b with SMTP id w4-20020a1709027b8400b001ac6d4cc24bmr5535152pll.3.1688386586855; Mon, 03 Jul 2023 05:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688386586; cv=none; d=google.com; s=arc-20160816; b=i0d26t4dGswXUs44uqOLIDN47e8KsO1SbDzmtUshFsQRmj+x80gg8AixzTvqbtYn87 k8cbEpc1fg4RCpQhKW+1c3hCSDzkEJUZUKOoC+lX0OjEJMb5SPPqzQ30wt6BbZRCyPJr AmlaxIfAxD0tbRhlxPWESs4gM/KVAh6/n57+TGfwiVKI5kTYVDyzRTRi3dcKzkxuPHTN IqyU2OdBLox6iLz7FfUFvV4eUSDYSg3ya+j9PpTQkvmrlvVnS/PXXx2jS6CJhPw2Va30 v1WN0wIJDeebu949QBE3A3DEE8aOG0gcdPM1E4yrnQfmrLVs5X3SERKHjIpaHypfmEVJ Ec5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vsF7dxNWZ/h0hsROwWQ3jmFbSIWa0lMnAv0xbgHzo6U=; fh=EPNhkGbzFoPF+ETkI7S08Y0Ehxi2hPqg2iB/Dw5xEhw=; b=C5Q5y1mBsxuaOCH1OvKLojhHRtFXqZnCLpLUKynbQnV8QBOSclJBz7lTB00YLX0NwP MQa4p3BhHB67xjMknypfEV+KLYeLsjBFIzWFKDBaWUusF4bV4Q4iVL8Tyfnahnn0DWbd tokuV9mtGkI0OX+5/aheFg1LK5o4k8hfEAsC36F1vIUEI8VreC5SPXMwn6Al+R/8aLhM nU7kPOPZUlZ0+1H/esVHiLUW37tHZKnj+NzZig14LcYo+z8b4LZcZeHBrHtT1k0v/gYu eje14cI66RzvjgW/kLdxHGMLJSp8etbXHbpaiXVP014arN9Q4zKXj6KWi0FCRTiQoPlo kt3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sELuPoj7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a170902e5d100b001b87b17cfb4si6477825plf.392.2023.07.03.05.16.12; Mon, 03 Jul 2023 05:16:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sELuPoj7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbjGCLao (ORCPT + 99 others); Mon, 3 Jul 2023 07:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbjGCLan (ORCPT ); Mon, 3 Jul 2023 07:30:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98B64E59; Mon, 3 Jul 2023 04:30:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2462E60EA2; Mon, 3 Jul 2023 11:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11974C433C7; Mon, 3 Jul 2023 11:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688383835; bh=fnwln6CemjKCbAI2pkk0HZ5h53bpzKYZ/+yqxY7jdyQ=; h=From:To:Cc:Subject:Date:From; b=sELuPoj7mXoP4GnvJwiI+sewkmpy+2EIT/+iXHfI64WaqMa+pL1k8yLHKBFU11NSk 8GGNwbQfDWg4YYHcHSoIoY86NFgqOG8k2NBEzIiJDQGqF1Xfsoaqj2CjyycF8xbdFV c+A6AsAgO3leH2yLXGKoVYtYVgomIyeq+D5WUF3vUf/cnh+hBYjw2E40109lrVuH6E q+o4X/WoKCbH7Sduba3ZCgv9D0XgGKgt/ZN9vD0viumNWaXfkE8H+Uu2ehkZLKgxGm 9qB+BEqiMxmcx4N/dFvodx7cYXJVzxm1o5VZh3zFjGS/sqihPbvXLHQS7/CUmIfXrk aRjghhFRwdyFw== From: Arnd Bergmann To: Jason Gunthorpe , Leon Romanovsky , Selvin Xavier Cc: Arnd Bergmann , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] RDMA: fix INFINIBAND_USER_ACCESS dependency Date: Mon, 3 Jul 2023 13:30:06 +0200 Message-Id: <20230703113025.356682-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann After a change to the bnxt_re driver, it fails to link when CONFIG_INFINIBAND_USER_ACCESS is disabled: aarch64-linux-ld: drivers/infiniband/hw/bnxt_re/ib_verbs.o: in function `bnxt_re_handler_BNXT_RE_METHOD_ALLOC_PAGE': ib_verbs.c:(.text+0xd64): undefined reference to `ib_uverbs_get_ucontext_file' aarch64-linux-ld: drivers/infiniband/hw/bnxt_re/ib_verbs.o:(.rodata+0x168): undefined reference to `uverbs_idr_class' aarch64-linux-ld: drivers/infiniband/hw/bnxt_re/ib_verbs.o:(.rodata+0x1a8): undefined reference to `uverbs_destroy_def_handler' The problem is that the 'bnxt_re_uapi_defs' structure is built unconditionally and references a couple of functions that are never really called in this configuration but instead require other functions that are left out. Adding an #ifdef around the new code, or a Kconfig dependency would address this problem, but adding the compile-time check inside of the UAPI_DEF_CHAIN_OBJ_TREE_NAMED() macro seems best because that also addresses the problem in other drivers that may run into the same dependency. Fixes: 360da60d6c6ed ("RDMA/bnxt_re: Enable low latency push") Signed-off-by: Arnd Bergmann --- include/rdma/uverbs_ioctl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h index 9d45a5b203169..06287de69cd29 100644 --- a/include/rdma/uverbs_ioctl.h +++ b/include/rdma/uverbs_ioctl.h @@ -436,8 +436,10 @@ struct uapi_definition { }, \ ##__VA_ARGS__ #define UAPI_DEF_CHAIN_OBJ_TREE_NAMED(_object_enum, ...) \ - UAPI_DEF_CHAIN_OBJ_TREE(_object_enum, &UVERBS_OBJECT(_object_enum), \ - ##__VA_ARGS__) + UAPI_DEF_CHAIN_OBJ_TREE(_object_enum, \ + PTR_IF(IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS), \ + &UVERBS_OBJECT(_object_enum)), \ + ##__VA_ARGS__) /* * ======================================= -- 2.39.2