Skip to content

Commit 87f3d08

Browse files
daviddaneyherbertx
authored andcommitted
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>
1 parent 4c147bc commit 87f3d08

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/char/hw_random/cavium-rng-vf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev,
5757
return -ENOMEM;
5858
}
5959

60-
rng->ops.name = "cavium rng";
60+
rng->ops.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
61+
"cavium-rng-%s", dev_name(&pdev->dev));
62+
if (!rng->ops.name)
63+
return -ENOMEM;
64+
6165
rng->ops.read = cavium_rng_read;
6266
rng->ops.quality = 1000;
6367

0 commit comments

Comments
 (0)