Discussion:
[PATCH 0/2] MIPS: Netlogic: modular build fixes
Florian Fainelli
2014-09-24 17:55:09 UTC
Permalink
Hello Ralf, Jayachandran, Ganesan

Here are two small fixes for modular USB and AHCI builds that I encountered
while playing with a FVP board.

These are based off upstream-sfr/mips-for-linux-next

Thanks!

Florian Fainelli (2):
MIPS: Netlogic: handle modular USB case
MIPS: Netlogic: handle modular AHCI builds

arch/mips/netlogic/xlp/Makefile | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--
1.9.1
Florian Fainelli
2014-09-24 17:55:10 UTC
Permalink
Commit 1004165f346a ("MIPS: Netlogic: USB support for XLP") and then
commit 9eac3591e78b ("MIPS: Netlogic: Add support for USB on XLP2xx")
added usb-init and usb-init-xlp2 as objects to build when CONFIG_USB is
enabled.

If CONFIG_USB is made modular, these two files will also get built as
modules (obj-m), which will result in the following linking failure:

ERROR: "nlm_io_base" [arch/mips/netlogic/xlp/usb-init.ko] undefined!
ERROR: "nlm_nodes" [arch/mips/netlogic/xlp/usb-init-xlp2.ko] undefined!
ERROR: "nlm_set_pic_extra_ack" [arch/mips/netlogic/xlp/usb-init-xlp2.ko]
undefined!
ERROR: "xlp_socdev_to_node" [arch/mips/netlogic/xlp/usb-init-xlp2.ko]
undefined!
ERROR: "nlm_io_base" [arch/mips/netlogic/xlp/usb-init-xlp2.ko]
undefined!

Just check whether CONFIG_USB is defined for this build, and if that is
the case, add these objects to the list of built-in object files.

Signed-off-by: Florian Fainelli <***@gmail.com>
---
arch/mips/netlogic/xlp/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/netlogic/xlp/Makefile b/arch/mips/netlogic/xlp/Makefile
index be358a8050c5..577889f7275e 100644
--- a/arch/mips/netlogic/xlp/Makefile
+++ b/arch/mips/netlogic/xlp/Makefile
@@ -1,6 +1,8 @@
obj-y += setup.o nlm_hal.o cop2-ex.o dt.o
obj-$(CONFIG_SMP) += wakeup.o
-obj-$(CONFIG_USB) += usb-init.o
-obj-$(CONFIG_USB) += usb-init-xlp2.o
+ifdef CONFIG_USB
+obj-y += usb-init.o
+obj-y += usb-init-xlp2.o
+endif
obj-$(CONFIG_SATA_AHCI) += ahci-init.o
obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o
--
1.9.1
Florian Fainelli
2014-09-24 17:55:11 UTC
Permalink
Commits a951440971d0 ("MIPS: Netlogic: Support for XLP3XX on-chip SATA")
and fedfcb1137d2 ("MIPS: Netlogic: XLP9XX on-chip SATA support") added
ahci-init and ahci-init-xlp2 as objects to build when CONFIG_SATA_AHCI
is enabled.

If CONFIG_SATA_AHCI is made modular, these two files will also get built
as modules (obj-m), which will result in the following linking failure:

ERROR: "nlm_set_pic_extra_ack" [arch/mips/netlogic/xlp/ahci-init.ko]
undefined!
ERROR: "nlm_io_base" [arch/mips/netlogic/xlp/ahci-init.ko] undefined!
ERROR: "nlm_nodes" [arch/mips/netlogic/xlp/ahci-init-xlp2.ko] undefined!
ERROR: "nlm_set_pic_extra_ack"
[arch/mips/netlogic/xlp/ahci-init-xlp2.ko] undefined!
ERROR: "xlp_socdev_to_node" [arch/mips/netlogic/xlp/ahci-init-xlp2.ko]
undefined!
ERROR: "nlm_io_base" [arch/mips/netlogic/xlp/ahci-init-xlp2.ko]
undefined!

