From patchwork Tue Sep 7 13:46:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 507559 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp4243646jai; Tue, 7 Sep 2021 06:46:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFmgVLpeaIaMu3udoNIlw0M9ShY+t9C8QYQi+Hk+hH8Cdw/Gqq5hURvXEAgmam5zge/AiI X-Received: by 2002:a92:cc01:: with SMTP id s1mr11986298ilp.15.1631022383776; Tue, 07 Sep 2021 06:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631022383; cv=none; d=google.com; s=arc-20160816; b=fR59PiX1HsaIkZHnWDLtSOG56WykxnoFZA27U9kdl8IsaMP63nkD+IsiqQ4FaicHzf 31+tXC9dSqVuvNd+JJXrRQyHhIQyFYIah3dY59+AL7jMRc4jzKpXr1SOrVY+eGYrtjV9 VFlq1pxEj+cLDOsCajYXzXrpswuHq+Ya7ot1+VxAs8jJ/TI3eGKPIdFHZBt+UYae8pWh NLL7P30RHPb0HIcH13qNpK0Z1wkJxSwte0EY7z/mreo3fVlewD9D6xzgwSA5zRmp04DI EeIQir7N5Q0wnSMpvvDSuU2WobFlKMigbMHI7TpAu6EAvEOjRd1mfxH2eenFBu61f838 CO3Q== 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=LL8hNB7vMtBhYw1BDDVm+pi8//Asl0rDu9LruOUAhH8=; b=b4f5rDFBkforUf/Yj5GjgcFvmfLrClh5fVfZLiwub9d/YC+JV3WL20WDzbIXwHRYwJ GQgPaZwEuVB8VX4nTGI5/jvp/oS8xnr0UMeInFj9IM5lZc7T8e5zBD23VB7UQUiHUd/r XZM+TnqE/pPwm6yBIpI8O5zcX+TfEsjAGLdLm4bMRBEtxLetYYXvT6NZK4pY9qLm7RdK OjoFELI2/CeyuzfXWe9FQ+jjlf3ciW14paHW6u3ZkWFPyGDjhXho7lJerd7uFkZH+WrR O8DkVNOIQbJUjMQOAUJunbjALLZkj4lJ5ae7bFZzzRFZMA8B/c2SjYYei6nsoRqVwFsu Tx2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uXw0xE+Y; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s63si9209406jaa.30.2021.09.07.06.46.23; Tue, 07 Sep 2021 06:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uXw0xE+Y; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1344866AbhIGNr2 (ORCPT + 8 others); Tue, 7 Sep 2021 09:47:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:44266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234939AbhIGNr1 (ORCPT ); Tue, 7 Sep 2021 09:47:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABB486105A; Tue, 7 Sep 2021 13:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631022381; bh=QFljL/tXuu3N1HI7DOzEzMpmHJdD1GvVQpEJe3tl4BI=; h=From:To:Cc:Subject:Date:From; b=uXw0xE+YiqviXG3ON0sQof9GpahLt7A+0ifjYfc/M9rz2+9mQp9G2fcYoUCjmC/nY xcmQLEBFJcHUW1OQws6kVUUXgPnTS+nyeGUac3XQV/uRsF2EW7GlXxcnQgAgrVvJmt SBV4mordirP1EONwm8LGbRsvtFmH+HxUEtEnBdWrVWxdQgU4nm3ZCNscXYNECAW95Y /uaFemB7NyDrPwUSz6+x9+taKyMhkJkZhJtxK+EnVqLtYsHz6zPyeEMHCIqP2Wyu4Z ZX9ggHUmQJ2EnD9+iErF6aSioF/1vAbSZmMSQz5jb+uXF3oXU9Iv0SSAF6yWfv9shz QhF4iaYxsB9DQ== From: Arnd Bergmann To: "David S. Miller" , Jakub Kicinski , Arnd Bergmann Cc: Geert Uytterhoeven , Armin Wolf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] ne2000: fix unused function warning Date: Tue, 7 Sep 2021 15:46:10 +0200 Message-Id: <20210907134617.185601-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann Geert noticed a warning on MIPS TX49xx, Atari and presuambly other platforms when the driver is built-in but NETDEV_LEGACY_INIT is disabled: drivers/net/ethernet/8390/ne.c:909:20: warning: ‘ne_add_devices’ defined but not used [-Wunused-function] Merge the two module init functions into a single one with an IS_ENABLED() check to replace the incorrect #ifdef. Fixes: 4228c3942821 ("make legacy ISA probe optional") Reported-by: Geert Uytterhoeven Signed-off-by: Arnd Bergmann --- v2: do a larger rework to avoid introducing a different build error --- drivers/net/ethernet/8390/ne.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) -- 2.29.2 Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c index 53660bc8d6ff..9afc712f5948 100644 --- a/drivers/net/ethernet/8390/ne.c +++ b/drivers/net/ethernet/8390/ne.c @@ -922,13 +922,16 @@ static void __init ne_add_devices(void) } } -#ifdef MODULE static int __init ne_init(void) { int retval; - ne_add_devices(); + + if (IS_MODULE(CONFIG_NE2000)) + ne_add_devices(); + retval = platform_driver_probe(&ne_driver, ne_drv_probe); - if (retval) { + + if (IS_MODULE(CONFIG_NE2000) && retval) { if (io[0] == 0) pr_notice("ne.c: You must supply \"io=0xNNN\"" " value(s) for ISA cards.\n"); @@ -941,18 +944,8 @@ static int __init ne_init(void) return retval; } module_init(ne_init); -#else /* MODULE */ -static int __init ne_init(void) -{ - int retval = platform_driver_probe(&ne_driver, ne_drv_probe); - - /* Unregister unused platform_devices. */ - ne_loop_rm_unreg(0); - return retval; -} -module_init(ne_init); -#ifdef CONFIG_NETDEV_LEGACY_INIT +#if !defined(MODULE) && defined(CONFIG_NETDEV_LEGACY_INIT) struct net_device * __init ne_probe(int unit) { int this_dev; @@ -994,7 +987,6 @@ struct net_device * __init ne_probe(int unit) return ERR_PTR(-ENODEV); } #endif -#endif /* MODULE */ static void __exit ne_exit(void) {