linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwrng: cavium: Use per device name to allow for multiple devices.
@ 2017-02-06 22:28 David Daney
  2017-02-11 10:56 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2017-02-06 22:28 UTC (permalink / raw)
  To: linux-crypto, Matt Mackall, Herbert Xu
  Cc: linux-kernel, Omer Khaliq, Ananth Jasty, David Daney

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>
---
 drivers/char/hw_random/cavium-rng-vf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c
index 066ae0e..dd1007a 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;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwrng: cavium: Use per device name to allow for multiple devices.
  2017-02-06 22:28 [PATCH] hwrng: cavium: Use per device name to allow for multiple devices David Daney
@ 2017-02-11 10:56 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-02-11 10:56 UTC (permalink / raw)
  To: David Daney
  Cc: linux-crypto, Matt Mackall, linux-kernel, Omer Khaliq, Ananth Jasty

On Mon, Feb 06, 2017 at 02:28:46PM -0800, David Daney wrote:
> 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>

Patch 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-11 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 22:28 [PATCH] hwrng: cavium: Use per device name to allow for multiple devices David Daney
2017-02-11 10:56 ` 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).