* [PATCH] mfd: wm831x: Feed the device UUID into device_add_randomness()
@ 2012-07-05 20:23 Mark Brown
2012-07-06 21:23 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2012-07-05 20:23 UTC (permalink / raw)
To: Theodore Ts'o, Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown
wm831x devices contain a unique ID value. Feed this into the newly added
device_add_randomness() to add some per device seed data to the pool.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
add_device_randomness() has only just been added in -next, this will
need to either wait until after the merge window or be merged along with
the patch adding it.
drivers/mfd/wm831x-otp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/mfd/wm831x-otp.c b/drivers/mfd/wm831x-otp.c
index f742745..b90f3e0 100644
--- a/drivers/mfd/wm831x-otp.c
+++ b/drivers/mfd/wm831x-otp.c
@@ -18,6 +18,7 @@
#include <linux/bcd.h>
#include <linux/delay.h>
#include <linux/mfd/core.h>
+#include <linux/random.h>
#include <linux/mfd/wm831x/core.h>
#include <linux/mfd/wm831x/otp.h>
@@ -66,6 +67,7 @@ static DEVICE_ATTR(unique_id, 0444, wm831x_unique_id_show, NULL);
int wm831x_otp_init(struct wm831x *wm831x)
{
+ char uuid[WM831X_UNIQUE_ID_LEN];
int ret;
ret = device_create_file(wm831x->dev, &dev_attr_unique_id);
@@ -73,6 +75,12 @@ int wm831x_otp_init(struct wm831x *wm831x)
dev_err(wm831x->dev, "Unique ID attribute not created: %d\n",
ret);
+ ret = wm831x_unique_id_read(wm831x, uuid);
+ if (ret == 0)
+ add_device_randomness(uuid, sizeof(uuid));
+ else
+ dev_err(wm831x->dev, "Failed to read UUID: %d\n", ret);
+
return ret;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: mfd: wm831x: Feed the device UUID into device_add_randomness()
2012-07-05 20:23 [PATCH] mfd: wm831x: Feed the device UUID into device_add_randomness() Mark Brown
@ 2012-07-06 21:23 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2012-07-06 21:23 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, linux-kernel, patches
On Thu, Jul 05, 2012 at 08:23:21PM -0000, Mark Brown wrote:
> wm831x devices contain a unique ID value. Feed this into the newly added
> device_add_randomness() to add some per device seed data to the pool.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
> add_device_randomness() has only just been added in -next, this will
> need to either wait until after the merge window or be merged along with
> the patch adding it.
Thanks, I've added this to the /dev/random git tree.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-06 21:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-05 20:23 [PATCH] mfd: wm831x: Feed the device UUID into device_add_randomness() Mark Brown
2012-07-06 21:23 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox