Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4279125rwo; Tue, 25 Jul 2023 03:46:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlEVa/A0hpXWBleSwtLKhhJWjrlR7zRFvJvmFgl+3Mt6iEfZRpuW3ouowUh5vnFu93rV+Pf+ X-Received: by 2002:a05:6358:c16:b0:135:253d:e994 with SMTP id f22-20020a0563580c1600b00135253de994mr9991163rwj.29.1690281994438; Tue, 25 Jul 2023 03:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690281994; cv=none; d=google.com; s=arc-20160816; b=zphIADSPEgQp7XojQZWywaQ67MtzNZuxqwRPgeoQj42PaKGdCr9M+NYUv0FEZqkx4B 1RrNaeFdO0EJzrbtV+Fb7j5N9kEGIEYQq8nfs7DbUbDx3XWSFVm7TUKoHwdJUGL4awdV ldBDXXbnhWxzh7Zrz6BUqrzLxgaa5Kn6tgsWjvswMf7BzFi2o++g04H23a69jkNBnJ+P aUBSlVD/Fxus9a+KH5ZJfwmJt7XxOkePkN4KG+dg9waPdK+Rwu1Rz3zrHLsXKXGks5d7 SMlt1PVvWTAf86r9LQSej3bpsrC0I0cyZFgv6ZkwAYpXj9mkd/AkgL4IKkObsJQxY1/G AgzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M/fb9U4sUdPHFWFNYTFOglXTMUSDaspUuygCKmGisj8=; fh=XOxY58dcIJfHD0e1u3pF5avIntN2t+9TH1iIfFmorDA=; b=NNwJDEYH3ZTFknFXSiUvxvJ84VwsjWxRKEMcUDFVJRt9V5jU+8E815hXR9GkpJThFr XWvipEguO7tBHXZ+Di1V5/exd3MCaXb4oGLu0tycATxFYoWP8ObVxBn67oO6ljY2PEs5 Kv3Z10znTUaesZVk5VAVRIXXL8l9gkXW+R4yQcUA6gwh4AU4AAIqW4i2A2iDni6BOe5i /JrDTROYmI1C0KpmFaDsT+jj64/EdRMtTtbSpAod0e4XaGmxaCS665WS4jUOYSGQUdeO L52R6g3qI4MLEL47pFZNmGuabfcDWqweG4u6XwO5owyePOw6L9JQZE++CZlIrAg1rIMr LUXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=qoB5We5J; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63dc01000000b0053490e8df50si11465138pgg.223.2023.07.25.03.46.21; Tue, 25 Jul 2023 03:46:34 -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=@suse.com header.s=susede1 header.b=qoB5We5J; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233517AbjGYJj4 (ORCPT + 99 others); Tue, 25 Jul 2023 05:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233511AbjGYJji (ORCPT ); Tue, 25 Jul 2023 05:39:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 038C81BD8 for ; Tue, 25 Jul 2023 02:39:07 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7F6C4222A9; Tue, 25 Jul 2023 09:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1690277929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=M/fb9U4sUdPHFWFNYTFOglXTMUSDaspUuygCKmGisj8=; b=qoB5We5Jr4OyHZbxtGAByAR98cifEkZosUxgoW5JskM3d3ppepRGNhU6Q2+xV/ueAWdxDk IdMy6em0/BRbKRojw/dLTYz1LpqM2VuXw0xIPDmvWqKlFSr7H3eqbGGsTswGq5mhiomdtr BgsjIjiXNHbghHePQzLuvZiLVZSfxoI= Received: from suse.cz (dhcp108.suse.cz [10.100.51.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7FFB92C142; Tue, 25 Jul 2023 09:38:46 +0000 (UTC) Date: Tue, 25 Jul 2023 11:38:48 +0200 From: Petr Mladek To: Arnd Bergmann Cc: Luis Chamberlain , Arnd Bergmann , Rong Tao , Masami Hiramatsu , Andrew Morton , Will Deacon , Quentin Perret , linux-kernel@vger.kernel.org Subject: Re: [PATCH] samples/hw_breakpoint: fix building without module unloading Message-ID: References: <20230725082546.941346-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725082546.941346-1-arnd@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue 2023-07-25 10:25:36, Arnd Bergmann wrote: > 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(): Ah, I have missed this. > 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. > --- 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); > } I see that both symbol_put() and symbol_put_addr() are defined as noops twice: + when !defined(CONFIG_MODULE_UNLOAD) + when !defined(CONFIG_MODULES) This patch is enough because samples/hw_breakpoint/data_breakpoint.c could be built only as a module, so feel free to use: Reviewed-by: Petr Mladek But even better solution would be to define symbol_put_name() as a noop in both situations and use it. Best Regards, Petr