Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2407366rwb; Sat, 19 Nov 2022 15:38:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf65pj7E3ZRT3sl/aFhN/XOcjz+C6r1BaZLTKeBXsv9Mh3BGO53Y2i8RYwnoN6i5yUuewewE X-Received: by 2002:a17:907:2b15:b0:78d:51c0:d4d1 with SMTP id gc21-20020a1709072b1500b0078d51c0d4d1mr10558297ejc.161.1668901134196; Sat, 19 Nov 2022 15:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668901134; cv=none; d=google.com; s=arc-20160816; b=sBMvkfSkXhq2OGhNg8r80JXvmqBZSTqaHLptV/icaQP0rVG0UGMGLxU0QDoQiyuAn9 fyVSuLyee1L6txobtr3fYsr06J2YaQrrPh1n2MpdBi0VWBYi8TEbgHK0D+Pci0XUoRZH 5MOnof5gEgNjTg48gWTtBYRw90Qfb99Yf/PczhNfKryBfwsQDLfdVi/5g58laGV6X+1Y 0I4/mokz0Poup0dRcQz6L+uCZ98ao1GafEzEQ2mDNcL6wj3iY7LEEFWBWNXiukFdqmjJ 0kRWLJ29piSSWPaKuHWs2dzQ0gkOv/GWT6hudgoBR0BHouGytjFuosVj7wAsutZ7FW8H UUMg== 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 :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=wNP0UQpU7yrDZr4V2xlMMmH7hWXhkAKdC5HFrg14b2U=; b=wmLjC9kUeSBX1+nH0Yc0cD9S2TFguN/T65TQnOr64+gvs//nfjJEomPhdXDSFQ8g1v PoN1D4ihMwGSZfh5EWXn3txq4mtyZYxJHd94NE/Nvagg8YxsEaiKMcDaz9wndT1t6kNo fBhsMQM7GZ6ReYruCK5j4trKB5lc0RtYU9sOIyA3RTPGVqSB4N2LgSC7qUpuxYo1CLSD pggDxxWznFnxPElCzyJn9CTuOrv7gB581DaScU1jyp0Cy0nT9Dc7P9SbNZCBUFlMGoar aerO33kOwNYt6SohoSndO2RAr1mDoK4wTVDNRLzcreZiE7t5nACOD8xGXtr9tp50s3iz UMKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=TdhooLtY; 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=pm.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd5-20020a170907628500b007ae127fa284si7234619ejc.371.2022.11.19.15.38.31; Sat, 19 Nov 2022 15:38:54 -0800 (PST) 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=@pm.me header.s=protonmail3 header.b=TdhooLtY; 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=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235305AbiKSXKO (ORCPT + 91 others); Sat, 19 Nov 2022 18:10:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235377AbiKSXJ6 (ORCPT ); Sat, 19 Nov 2022 18:09:58 -0500 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47528101FC; Sat, 19 Nov 2022 15:09:57 -0800 (PST) Date: Sat, 19 Nov 2022 23:09:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1668899395; x=1669158595; bh=wNP0UQpU7yrDZr4V2xlMMmH7hWXhkAKdC5HFrg14b2U=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=TdhooLtYMTOiXSgX6a8vur7U8YSfc54R+aNkyLrZOxGhW9ZmtfU2kNxaQOmVntH5M RaFWicXh4WLlwJG9nmjBzB2F0cFaqn8BIIKyCUGv/leCqern8weFAm0prQk5TEMji/ qpwLjthLgEeDPTus9GXPDGf+Mz2eE4Q32y5S6KxXvsSHmjn2i34UjgegVmBRo5B7mu V9IvBd9WD/RDTR7XV8B121h4KfQI/Zqlx1h6izDtKhhhgoO6NH6aEgbxDLUQt0kEOB 7fuYsxpgTk8poLjQMJnSY0wit5xC1Lc+taQrCH6InXHhoJocSMB4GKTeMAbUZSAozo jTSk3B04DZlXg== To: linux-kbuild@vger.kernel.org From: Alexander Lobakin Cc: Alexander Lobakin , Masahiro Yamada , Nicolas Schier , Jens Axboe , Boris Brezillon , Borislav Petkov , Tony Luck , Miquel Raynal , Vladimir Oltean , Alexandre Belloni , Derek Chickles , Ioana Ciornei , Salil Mehta , Sunil Goutham , Grygorii Strashko , Daniel Scally , Hans de Goede , Mark Brown , Andy Shevchenko , NXP Linux Team , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/18] net: dpaa2: fix mixed module-builtin object Message-ID: <20221119225650.1044591-16-alobakin@pm.me> In-Reply-To: <20221119225650.1044591-1-alobakin@pm.me> References: <20221119225650.1044591-1-alobakin@pm.me> Feedback-ID: 22809121:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 With CONFIG_FSL_DPAA2_ETH=3Dm and CONFIG_FSL_DPAA2_SWITCH=3Dy (or vice versa), dpaa2-mac.o and dpmac.o are linked to a module and also to vmlinux even though the expected CFLAGS are different between builtins and modules. This is the same situation as fixed by commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects"). There's also no need to duplicate relatively big piece of object code into two modules. Introduce the new module, fsl-dpaa2-mac, to provide the common functions to both fsl-dpaa2-eth and fsl-dpaa2-switch. Misc: constify and shrink @dpaa2_mac_ethtool_stats while at it. Fixes: 84cba72956fd ("dpaa2-switch: integrate the MAC endpoint support") Suggested-by: Masahiro Yamada Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/freescale/dpaa2/Kconfig | 6 ++++++ drivers/net/ethernet/freescale/dpaa2/Makefile | 6 ++++-- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 ++ drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 15 ++++++++++++++- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 2 ++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/Kconfig b/drivers/net/eth= ernet/freescale/dpaa2/Kconfig index d029b69c3f18..54c388f25c43 100644 --- a/drivers/net/ethernet/freescale/dpaa2/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa2/Kconfig @@ -1,7 +1,12 @@ # SPDX-License-Identifier: GPL-2.0-only + +config FSL_DPAA2_MAC +=09tristate + config FSL_DPAA2_ETH =09tristate "Freescale DPAA2 Ethernet" =09depends on FSL_MC_BUS && FSL_MC_DPIO +=09select FSL_DPAA2_MAC =09select PHYLINK =09select PCS_LYNX =09select FSL_XGMAC_MDIO @@ -34,6 +39,7 @@ config FSL_DPAA2_SWITCH =09tristate "Freescale DPAA2 Ethernet Switch" =09depends on BRIDGE || BRIDGE=3Dn =09depends on NET_SWITCHDEV +=09select FSL_DPAA2_MAC =09help =09 Driver for Freescale DPAA2 Ethernet Switch. This driver manages =09 switch objects discovered on the Freeescale MC bus. diff --git a/drivers/net/ethernet/freescale/dpaa2/Makefile b/drivers/net/et= hernet/freescale/dpaa2/Makefile index 3d9842af7f10..9dbe2273c9a1 100644 --- a/drivers/net/ethernet/freescale/dpaa2/Makefile +++ b/drivers/net/ethernet/freescale/dpaa2/Makefile @@ -4,14 +4,16 @@ # obj-$(CONFIG_FSL_DPAA2_ETH)=09=09+=3D fsl-dpaa2-eth.o +obj-$(CONFIG_FSL_DPAA2_MAC)=09=09+=3D fsl-dpaa2-mac.o obj-$(CONFIG_FSL_DPAA2_PTP_CLOCK)=09+=3D fsl-dpaa2-ptp.o obj-$(CONFIG_FSL_DPAA2_SWITCH)=09=09+=3D fsl-dpaa2-switch.o -fsl-dpaa2-eth-objs=09:=3D dpaa2-eth.o dpaa2-ethtool.o dpni.o dpaa2-mac.o d= pmac.o dpaa2-eth-devlink.o +fsl-dpaa2-eth-objs=09:=3D dpaa2-eth.o dpaa2-ethtool.o dpni.o dpaa2-eth-dev= link.o fsl-dpaa2-eth-${CONFIG_FSL_DPAA2_ETH_DCB} +=3D dpaa2-eth-dcb.o fsl-dpaa2-eth-${CONFIG_DEBUG_FS} +=3D dpaa2-eth-debugfs.o +fsl-dpaa2-mac-objs=09:=3D dpaa2-mac.o dpmac.o fsl-dpaa2-ptp-objs=09:=3D dpaa2-ptp.o dprtc.o -fsl-dpaa2-switch-objs=09:=3D dpaa2-switch.o dpaa2-switch-ethtool.o dpsw.o = dpaa2-switch-flower.o dpaa2-mac.o dpmac.o +fsl-dpaa2-switch-objs=09:=3D dpaa2-switch.o dpaa2-switch-ethtool.o dpsw.o = dpaa2-switch-flower.o # Needed by the tracing framework CFLAGS_dpaa2-eth.o :=3D -I$(src) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net= /ethernet/freescale/dpaa2/dpaa2-eth.c index 8d029addddad..876c3ed6e2c5 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -28,6 +28,8 @@ #define CREATE_TRACE_POINTS #include "dpaa2-eth-trace.h" +MODULE_IMPORT_NS(FSL_DPAA2_MAC); + MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Freescale Semiconductor, Inc"); MODULE_DESCRIPTION("Freescale DPAA2 Ethernet Driver"); diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net= /ethernet/freescale/dpaa2/dpaa2-mac.c index 49ff85633783..dc2c7cde5435 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -339,12 +339,14 @@ void dpaa2_mac_start(struct dpaa2_mac *mac) =09if (mac->serdes_phy) =09=09phy_power_on(mac->serdes_phy); } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_start, FSL_DPAA2_MAC); void dpaa2_mac_stop(struct dpaa2_mac *mac) { =09if (mac->serdes_phy) =09=09phy_power_off(mac->serdes_phy); } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_stop, FSL_DPAA2_MAC); int dpaa2_mac_connect(struct dpaa2_mac *mac) { @@ -435,6 +437,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) =09return err; } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_connect, FSL_DPAA2_MAC); void dpaa2_mac_disconnect(struct dpaa2_mac *mac) { @@ -447,6 +450,7 @@ void dpaa2_mac_disconnect(struct dpaa2_mac *mac) =09of_phy_put(mac->serdes_phy); =09mac->serdes_phy =3D NULL; } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_disconnect, FSL_DPAA2_MAC); int dpaa2_mac_open(struct dpaa2_mac *mac) { @@ -495,6 +499,7 @@ int dpaa2_mac_open(struct dpaa2_mac *mac) =09dpmac_close(mac->mc_io, 0, dpmac_dev->mc_handle); =09return err; } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_open, FSL_DPAA2_MAC); void dpaa2_mac_close(struct dpaa2_mac *mac) { @@ -504,8 +509,9 @@ void dpaa2_mac_close(struct dpaa2_mac *mac) =09if (mac->fw_node) =09=09fwnode_handle_put(mac->fw_node); } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_close, FSL_DPAA2_MAC); -static char dpaa2_mac_ethtool_stats[][ETH_GSTRING_LEN] =3D { +static const char * const dpaa2_mac_ethtool_stats[] =3D { =09[DPMAC_CNT_ING_ALL_FRAME]=09=09=3D "[mac] rx all frames", =09[DPMAC_CNT_ING_GOOD_FRAME]=09=09=3D "[mac] rx frames ok", =09[DPMAC_CNT_ING_ERR_FRAME]=09=09=3D "[mac] rx frame errors", @@ -542,6 +548,7 @@ int dpaa2_mac_get_sset_count(void) { =09return DPAA2_MAC_NUM_STATS; } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_get_sset_count, FSL_DPAA2_MAC); void dpaa2_mac_get_strings(u8 *data) { @@ -553,6 +560,7 @@ void dpaa2_mac_get_strings(u8 *data) =09=09p +=3D ETH_GSTRING_LEN; =09} } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_get_strings, FSL_DPAA2_MAC); void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data) { @@ -572,3 +580,8 @@ void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac,= u64 *data) =09=09*(data + i) =3D value; =09} } +EXPORT_SYMBOL_NS_GPL(dpaa2_mac_get_ethtool_stats, FSL_DPAA2_MAC); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Freescale Semiconductor, Inc"); +MODULE_DESCRIPTION("Freescale DPAA2 MAC Driver"); diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/= net/ethernet/freescale/dpaa2/dpaa2-switch.c index 2b5909fa93cf..fccbaf75b512 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -3534,5 +3534,7 @@ static void __exit dpaa2_switch_driver_exit(void) module_init(dpaa2_switch_driver_init); module_exit(dpaa2_switch_driver_exit); +MODULE_IMPORT_NS(FSL_DPAA2_MAC); + MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("DPAA2 Ethernet Switch Driver"); -- 2.38.1