From patchwork Tue Jul 25 08:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 125426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2328002vqg; Tue, 25 Jul 2023 01:46:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlEJXJxkjblF1/qxKQTX3ezwsBCe++KhYHn1l5jzgBzdjV4e6PtM8BVqvArII1vPuRqpBku0 X-Received: by 2002:aa7:dcc6:0:b0:51d:8a68:ed33 with SMTP id w6-20020aa7dcc6000000b0051d8a68ed33mr12005454edu.30.1690274818245; Tue, 25 Jul 2023 01:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690274818; cv=none; d=google.com; s=arc-20160816; b=UruegtM2rBZ5vPjhsNf5i+mF0Lghn/E6cnWVMe0pZ4vVPFx3XopEWsu1cEnffA1NWW VB02EQm7vh1gSrMS8nIPbdEve4DxhcSjOGp6PCZJob03nGCLc+JL5Ymb6ZVy9tKgP3Ev a12AI+sN+V+bfbjHl/6IEcKSRCpJs+2y1tULGS+/B/qqSzoI1hXMsGTvTZkV1I8I2n6P ZK6JALH3NBIvYOi9WT7xoK1LamVWhyUKf55GCC6bxdaPC1gmpf4EpneqwVydjWwSGisR RwXgnVwz8E+10N9HrKfqyOeMJoA9Ry0RFi2CwKC5UjWdnCCR54XzmP/MRzudTkZ/LoSk dthg== 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=5mcf0ahs7C3jlYvuTNnKIZqD5W2DBWWLbMfRTqMlbY0=; fh=LdwDO6zw56jz2keTHDdbqRQNfhUqyJgZZdXJg/aeHvw=; b=B65ymqKPh8jqFRCYNK69WxQNiZO9vtknF37qFx68RkAbQlRns4D9Kf0/FDt6+dA+QV zfhXGTgoZVHno/pVHNAwyPFkmYwmjuzfKWTF0W1n7740ibnExS//6I+zlTYWVSpUCQFw 6BVL7KZVSO1ZZ7ujdAKc8DeV2SO+vMm6cP2wCDoifkSwOQCxBy9V/dP5lxBXhHk2tMHL 2kEn/wIWpbApueOvt+cyQIUt12vxObVryqlaQSyoab4c58PfVitxoiyyoZeNh2r1y9PT JXJcMgHQeGN6BoX1ISFpG4gB3Tvnjn83hokGpOjPJmk7M0G2jLnH7/qiPWqypjw8xHIp k3cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aS2106RD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020aa7d816000000b00521d850674asi8053571edq.642.2023.07.25.01.46.34; Tue, 25 Jul 2023 01:46:58 -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=aS2106RD; 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 S230235AbjGYIZ5 (ORCPT + 99 others); Tue, 25 Jul 2023 04:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjGYIZz (ORCPT ); Tue, 25 Jul 2023 04:25:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F414110C3 for ; Tue, 25 Jul 2023 01:25:53 -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 93202612CA for ; Tue, 25 Jul 2023 08:25:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E56CAC433C8; Tue, 25 Jul 2023 08:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690273553; bh=Iof1axqYShcjdJEBrXSEXTcXQvW68qKtfXewR3ze5aA=; h=From:To:Cc:Subject:Date:From; b=aS2106RDUiv81n+nUOxmB6E8asyvO3h2LfYIoo7EHM0nGqZY7t7bc6uphDFcDVTsN 3ozU3RWeD45SzJ3ke/lR0Pj28cinVYLbCrjZx8/CmQh37yCzN31p8jyyQIdwhY4tCH CRUHfotD0ZPiF0ZyXrPiTM2L6AxzyrZHHkdTGEjTXWt2/p1AYuccHwqrGZQoqPMspq x7UbkJW6zhk+XKNRr9pu335KO4u/MX4/JXAnAJ1DPv5cJqLrqoDATkO4z18ruSTO/S vk/vNTKUb1ntADS8pxj6oyysRQglKIG1LeIuFctluGuJBCxJMXDJYo94RH2wDTfFP7 M5zAVOA6vg+sw== From: Arnd Bergmann To: Luis Chamberlain Cc: Arnd Bergmann , Rong Tao , Petr Mladek , Masami Hiramatsu , Andrew Morton , Will Deacon , Quentin Perret , linux-kernel@vger.kernel.org Subject: [PATCH] samples/hw_breakpoint: fix building without module unloading Date: Tue, 25 Jul 2023 10:25:36 +0200 Message-Id: <20230725082546.941346-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772381607663357790 X-GMAIL-MSGID: 1772381607663357790 From: Arnd Bergmann __symbol_put() is really meant as an internal helper and is not available when module unloading is disabled, unlike the previously used symbol_put(): samples/hw_breakpoint/data_breakpoint.c: In function 'hw_break_module_exit': samples/hw_breakpoint/data_breakpoint.c:73:9: error: implicit declaration of function '__symbol_put'; did you mean '__symbol_get'? [-Werror=implicit-function-declaration] The hw_break_module_exit() function is not actually used when module unloading is disabled, but it still causes the build failure for an undefined identifier. Enclose this one call in an appropriate #ifdef to clarify what the requirement is. Leaving out the entire exit function would also work but feels less clar in this case. Fixes: 910e230d5f1bb ("samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'") Fixes: d8a84d33a4954 ("samples/hw_breakpoint: drop use of kallsyms_lookup_name()") Signed-off-by: Arnd Bergmann Reviewed-by: Petr Mladek --- samples/hw_breakpoint/data_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/hw_breakpoint/data_breakpoint.c b/samples/hw_breakpoint/data_breakpoint.c index 9debd128b2ab8..b99322f188e59 100644 --- a/samples/hw_breakpoint/data_breakpoint.c +++ b/samples/hw_breakpoint/data_breakpoint.c @@ -70,7 +70,9 @@ static int __init hw_break_module_init(void) static void __exit hw_break_module_exit(void) { unregister_wide_hw_breakpoint(sample_hbp); +#ifdef CONFIG_MODULE_UNLOAD __symbol_put(ksym_name); +#endif printk(KERN_INFO "HW Breakpoint for %s write uninstalled\n", ksym_name); }