mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
net: macb: drop CONFIG_OF #if block
Fix -Wimplicit-function-declaration error on CONFIG_OF=n builds:
drivers/net/ethernet/cadence/macb_main.c: In function ‘macb_probe’:
drivers/net/ethernet/cadence/macb_main.c:5951:15: error: implicit
declaration of function ‘macb_alloc_tieoff’ [...]
5951 | err = macb_alloc_tieoff(bp);
| ^~~~~~~~~~~~~~~~~
drivers/net/ethernet/cadence/macb_main.c:5973:9: error: implicit
declaration of function ‘macb_free_tieoff’ [...]
5973 | macb_free_tieoff(bp);
| ^~~~~~~~~~~~~~~~
Error got introduced because functions are mistakenly declared in a
`#if defined(CONFIG_OF)` block. Instead of moving functions around,
avoid any future mistake and drop the block entirely.
Change the module content slightly on CONFIG_OF=n. Previously match
tables were ignored. Now they appear in the resulting build. This is
considered trivial in size by most and is the common case:
⟩ 18 out of 254 OF net drivers reference CONFIG_OF
⟩ rg -lF 'MODULE_DEVICE_TABLE(of,' drivers/net/ | tee /tmp/a | wc -l
254
⟩ xargs -a /tmp/a rg -l CONFIG_OF | wc -l
18
Tangent: no, of_match_ptr() does not imply that the compiler can
optimize out match tables, because MODULE_DEVICE_TABLE(of, ...)
unconditionally puts the match tables in the binary. It is only meant
to avoid undefined declaration issues when match tables are hidden
behind a #ifdef, as was done before. We therefore drop the macro call.
Fixes: 5262eab946 ("net: macb: allocate tieoff descriptor once across device lifetime")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20260820-macb-fix-x86-v1-1-b2e7c902104e@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
50720728b1
commit
ec518a7c4b
|
|
@ -4926,7 +4926,6 @@ static const struct macb_usrio_config at91_default_usrio = {
|
|||
.clken = MACB_BIT(CLKEN),
|
||||
};
|
||||
|
||||
#if defined(CONFIG_OF)
|
||||
/* 1518 rounded up */
|
||||
#define AT91ETHER_MAX_RBUFF_SZ 0x600
|
||||
/* max number of receive buffers */
|
||||
|
|
@ -5754,7 +5753,6 @@ static const struct of_device_id macb_dt_ids[] = {
|
|||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, macb_dt_ids);
|
||||
#endif /* CONFIG_OF */
|
||||
|
||||
static const struct macb_config default_gem_config = {
|
||||
.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE |
|
||||
|
|
@ -6267,7 +6265,7 @@ static struct platform_driver macb_driver = {
|
|||
.remove = macb_remove,
|
||||
.driver = {
|
||||
.name = "macb",
|
||||
.of_match_table = of_match_ptr(macb_dt_ids),
|
||||
.of_match_table = macb_dt_ids,
|
||||
.pm = &macb_pm_ops,
|
||||
},
|
||||
.shutdown = macb_shutdown,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user