diff mbox series

[v2] crypto: aspeed: fix build module error

Message ID 20220905025433.1610696-1-neal_liu@aspeedtech.com
State Accepted
Commit 2be570849efc4e1ceda6a8384184f493f558f188
Headers show
Series [v2] crypto: aspeed: fix build module error | expand

Commit Message

Neal Liu Sept. 5, 2022, 2:54 a.m. UTC
If CONFIG_MODULES=y and CONFIG_CRYPTO_DEV_ASPEED=m,
build modpost would be failed.

Error messages:
  ERROR: modpost: "aspeed_register_hace_hash_algs"
  [drivers/crypto/aspeed/aspeed_crypto.ko] undefined!
  ERROR: modpost: "aspeed_unregister_hace_hash_algs"
  [drivers/crypto/aspeed/aspeed_crypto.ko] undefined!

Change build sequence to fix this.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Neal Liu <neal_liu@aspeedtech.com>
Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
v2: Remove redundant obj- lines.

 drivers/crypto/aspeed/Makefile | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Dhananjay Phadke Sept. 16, 2022, 5:21 p.m. UTC | #1
On 9/16/2022 3:42 AM, Herbert Xu wrote:
>>> Does this still build if both HASH and CRYPTO are off?
>>>
>>> I think this it's best if you do:
>>>
>>> hace-hash-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_HASH) :=
>>> aspeed-hace-hash.o
>>> hace-crypto-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_CRYPTO) :=
>>> aspeed-hace-crypto.o
>>>
>>> obj-$(CONFIG_CRYPTO_DEV_ASPEED) += aspeed_crypto.o
>>> aspeed_crypto-objs := aspeed-hace.o	\
>>> 		      $(hace-hash-y)	\
>>> 		      $(hace-crypto-y)
>>>
>> aspeed-hace.o effects only if either hace-hash-y or hace-crypto-y.
>> If we put aspeed-hace.o in aspeed_crypto-objs, but hace-hash-y and hace-crypto-y are empty, apseed-hace.o is just an useless driver which might still occupy system resources.
> Apparently it doesn't build after all, at least not on m68k.
> 
> So please either adopt my suggestion above, or come up with another
> way of preventing the build failure on m68k with both HASH and CRYPTO
> disabled.

Curious why compiled on m68k? It's embedded controller in ARM based
Aspeed SoCs. And there's "depends on ARCH_ASPEED" in Kconfig, need
some additional dependencies?

Regards,
Dhananjay
Neal Liu Sept. 19, 2022, 6:36 a.m. UTC | #2
> >>> Does this still build if both HASH and CRYPTO are off?
> >>>
> >>> I think this it's best if you do:
> >>>
> >>> hace-hash-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_HASH) :=
> >>> aspeed-hace-hash.o
> >>> hace-crypto-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_CRYPTO) :=
> >>> aspeed-hace-crypto.o
> >>>
> >>> obj-$(CONFIG_CRYPTO_DEV_ASPEED) += aspeed_crypto.o
> >>> aspeed_crypto-objs := aspeed-hace.o	\
> >>> 		      $(hace-hash-y)	\
> >>> 		      $(hace-crypto-y)
> >>>
> >> aspeed-hace.o effects only if either hace-hash-y or hace-crypto-y.
> >> If we put aspeed-hace.o in aspeed_crypto-objs, but hace-hash-y and
> hace-crypto-y are empty, apseed-hace.o is just an useless driver which might
> still occupy system resources.
> > Apparently it doesn't build after all, at least not on m68k.
> >
> > So please either adopt my suggestion above, or come up with another
> > way of preventing the build failure on m68k with both HASH and CRYPTO
> > disabled.
> 
> Curious why compiled on m68k? It's embedded controller in ARM based
> Aspeed SoCs. And there's "depends on ARCH_ASPEED" in Kconfig, need some
> additional dependencies?

The reason is because the compile test is enabled.
Check this:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=31b39755e32568b43c80814c5e13d7b1ab796d73
diff mbox series

Patch

diff --git a/drivers/crypto/aspeed/Makefile b/drivers/crypto/aspeed/Makefile
index 421e2ca9c53e..3be78cec0ecb 100644
--- a/drivers/crypto/aspeed/Makefile
+++ b/drivers/crypto/aspeed/Makefile
@@ -1,9 +1,6 @@ 
+hace-hash-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_HASH) := aspeed-hace.o aspeed-hace-hash.o
+hace-crypto-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_CRYPTO) := aspeed-hace.o aspeed-hace-crypto.o
+
 obj-$(CONFIG_CRYPTO_DEV_ASPEED) += aspeed_crypto.o
-aspeed_crypto-objs := aspeed-hace.o	\
-		      $(hace-hash-y)	\
+aspeed_crypto-objs := $(hace-hash-y)	\
 		      $(hace-crypto-y)
-
-obj-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_HASH) += aspeed-hace-hash.o
-hace-hash-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_HASH) := aspeed-hace-hash.o
-obj-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_CRYPTO) += aspeed-hace-crypto.o
-hace-crypto-$(CONFIG_CRYPTO_DEV_ASPEED_HACE_CRYPTO) := aspeed-hace-crypto.o