Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: lan969x: fix cyclic dependency reported by depmod

Depmod reports a cyclic dependency between modules sparx5-switch.ko and
lan969x-switch.ko:

depmod: ERROR: Cycle detected: lan969x_switch -> sparx5_switch -> lan969x_switch
depmod: ERROR: Found 2 modules in dependency cycles!
make[2]: *** [scripts/Makefile.modinst:132: depmod] Error 1
make: *** [Makefile:224: __sub-make] Error 2

This makes sense, as they both require symbols from each other.

Fix this by compiling lan969x support into the sparx5-switch.ko module.
In order to do this, in a sensible way, we move the lan969x/ dir into
the sparx5/ dir and do some code cleanup of code that is no longer
required.

After this patch, depmod will no longer complain, as lan969x support is
compiled into the sparx5-swicth.ko module, and can no longer be compiled
as a standalone module.

Fixes: 98a01119608d ("net: sparx5: add compatible string for lan969x")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Daniel Machon and committed by
David S. Miller
1cd7523f 09310cfd

+15 -31
+1 -1
MAINTAINERS
··· 15343 15343 M: UNGLinuxDriver@microchip.com 15344 15344 L: netdev@vger.kernel.org 15345 15345 S: Maintained 15346 - F: drivers/net/ethernet/microchip/lan969x/* 15346 + F: drivers/net/ethernet/microchip/sparx5/lan969x/* 15347 15347 15348 15348 MICROCHIP LCDFB DRIVER 15349 15349 M: Nicolas Ferre <nicolas.ferre@microchip.com>
-1
drivers/net/ethernet/microchip/Kconfig
··· 59 59 60 60 source "drivers/net/ethernet/microchip/lan865x/Kconfig" 61 61 source "drivers/net/ethernet/microchip/lan966x/Kconfig" 62 - source "drivers/net/ethernet/microchip/lan969x/Kconfig" 63 62 source "drivers/net/ethernet/microchip/sparx5/Kconfig" 64 63 source "drivers/net/ethernet/microchip/vcap/Kconfig" 65 64 source "drivers/net/ethernet/microchip/fdma/Kconfig"
-1
drivers/net/ethernet/microchip/Makefile
··· 11 11 12 12 obj-$(CONFIG_LAN865X) += lan865x/ 13 13 obj-$(CONFIG_LAN966X_SWITCH) += lan966x/ 14 - obj-$(CONFIG_LAN969X_SWITCH) += lan969x/ 15 14 obj-$(CONFIG_SPARX5_SWITCH) += sparx5/ 16 15 obj-$(CONFIG_VCAP) += vcap/ 17 16 obj-$(CONFIG_FDMA) += fdma/
-5
drivers/net/ethernet/microchip/lan969x/Kconfig
··· 1 - config LAN969X_SWITCH 2 - bool "Lan969x switch driver" 3 - depends on SPARX5_SWITCH 4 - help 5 - This driver supports the lan969x family of network switch devices.
-13
drivers/net/ethernet/microchip/lan969x/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for the Microchip lan969x network device drivers. 4 - # 5 - 6 - obj-$(CONFIG_SPARX5_SWITCH) += lan969x-switch.o 7 - 8 - lan969x-switch-y := lan969x_regs.o lan969x.o lan969x_calendar.o \ 9 - lan969x_vcap_ag_api.o lan969x_vcap_impl.o 10 - 11 - # Provide include files 12 - ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/fdma 13 - ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
-5
drivers/net/ethernet/microchip/lan969x/lan969x.c drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c
··· 346 346 .consts = &lan969x_consts, 347 347 .ops = &lan969x_ops, 348 348 }; 349 - EXPORT_SYMBOL_GPL(lan969x_desc); 350 - 351 - MODULE_DESCRIPTION("Microchip lan969x switch driver"); 352 - MODULE_AUTHOR("Daniel Machon <daniel.machon@microchip.com>"); 353 - MODULE_LICENSE("Dual MIT/GPL");
drivers/net/ethernet/microchip/lan969x/lan969x.h drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.h
drivers/net/ethernet/microchip/lan969x/lan969x_calendar.c drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_calendar.c
drivers/net/ethernet/microchip/lan969x/lan969x_regs.c drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_regs.c
drivers/net/ethernet/microchip/lan969x/lan969x_vcap_ag_api.c drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_vcap_ag_api.c
drivers/net/ethernet/microchip/lan969x/lan969x_vcap_impl.c drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_vcap_impl.c
+6
drivers/net/ethernet/microchip/sparx5/Kconfig
··· 24 24 DSCP and PCP. 25 25 26 26 If unsure, set to Y. 27 + 28 + config LAN969X_SWITCH 29 + bool "Lan969x switch driver" 30 + depends on SPARX5_SWITCH 31 + help 32 + This driver supports the lan969x family of network switch devices.
+6
drivers/net/ethernet/microchip/sparx5/Makefile
··· 16 16 sparx5-switch-$(CONFIG_SPARX5_DCB) += sparx5_dcb.o 17 17 sparx5-switch-$(CONFIG_DEBUG_FS) += sparx5_vcap_debugfs.o 18 18 19 + sparx5-switch-$(CONFIG_LAN969X_SWITCH) += lan969x/lan969x_regs.o \ 20 + lan969x/lan969x.o \ 21 + lan969x/lan969x_calendar.o \ 22 + lan969x/lan969x_vcap_ag_api.o \ 23 + lan969x/lan969x_vcap_impl.o 24 + 19 25 # Provide include files 20 26 ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap 21 27 ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/fdma
-2
drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c
··· 98 98 default: return 0; 99 99 } 100 100 } 101 - EXPORT_SYMBOL_GPL(sparx5_cal_speed_to_value); 102 101 103 102 static u32 sparx5_bandwidth_to_calendar(u32 bw) 104 103 { ··· 149 150 return SPX5_CAL_SPEED_NONE; 150 151 return sparx5_bandwidth_to_calendar(port->conf.bandwidth); 151 152 } 152 - EXPORT_SYMBOL_GPL(sparx5_get_port_cal_speed); 153 153 154 154 /* Auto configure the QSYS calendar based on port configuration */ 155 155 int sparx5_config_auto_calendar(struct sparx5 *sparx5)
+2 -2
drivers/net/ethernet/microchip/sparx5/sparx5_main.c
··· 24 24 #include <linux/types.h> 25 25 #include <linux/reset.h> 26 26 27 - #include "../lan969x/lan969x.h" /* for lan969x match data */ 27 + #include "lan969x/lan969x.h" /* for lan969x match data */ 28 28 29 29 #include "sparx5_main_regs.h" 30 30 #include "sparx5_main.h" ··· 1093 1093 1094 1094 static const struct of_device_id mchp_sparx5_match[] = { 1095 1095 { .compatible = "microchip,sparx5-switch", .data = &sparx5_desc }, 1096 - #if IS_ENABLED(CONFIG_LAN969X_SWITCH) 1096 + #ifdef CONFIG_LAN969X_SWITCH 1097 1097 { .compatible = "microchip,lan9691-switch", .data = &lan969x_desc }, 1098 1098 #endif 1099 1099 { }
-1
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
··· 303 303 304 304 spin_unlock_irqrestore(&sparx5->ptp_clock_lock, flags); 305 305 } 306 - EXPORT_SYMBOL_GPL(sparx5_get_hwtimestamp); 307 306 308 307 irqreturn_t sparx5_ptp_irq_handler(int irq, void *args) 309 308 {