History log of /linux-master/drivers/crypto/hisilicon/trng/trng.c
Revision Date Author Comments
# 151356ce 20-Oct-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

crypto: hisilicon/trng - Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 00856e53 09-Jun-2022 Weili Qian <qianweili@huawei.com>

crypto: hisilicon/trng - fix local variable type

The return value of 'readl_poll_timeout' is '0' or '-ETIMEDOUT'. Therefore,
change the local variable 'ret' type from 'u32' to 'int'.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 6e57871c 07-Apr-2021 Weili Qian <qianweili@huawei.com>

crypto: hisilicon/trng - add version to adapt new algorithm

Kunpeng930 supports trng and prng, but Kunpeng920 only supports trng.

Therefore, version information is added to ensure that prng is not
registered to Crypto subsystem on Kunpeng920.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# a320dc2f 30-Nov-2020 Yejune Deng <yejune.deng@gmail.com>

crypto: hisilicon/trng - replace atomic_add_return()

a set of atomic_inc_return() looks more neater

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# e4d9d10e 20-Nov-2020 Weili Qian <qianweili@huawei.com>

crypto: hisilicon/trng - add support for PRNG

This patch adds support for pseudo random number generator(PRNG)
in Crypto subsystem.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Reviewed-by: Zaibo Xu <xuzaibo@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 56c6da16 20-Nov-2020 Weili Qian <qianweili@huawei.com>

crypto: hisilicon/trng - add HiSilicon TRNG driver support

Move existing char/hw_random/hisi-trng-v2.c to crypto/hisilicon/trng.c.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Reviewed-by: Zaibo Xu <xuzaibo@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>