History log of /linux-master/drivers/char/hw_random/cctrng.c
Revision Date Author Comments
# 0e00c526 10-Dec-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

hwrng: cctrng - 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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 9553ae34 19-Jul-2023 Martin Kaiser <martin@kaiser.cx>

hwrng: cctrng - use dev_err_probe in error paths

Use dev_err_probe in error paths to make the code a bit shorter.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 80a34c03 19-Jul-2023 Martin Kaiser <martin@kaiser.cx>

hwrng: cctrng - merge cc_trng_clk_init into its only caller

cc_trng_clk_init is called only from the probe function. Merge the two
functions, this saves some lines of code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 8bcd9689 19-Jul-2023 Martin Kaiser <martin@kaiser.cx>

hwrng: cctrng - let devres enable the clock

Call devm_clk_get_optional_enabled in the cctrng driver. We don't have to
disable and unprepare the clock any more in error paths or in the remove
function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 80e40fea 19-Jul-2023 Martin Kaiser <martin@kaiser.cx>

hwrng: cctrng - don't open code init and exit functions

Do not open code the init and exit functions of the cctrng driver.

If we move the BUILD_BUG_ON checks into the probe function, we can use
module_platform_driver and make the code shorter.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# befb1dda 13-Mar-2021 Wang Qing <wangqing@vivo.com>

hwrng: cctrng - delete redundant printing of return value

platform_get_irq() has already checked and printed the return value,
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# f50281df 12-Mar-2021 Tian Tao <tiantao6@hisilicon.com>

hwrng: cctrng - use devm_platform_ioremap_resource() to simplify

Use devm_platform_ioremap_resource() to simplify the code.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# ae835128 28-Feb-2021 Tian Tao <tiantao6@hisilicon.com>

hwrng: cctrng - Use device-managed registration API

Use devm_hwrng_register to get rid of manual unregistration.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 4d6aef2f 26-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

hwrng: cctrn - Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Hadar Gat <hadar.gat@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 43f3c2b4 23-Apr-2020 Zou Wei <zou_wei@huawei.com>

hwrng: cctrng - Make some symbols static

Fix the following sparse warnings:

drivers/char/hw_random/cctrng.c:316:6: warning: symbol
'cc_trng_compwork_handler' was not declared. Should it be static?
drivers/char/hw_random/cctrng.c:451:6: warning: symbol
'cc_trng_startwork_handler' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Acked-by: Hadar Gat <hadar.gat@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# b2d7e8bc 20-Apr-2020 Herbert Xu <herbert@gondor.apana.org.au>

hwrng: cctrng - Remove unnecessary FIPS ifdef

This patch removes the unnecessary FIPS ifdef in cctrng.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Hadar Gat <hadar.gat@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# 3357b611 17-Apr-2020 Hadar Gat <hadar.gat@arm.com>

hwrng: cctrng - add missing include to linux/fips.h

This fixes build failure when CONFIG_CRYPTO_FIPS is defined.

Fixes: a583ed310bb6 ("hwrng: cctrng - introduce Arm CryptoCell driver")
Signed-off-by: Hadar Gat <hadar.gat@arm.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <lkp@intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


# a583ed31 27-Mar-2020 Hadar Gat <hadar.gat@arm.com>

hwrng: cctrng - introduce Arm CryptoCell driver

Introduce low level Arm CryptoCell TRNG HW support.

Signed-off-by: Hadar Gat <hadar.gat@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>