2022-09-06 02:31:46

by Neal Liu

[permalink] [raw]
Subject: RE: [PATCH v2] crypto: aspeed: fix build module error

> -----Original Message-----
> From: Herbert Xu <[email protected]>
> Sent: Monday, September 5, 2022 7:04 PM
> To: Neal Liu <[email protected]>
> Cc: David S . Miller <[email protected]>; Joel Stanley <[email protected]>;
> Andrew Jeffery <[email protected]>; [email protected];
> [email protected]; [email protected];
> [email protected]; BMC-SW <[email protected]>; kernel
> test robot <[email protected]>; Sudip Mukherjee
> <[email protected]>
> Subject: Re: [PATCH v2] crypto: aspeed: fix build module error
>
> On Mon, Sep 05, 2022 at 10:54:33AM +0800, Neal Liu wrote:
> >
> > 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)
>
> 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.

For this patch, you're right it would still build if both HASH & CRYPTO are off. But no driver would be run up.
That's why I revise it from your suggestion to this patch.
Thanks.

> Thanks,
> --
> Email: Herbert Xu <[email protected]> Home Page:
> http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt