2008-01-25 22:22:24

by Ingo Molnar

[permalink] [raw]
Subject: [build bug] ./drivers/crypto/hifn_795x.c


randconfig testing found this (post-v2.6.24) build bug:

drivers/built-in.o: In function `hifn_unregister_rng':
hifn_795x.c:(.text+0x17bbd9): undefined reference to `hwrng_unregister'
drivers/built-in.o: In function `hifn_probe':
hifn_795x.c:(.text+0x17df70): undefined reference to `hwrng_register'

config attached.

i tried to reply to the pull request on lkml, but was unable to find
one. The bug came in via:

Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (125 commits)

Ingo


Attachments:
(No filename) (590.00 B)
config (51.50 kB)
Download all attachments

2008-01-25 22:46:27

by Herbert Xu

[permalink] [raw]
Subject: Re: [build bug] ./drivers/crypto/hifn_795x.c

On Fri, Jan 25, 2008 at 11:21:50PM +0100, Ingo Molnar wrote:
>
> randconfig testing found this (post-v2.6.24) build bug:
>
> drivers/built-in.o: In function `hifn_unregister_rng':
> hifn_795x.c:(.text+0x17bbd9): undefined reference to `hwrng_unregister'
> drivers/built-in.o: In function `hifn_probe':
> hifn_795x.c:(.text+0x17df70): undefined reference to `hwrng_register'
>
> config attached.

Thanks for the report. This is casued by

> CONFIG_HW_RANDOM=m
> CONFIG_CRYPTO_DEV_HIFN_795X=y

I'll fix it with the following patch.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 74bd599..8a70a9e 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -88,10 +88,16 @@ config CRYPTO_DEV_HIFN_795X
select CRYPTO_DES
select CRYPTO_ALGAPI
select CRYPTO_BLKCIPHER
+ select HW_RANDOM if CRYPTO_DEV_HIFN_795X_RNG
depends on PCI
help
This option allows you to have support for HIFN 795x crypto adapters.

-
+config CRYPTO_DEV_HIFN_795X_RNG
+ bool "HIFN 795x random number generator"
+ depends on CRYPTO_DEV_HIFN_795X
+ help
+ Select this option if you want to enable the random number generator
+ on the HIFN 795x crypto adapters.

endif # CRYPTO_HW
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 16413e5..dfbf24c 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -463,7 +463,7 @@ struct hifn_device

unsigned int pk_clk_freq;

-#if defined(CONFIG_HW_RANDOM) || defined(CONFIG_HW_RANDOM_MODULE)
+#ifdef CRYPTO_DEV_HIFN_795X_RNG
unsigned int rng_wait_time;
ktime_t rngtime;
struct hwrng rng;
@@ -795,7 +795,7 @@ static struct pci2id {
}
};

-#if defined(CONFIG_HW_RANDOM) || defined(CONFIG_HW_RANDOM_MODULE)
+#ifdef CRYPTO_DEV_HIFN_795X_RNG
static int hifn_rng_data_present(struct hwrng *rng, int wait)
{
struct hifn_device *dev = (struct hifn_device *)rng->priv;
@@ -880,7 +880,7 @@ static int hifn_init_pubrng(struct hifn_device *dev)
dprintk("Chip %s: RNG engine has been successfully initialised.\n",
dev->name);

-#if defined(CONFIG_HW_RANDOM) || defined(CONFIG_HW_RANDOM_MODULE)
+#ifdef CRYPTO_DEV_HIFN_795X_RNG
/* First value must be discarded */
hifn_read_1(dev, HIFN_1_RNG_DATA);
dev->rngtime = ktime_get();

2008-01-25 23:51:58

by Ingo Molnar

[permalink] [raw]
Subject: Re: [build bug] ./drivers/crypto/hifn_795x.c


* Ingo Molnar <[email protected]> wrote:

> randconfig testing found this (post-v2.6.24) build bug:
>
> drivers/built-in.o: In function `hifn_unregister_rng':
> hifn_795x.c:(.text+0x17bbd9): undefined reference to `hwrng_unregister'
> drivers/built-in.o: In function `hifn_probe':
> hifn_795x.c:(.text+0x17df70): undefined reference to `hwrng_register'
>
> config attached.

find a workaround below - but i'm not sure it's the right one.

Ingo

Index: linux/drivers/crypto/Kconfig
===================================================================
--- linux.orig/drivers/crypto/Kconfig
+++ linux/drivers/crypto/Kconfig
@@ -89,6 +89,7 @@ config CRYPTO_DEV_HIFN_795X
select CRYPTO_ALGAPI
select CRYPTO_BLKCIPHER
depends on PCI
+ depends on DEV_HIFN_795X = HW_RANDOM
help
This option allows you to have support for HIFN 795x crypto adapters.

2008-01-25 23:54:17

by Herbert Xu

[permalink] [raw]
Subject: Re: [build bug] ./drivers/crypto/hifn_795x.c

On Sat, Jan 26, 2008 at 12:51:31AM +0100, Ingo Molnar wrote:
>
> find a workaround below - but i'm not sure it's the right one.

Thanks, but I've already checked in a fix :)
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2008-01-25 23:59:40

by Ingo Molnar

[permalink] [raw]
Subject: Re: [build bug] ./drivers/crypto/hifn_795x.c


* Herbert Xu <[email protected]> wrote:

> On Sat, Jan 26, 2008 at 12:51:31AM +0100, Ingo Molnar wrote:
> >
> > find a workaround below - but i'm not sure it's the right one.
>
> Thanks, but I've already checked in a fix :)

hey, that's my punishment for not reading my email promptly :) Could
have saved me some time in the Kconfig web of dependencies :-/

Ingo

2008-01-26 10:44:41

by Evgeniy Polyakov

[permalink] [raw]
Subject: Re: [build bug] ./drivers/crypto/hifn_795x.c

Hi.

On Sat, Jan 26, 2008 at 09:45:45AM +1100, Herbert Xu ([email protected]) wrote:
> On Fri, Jan 25, 2008 at 11:21:50PM +0100, Ingo Molnar wrote:
> >
> > randconfig testing found this (post-v2.6.24) build bug:
> >
> > drivers/built-in.o: In function `hifn_unregister_rng':
> > hifn_795x.c:(.text+0x17bbd9): undefined reference to `hwrng_unregister'
> > drivers/built-in.o: In function `hifn_probe':
> > hifn_795x.c:(.text+0x17df70): undefined reference to `hwrng_register'
> >
> > config attached.
>
> Thanks for the report. This is casued by
>
> > CONFIG_HW_RANDOM=m
> > CONFIG_CRYPTO_DEV_HIFN_795X=y
>
> I'll fix it with the following patch.

Thanks for fixing that up, if people who do not like select will
complain, we can make hifn rng depend on hw_random.

--
Evgeniy Polyakov