summaryrefslogtreecommitdiffstats
path: root/drivers/char/hw_random
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2017-02-06 14:28:46 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2017-02-11 17:52:30 +0800
commit87f3d0887c9cc63d7b8e7b0b7e5a48dca8cc8564 (patch)
tree5a13cad4f4e4d9a2da2fff6f5698301398b96b59 /drivers/char/hw_random
parent4c147bcff52b582cd278f39261302a4659da3fef (diff)
downloadlinux-87f3d0887c9cc63d7b8e7b0b7e5a48dca8cc8564.tar.gz
linux-87f3d0887c9cc63d7b8e7b0b7e5a48dca8cc8564.tar.bz2
linux-87f3d0887c9cc63d7b8e7b0b7e5a48dca8cc8564.zip
hwrng: cavium - Use per device name to allow for multiple devices.
Systems containing the Cavium HW RNG may have one device per NUMA node. A typical configuration is a 2-node NUMA system, which results in 2 RNG devices. The hwrng subsystem refuses (and rightly so) to register more than one device with he same name, so we get failure messages on these systems. Make the hwrng name unique by including the underlying device name. Also remove spaces from the name to make it possible to switch devices via the sysfs knobs. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r--drivers/char/hw_random/cavium-rng-vf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c
index 066ae0e78d63..dd1007aecb10 100644
--- a/drivers/char/hw_random/cavium-rng-vf.c
+++ b/drivers/char/hw_random/cavium-rng-vf.c
@@ -57,7 +57,11 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev,
return -ENOMEM;
}
- rng->ops.name = "cavium rng";
+ rng->ops.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
+ "cavium-rng-%s", dev_name(&pdev->dev));
+ if (!rng->ops.name)
+ return -ENOMEM;
+
rng->ops.read = cavium_rng_read;
rng->ops.quality = 1000;