]> git.ipfire.org Git - thirdparty/openwrt.git/commit
ramips: mt7530: use IS_REACHABLE for swconfig code 24728/head
authorMieczyslaw Nalewaj <namiltd@yahoo.com>
Fri, 14 Aug 2026 13:21:14 +0000 (15:21 +0200)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 14 Aug 2026 20:30:09 +0000 (22:30 +0200)
commitd329a480a0ceb84768b4b2ed53f2f87633926a4d
treeff0ec48274d2833d4d5309f2fa1db19c914b9fed
parent8eb204ad81163a8088a079ae96babad2795fa3b5
ramips: mt7530: use IS_REACHABLE for swconfig code

Commit 224a967ba113 ("ramips: mt7530: compile swconfig code
conditionally") used IS_ENABLED(CONFIG_SWCONFIG) to guard
swconfig-specific code.

When CONFIG_ALL_KMODS=y is selected, kmod-swconfig's KCONFIG
override forces CONFIG_SWCONFIG=m during the kernel config merge.

An explicit CONFIG_SWCONFIG=y is protected from being downgraded by
the kmod override, but an absent/unset symbol is not, so the
override's =m wins instead.

IS_ENABLED() evaluates to 1 both for built-in (=y) and module (=m),
so the swconfig code is still compiled into the built-in mt7530
driver even though register_switch() lives in the external
swconfig.ko module and is not available during vmlinux linking,
resulting in:

  drivers/net/ethernet/ralink/mt7530.c: undefined reference to `register_switch'

Switch to IS_REACHABLE(CONFIG_SWCONFIG) which returns true only when
the symbol is actually reachable from the current compilation unit.
This correctly handles the case where mt7530 is built-in and
swconfig is a module, while still allowing both to be built as
modules. Also update the diagnostic message in the fallback branch,
since it is now also reached when swconfig is built as an
unreachable module, not only when support is absent entirely.

Fixes: 224a967ba113 ("ramips: mt7530: compile swconfig code conditionally")
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/24728
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c