Commit a710df1
net: ethernet: ti-cpsw: fix linking built-in code to modules
[ Upstream commit df75bd5 ]
There are six variants of the cpsw driver, sharing various parts of
the code: davinci-emac, cpsw, cpsw-switchdev, netcp, netcp_ethss and
am65-cpsw-nuss.
I noticed that this means some files can be linked into more than
one loadable module, or even part of vmlinux but also linked into
a loadable module, both of which mess up assumptions of the build
system, and causes warnings:
scripts/Makefile.build:279: cpsw_ale.o is added to multiple modules: ti-am65-cpsw-nuss ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: cpsw_priv.o is added to multiple modules: ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: cpsw_sl.o is added to multiple modules: ti-am65-cpsw-nuss ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: cpsw_ethtool.o is added to multiple modules: ti_cpsw ti_cpsw_new
scripts/Makefile.build:279: davinci_cpdma.o is added to multiple modules: ti_cpsw ti_cpsw_new ti_davinci_emac
Change this back to having separate modules for each portion that
can be linked standalone, exporting symbols as needed:
- ti-cpsw-common.ko now contains both cpsw-common.o and
davinci_cpdma.o as they are always used together
- ti-cpsw-priv.ko contains cpsw_priv.o, cpsw_sl.o and cpsw_ethtool.o,
which are the core of the cpsw and cpsw-new drivers.
- ti-cpsw-sl.ko contains the cpsw-sl.o object and is used on
ti-am65-cpsw-nuss.ko in addition to the two other cpsw variants.
- ti-cpsw-ale.o is the one standalone module that is used by all
except davinci_emac.
Each of these will be built-in if any of its users are built-in, otherwise
it's a loadable module if there is at least one module using it. I did
not bring back the separate Kconfig symbols for this, but just handle
it using Makefile logic.
Note: ideally this is something that Kbuild complains about, but usually
we just notice when something using THIS_MODULE misbehaves in a way that
a user notices.
Fixes: 99f6297 ("net: ethernet: ti: cpsw: drop TI_DAVINCI_CPDMA config option")
Link: https://lore.kernel.org/lkml/20240417084400.3034104-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260402184726.3746487-2-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 2bbe3d5 commit a710df1
6 files changed
Lines changed: 139 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | | - | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| |||
535 | 536 | | |
536 | 537 | | |
537 | 538 | | |
| 539 | + | |
538 | 540 | | |
539 | 541 | | |
540 | 542 | | |
| |||
550 | 552 | | |
551 | 553 | | |
552 | 554 | | |
| 555 | + | |
553 | 556 | | |
554 | 557 | | |
555 | 558 | | |
| |||
583 | 586 | | |
584 | 587 | | |
585 | 588 | | |
| 589 | + | |
586 | 590 | | |
587 | 591 | | |
588 | 592 | | |
| |||
612 | 616 | | |
613 | 617 | | |
614 | 618 | | |
| 619 | + | |
615 | 620 | | |
616 | 621 | | |
617 | 622 | | |
| |||
681 | 686 | | |
682 | 687 | | |
683 | 688 | | |
| 689 | + | |
684 | 690 | | |
685 | 691 | | |
686 | 692 | | |
| |||
738 | 744 | | |
739 | 745 | | |
740 | 746 | | |
| 747 | + | |
741 | 748 | | |
742 | 749 | | |
743 | 750 | | |
| |||
772 | 779 | | |
773 | 780 | | |
774 | 781 | | |
| 782 | + | |
775 | 783 | | |
776 | 784 | | |
777 | 785 | | |
| |||
811 | 819 | | |
812 | 820 | | |
813 | 821 | | |
| 822 | + | |
814 | 823 | | |
815 | 824 | | |
816 | 825 | | |
| |||
838 | 847 | | |
839 | 848 | | |
840 | 849 | | |
| 850 | + | |
841 | 851 | | |
842 | 852 | | |
843 | 853 | | |
| |||
903 | 913 | | |
904 | 914 | | |
905 | 915 | | |
| 916 | + | |
906 | 917 | | |
907 | 918 | | |
908 | 919 | | |
| |||
1160 | 1171 | | |
1161 | 1172 | | |
1162 | 1173 | | |
| 1174 | + | |
1163 | 1175 | | |
1164 | 1176 | | |
1165 | 1177 | | |
| |||
1183 | 1195 | | |
1184 | 1196 | | |
1185 | 1197 | | |
| 1198 | + | |
1186 | 1199 | | |
1187 | 1200 | | |
1188 | 1201 | | |
| |||
1205 | 1218 | | |
1206 | 1219 | | |
1207 | 1220 | | |
| 1221 | + | |
1208 | 1222 | | |
1209 | 1223 | | |
1210 | 1224 | | |
| |||
1227 | 1241 | | |
1228 | 1242 | | |
1229 | 1243 | | |
| 1244 | + | |
1230 | 1245 | | |
1231 | 1246 | | |
1232 | 1247 | | |
| |||
1316 | 1331 | | |
1317 | 1332 | | |
1318 | 1333 | | |
| 1334 | + | |
1319 | 1335 | | |
1320 | 1336 | | |
1321 | 1337 | | |
1322 | 1338 | | |
1323 | 1339 | | |
1324 | 1340 | | |
1325 | 1341 | | |
| 1342 | + | |
1326 | 1343 | | |
1327 | 1344 | | |
1328 | 1345 | | |
| |||
1623 | 1640 | | |
1624 | 1641 | | |
1625 | 1642 | | |
| 1643 | + | |
1626 | 1644 | | |
1627 | 1645 | | |
1628 | 1646 | | |
| |||
1633 | 1651 | | |
1634 | 1652 | | |
1635 | 1653 | | |
| 1654 | + | |
1636 | 1655 | | |
1637 | 1656 | | |
1638 | 1657 | | |
| |||
1643 | 1662 | | |
1644 | 1663 | | |
1645 | 1664 | | |
| 1665 | + | |
1646 | 1666 | | |
1647 | 1667 | | |
1648 | 1668 | | |
1649 | 1669 | | |
1650 | 1670 | | |
| 1671 | + | |
1651 | 1672 | | |
1652 | 1673 | | |
1653 | 1674 | | |
| |||
1750 | 1771 | | |
1751 | 1772 | | |
1752 | 1773 | | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
0 commit comments