* [PATCH 0/2] hwrng: cn10k - trivial cleanups
@ 2023-07-21 8:54 Martin Kaiser
2023-07-21 8:54 ` [PATCH 1/2] hwrng: cn10k - delete empty remove function Martin Kaiser
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Martin Kaiser @ 2023-07-21 8:54 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto, linux-arm-kernel, linux-kernel, Martin Kaiser
Two trivial cleanups of the cn10k driver. Compile tested only.
Martin Kaiser (2):
hwrng: cn10k - delete empty remove function
hwrng: cn10k - use dev_err_probe
drivers/char/hw_random/cn10k-rng.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] hwrng: cn10k - delete empty remove function
2023-07-21 8:54 [PATCH 0/2] hwrng: cn10k - trivial cleanups Martin Kaiser
@ 2023-07-21 8:54 ` Martin Kaiser
2023-07-21 8:54 ` [PATCH 2/2] hwrng: cn10k - use dev_err_probe Martin Kaiser
2023-07-28 10:22 ` [PATCH 0/2] hwrng: cn10k - trivial cleanups Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2023-07-21 8:54 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto, linux-arm-kernel, linux-kernel, Martin Kaiser
The remove function is empty, we can delete it. It's ok for a PCI driver
to have no remove function.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/char/hw_random/cn10k-rng.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c
index 0cd7e1a8e499..794ec77feb2c 100644
--- a/drivers/char/hw_random/cn10k-rng.c
+++ b/drivers/char/hw_random/cn10k-rng.c
@@ -213,11 +213,6 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;
}
-static void cn10k_rng_remove(struct pci_dev *pdev)
-{
- /* Nothing to do */
-}
-
static const struct pci_device_id cn10k_rng_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 0xA098) }, /* RNG PF */
{0,},
@@ -229,7 +224,6 @@ static struct pci_driver cn10k_rng_driver = {
.name = "cn10k_rng",
.id_table = cn10k_rng_id_table,
.probe = cn10k_rng_probe,
- .remove = cn10k_rng_remove,
};
module_pci_driver(cn10k_rng_driver);
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] hwrng: cn10k - use dev_err_probe
2023-07-21 8:54 [PATCH 0/2] hwrng: cn10k - trivial cleanups Martin Kaiser
2023-07-21 8:54 ` [PATCH 1/2] hwrng: cn10k - delete empty remove function Martin Kaiser
@ 2023-07-21 8:54 ` Martin Kaiser
2023-07-28 10:22 ` [PATCH 0/2] hwrng: cn10k - trivial cleanups Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2023-07-21 8:54 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto, linux-arm-kernel, linux-kernel, Martin Kaiser
Use dev_err_probe in error paths of the probe function, making the code a
tiny bit simpler.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/char/hw_random/cn10k-rng.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c
index 794ec77feb2c..31935316a160 100644
--- a/drivers/char/hw_random/cn10k-rng.c
+++ b/drivers/char/hw_random/cn10k-rng.c
@@ -187,10 +187,8 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_drvdata(pdev, rng);
rng->reg_base = pcim_iomap(pdev, 0, 0);
- if (!rng->reg_base) {
- dev_err(&pdev->dev, "Error while mapping CSRs, exiting\n");
- return -ENOMEM;
- }
+ if (!rng->reg_base)
+ return dev_err_probe(&pdev->dev, -ENOMEM, "Error while mapping CSRs, exiting\n");
rng->ops.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"cn10k-rng-%s", dev_name(&pdev->dev));
@@ -205,10 +203,8 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id)
reset_rng_health_state(rng);
err = devm_hwrng_register(&pdev->dev, &rng->ops);
- if (err) {
- dev_err(&pdev->dev, "Could not register hwrng device.\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(&pdev->dev, err, "Could not register hwrng device.\n");
return 0;
}
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] hwrng: cn10k - trivial cleanups
2023-07-21 8:54 [PATCH 0/2] hwrng: cn10k - trivial cleanups Martin Kaiser
2023-07-21 8:54 ` [PATCH 1/2] hwrng: cn10k - delete empty remove function Martin Kaiser
2023-07-21 8:54 ` [PATCH 2/2] hwrng: cn10k - use dev_err_probe Martin Kaiser
@ 2023-07-28 10:22 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2023-07-28 10:22 UTC (permalink / raw)
To: Martin Kaiser; +Cc: linux-crypto, linux-arm-kernel, linux-kernel
On Fri, Jul 21, 2023 at 10:54:42AM +0200, Martin Kaiser wrote:
> Two trivial cleanups of the cn10k driver. Compile tested only.
>
> Martin Kaiser (2):
> hwrng: cn10k - delete empty remove function
> hwrng: cn10k - use dev_err_probe
>
> drivers/char/hw_random/cn10k-rng.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
All applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-28 10:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21 8:54 [PATCH 0/2] hwrng: cn10k - trivial cleanups Martin Kaiser
2023-07-21 8:54 ` [PATCH 1/2] hwrng: cn10k - delete empty remove function Martin Kaiser
2023-07-21 8:54 ` [PATCH 2/2] hwrng: cn10k - use dev_err_probe Martin Kaiser
2023-07-28 10:22 ` [PATCH 0/2] hwrng: cn10k - trivial cleanups Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).