Just check whether CONFIG_SATA_AHCI is defined for this build, and if
that is the case, add these objects to the list of built-in object
files.

Signed-off-by: Florian Fainelli <***@gmail.com>
---
arch/mips/netlogic/xlp/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/netlogic/xlp/Makefile b/arch/mips/netlogic/xlp/Makefile
index 577889f7275e..6b43af0a34d9 100644
--- a/arch/mips/netlogic/xlp/Makefile
+++ b/arch/mips/netlogic/xlp/Makefile
@@ -4,5 +4,7 @@ ifdef CONFIG_USB
obj-y += usb-init.o
obj-y += usb-init-xlp2.o
endif
-obj-$(CONFIG_SATA_AHCI) += ahci-init.o
-obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o
+ifdef CONFIG_SATA_AHCI
+obj-y += ahci-init.o
+obj-y += ahci-init-xlp2.o
+endif
--
1.9.1
Jayachandran C.
2014-09-25 01:25:15 UTC
Permalink
Post by Florian Fainelli
Hello Ralf, Jayachandran, Ganesan
Here are two small fixes for modular USB and AHCI builds that I encountered
while playing with a FVP board.
These are based off upstream-sfr/mips-for-linux-next
We have a slightly different fix for this in our internal repository, I
was planning to submit it soon:


index be358a8..5c876d3 100644
--- a/arch/mips/netlogic/xlp/Makefile
+++ b/arch/mips/netlogic/xlp/Makefile
@@ -1,6 +1,6 @@
obj-y += setup.o nlm_hal.o cop2-ex.o dt.o
obj-$(CONFIG_SMP) += wakeup.o
-obj-$(CONFIG_USB) += usb-init.o
-obj-$(CONFIG_USB) += usb-init-xlp2.o
-obj-$(CONFIG_SATA_AHCI) += ahci-init.o
-obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o
+obj-$(subst m,y,$(CONFIG_USB)) += usb-init.o
+obj-$(subst m,y,$(CONFIG_USB)) += usb-init-xlp2.o
+obj-$(subst m,y,$(CONFIG_SATA_AHCI)) += ahci-init.o
+obj-$(subst m,y,$(CONFIG_SATA_AHCI)) += ahci-init-xlp2.o

This will add the init code when USB or SATA is enabled as module or
is built-in, so I think this is be a better solution.

JC.
Florian Fainelli
2014-09-25 01:36:35 UTC
Permalink
Post by Jayachandran C.
Post by Florian Fainelli
Hello Ralf, Jayachandran, Ganesan
Here are two small fixes for modular USB and AHCI builds that I encountered
while playing with a FVP board.
These are based off upstream-sfr/mips-for-linux-next
We have a slightly different fix for this in our internal repository, I
index be358a8..5c876d3 100644
--- a/arch/mips/netlogic/xlp/Makefile
+++ b/arch/mips/netlogic/xlp/Makefile
@@ -1,6 +1,6 @@
obj-y += setup.o nlm_hal.o cop2-ex.o dt.o
obj-$(CONFIG_SMP) += wakeup.o
-obj-$(CONFIG_USB) += usb-init.o
-obj-$(CONFIG_USB) += usb-init-xlp2.o
-obj-$(CONFIG_SATA_AHCI) += ahci-init.o
-obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o
+obj-$(subst m,y,$(CONFIG_USB)) += usb-init.o
+obj-$(subst m,y,$(CONFIG_USB)) += usb-init-xlp2.o
+obj-$(subst m,y,$(CONFIG_SATA_AHCI)) += ahci-init.o
+obj-$(subst m,y,$(CONFIG_SATA_AHCI)) += ahci-init-xlp2.o
This will add the init code when USB or SATA is enabled as module or
is built-in, so I think this is be a better solution.
Not sure which one is "better" than the other since they both solve the
same problem, but whatever works for you also works for me! The tree
seems to have a mix of both approaches.

Thanks!
--
Florian

Loading...