From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6B1AC433DF for ; Sun, 5 Jul 2020 09:56:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E67620772 for ; Sun, 5 Jul 2020 09:56:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="kokH5V2P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727017AbgGEJ4I (ORCPT ); Sun, 5 Jul 2020 05:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbgGEJ4H (ORCPT ); Sun, 5 Jul 2020 05:56:07 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5EFEC061794 for ; Sun, 5 Jul 2020 02:56:06 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id f18so29540687wrs.0 for ; Sun, 05 Jul 2020 02:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvvmotkcreCkunyFDHoCINthVwki6Zcg3uI33EtJQCo=; b=kokH5V2PsQ38hABOU5WOwvp71zv0WLZGiVYknksqrcmFy4auI7pPbUtTQ2xqp61+RM CbhwuQmLcnWlxEkAsDP8wtkijf8dyqQXjXY+gSr5mB4FMIXQauYCrs7Dc8LDT+V0AWX4 WragB8E8mLg1WdEpuHlJWnsc89cGq3pej5vLN14QjwbBJxH9IErfBGcJC5OxeqMQLLjI yos6GkiyP8glsvIwN+Q0+US7qAerIjetGDdmlfphbOCoc8Wl7B3FKNnQ50JxMZSih9cK tiQDMJku7/jP6IZDxDRO1TUdEKSRf+MazDoMCX6tiqLxOBHitaHYYc94JMJUNz8c7o0s X25Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvvmotkcreCkunyFDHoCINthVwki6Zcg3uI33EtJQCo=; b=f7jEK5ZAjxlua39Md31Bvo4ZCLN33c7oZQaW60zQY646+b0FUGOtRxCgHo9W5nyhzY 6E46aiznlIJcuYPFUvWUZ1yap9Bt91r/ocWwDMYh5DSKQ2mOZ7pNpatIJkTF4crPFcmg jCVMogJfTzzRp/Nz0uUWaZf+z6PMoS6dAXJlMZnHj/Twue69A56+aq9MWQhLNGE3tw1N 48LShXcpXsSRARAtSMG3ZXkKefaVV8dx3boNmMgrkkROsqRNMINnssjZVi00/N5cXVi3 2MQ+NPO6n/qYINVK90pnPf8IfKYVYty6xyyvNrYZgB7p7NN0LfgiQeewRR7SUmULV7+C aefQ== X-Gm-Message-State: AOAM530Dx093W1uKyi7O7WarkJ1J177AXX2M1njAemBwd64eY8S93SV2 AdFmuMHk/PCcZVy7dg0SYVakeg== X-Google-Smtp-Source: ABdhPJx0eClwan21mf6twIBb6IiwAabsnV88Z3hj0O9AMB0NM4BXoawQf3Jxc24R1IvFY74V/I/UMw== X-Received: by 2002:a5d:4dc2:: with SMTP id f2mr44802365wru.399.1593942965475; Sun, 05 Jul 2020 02:56:05 -0700 (PDT) Received: from debian-brgl.home (lfbn-nic-1-68-20.w2-15.abo.wanadoo.fr. [2.15.159.20]) by smtp.gmail.com with ESMTPSA id d28sm21106192wrc.50.2020.07.05.02.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 02:56:04 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , kernel test robot Subject: [PATCH net-next] net: phy: add a Kconfig option for mdio_devres Date: Sun, 5 Jul 2020 11:55:47 +0200 Message-Id: <20200705095547.22527-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski If phylib is built as a module and CONFIG_MDIO_DEVICE is 'y', the mdio_device and mdio_bus code will be in the phylib module, not in the kernel image. Meanwhile we build mdio_devres depending on the CONFIG_MDIO_DEVICE symbol, so if it's 'y', it will go into the kernel and we'll hit the following linker error: ld: drivers/net/phy/mdio_devres.o: in function `devm_mdiobus_alloc_size': >> drivers/net/phy/mdio_devres.c:38: undefined reference to `mdiobus_alloc_size' ld: drivers/net/phy/mdio_devres.o: in function `devm_mdiobus_free': >> drivers/net/phy/mdio_devres.c:16: undefined reference to `mdiobus_free' ld: drivers/net/phy/mdio_devres.o: in function `__devm_mdiobus_register': >> drivers/net/phy/mdio_devres.c:87: undefined reference to `__mdiobus_register' ld: drivers/net/phy/mdio_devres.o: in function `devm_mdiobus_unregister': >> drivers/net/phy/mdio_devres.c:53: undefined reference to `mdiobus_unregister' ld: drivers/net/phy/mdio_devres.o: in function `devm_of_mdiobus_register': >> drivers/net/phy/mdio_devres.c:120: undefined reference to `of_mdiobus_register' Add a hidden Kconfig option for MDIO_DEVRES which will be currently selected by CONFIG_PHYLIB as there are no non-phylib users of these helpers. Reported-by: kernel test robot Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/Kconfig | 4 ++++ drivers/net/phy/Makefile | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index e351d65533aa..7ffa8a4529a8 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -21,6 +21,9 @@ config MDIO_BUS if MDIO_BUS +config MDIO_DEVRES + tristate + config MDIO_ASPEED tristate "ASPEED MDIO bus controller" depends on ARCH_ASPEED || COMPILE_TEST @@ -252,6 +255,7 @@ menuconfig PHYLIB tristate "PHY Device support and infrastructure" depends on NETDEVICES select MDIO_DEVICE + select MDIO_DEVRES help Ethernet controllers are usually attached to PHY devices. This option provides infrastructure for diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index c9a9adf194d5..d84bab489a53 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -4,7 +4,6 @@ libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \ linkmode.o mdio-bus-y += mdio_bus.o mdio_device.o -mdio-devres-y += mdio_devres.o ifdef CONFIG_MDIO_DEVICE obj-y += mdio-boardinfo.o @@ -18,7 +17,7 @@ libphy-y += $(mdio-bus-y) else obj-$(CONFIG_MDIO_DEVICE) += mdio-bus.o endif -obj-$(CONFIG_MDIO_DEVICE) += mdio-devres.o +obj-$(CONFIG_MDIO_DEVRES) += mdio_devres.o libphy-$(CONFIG_SWPHY) += swphy.o libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_led_triggers.o -- 2.26.1