mt76: pass CONFIG_MT76_LEDS define to subdirectory drivers - #1131
Open
EmreYavuzalp wants to merge 1 commit into
Open
EmreYavuzalp wants to merge 1 commit into
EmreYavuzalp wants to merge 1 commit into
Conversation
EmreYavuzalp
force-pushed
the
led-subdir-ccflags
branch
from
September 10, 2026 21:13
c1b60b5 to
95fea6e
Compare
DragonBluep
reviewed
Sep 12, 2026
| @@ -1,5 +1,6 @@ | |||
| # SPDX-License-Identifier: BSD-3-Clause-Clear | |||
| ccflags-y += -Werror -DCONFIG_MT76_LEDS | |||
| subdir-ccflags-y += -DCONFIG_MT76_LEDS | |||
There was a problem hiding this comment.
I think you can drop all other -DCONFIG_MT76_LEDS after this change.
Author
There was a problem hiding this comment.
Done, consolidated into a single subdir-ccflags-y += -DCONFIG_MT76_LEDS and dropped all the now-redundant per-directory -DCONFIG_MT76_LEDS (top Makefile + mt7603/mt7615/mt7915/mt7996). -Werror left unchanged. Thanks!
CONFIG_MT76_LEDS was passed with -DCONFIG_MT76_LEDS in ccflags-y, which only affects the directory it is written in. It was therefore repeated in the top-level Makefile and in several per-chip subdirectory Makefiles (mt7603, mt7615, mt7915, mt7996) -- but not consistently, so a driver built from a subdirectory that relied on it could still be compiled with IS_ENABLED(CONFIG_MT76_LEDS) false: mt76_led_init() then returns early and the LED class device (mt76-phyN) is never registered. On a dual-band board the effect was asymmetric: the 5 GHz LED worked (mt76x2's callback is set in the top-level mt76x02_util.c, which had the define) while the 2.4 GHz LED did not (mt7603's callback is set in mt7603/init.c). Observed on a TP-Link Archer C5v (mt7603 + mt76x2): only mt76-phy1 registered, mt76-phy0 was missing. Define it once via subdir-ccflags-y in the top-level Makefile, which applies to the current directory and all subdirectories, and drop the now redundant per-directory -DCONFIG_MT76_LEDS. -Werror is left unchanged. Signed-off-by: Emre Yavuzalp <emreyavuzalp2@gmail.com>
EmreYavuzalp
force-pushed
the
led-subdir-ccflags
branch
from
September 13, 2026 11:21
95fea6e to
71b69aa
Compare
DragonBluep
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The -DCONFIG_MT76_LEDS define is added via ccflags-y, which only affects objects compiled in the top-level directory. Per-chip drivers built from a subdirectory (obj-$(CONFIG_MT7603E) += mt7603/, and the other subdirectories) are therefore compiled without the define.
For those drivers IS_ENABLED(CONFIG_MT76_LEDS) evaluates to false, so the leds.cdev.brightness_set / blink_set callbacks are never installed; mt76_led_init() then returns early and the LED class device (mt76-phyN) is never registered.
On a dual-band board the effect is asymmetric: the 5 GHz LED works (mt76x2's callback is set in the top-level mt76x02_util.c, which gets the define) while the 2.4 GHz LED does not (mt7603's callback is set in mt7603/init.c, which does not). Observed on a TP-Link Archer C5v (mt7603 + mt76x2): only mt76-phy1 registered, mt76-phy0 was missing.
Add the define via subdir-ccflags-y as well, which applies to the current directory and all subdirectories, so the per-chip drivers get it too. -Werror is intentionally left in ccflags-y (top level only) so it is not forced onto the subdirectory builds.