diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-07-05 16:23:21 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-07-19 10:38:31 -0400 |
commit | 27130f0cc3ab97560384da437e4621fc4e94f21c (patch) | |
tree | 9570e047ca81c21252501ab5d3494b3160902289 /drivers/mfd | |
parent | 9dccf55f4cb011a7552a8a2749a580662f5ed8ed (diff) |
mfd: wm831x: Feed the device UUID into device_add_randomness()
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/wm831x-otp.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mfd/wm831x-otp.c b/drivers/mfd/wm831x-otp.c index f742745ff35..b90f3e06b6c 100644 --- a/drivers/mfd/wm831x-otp.c +++ b/drivers/mfd/wm831x-otp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/bcd.h> | 18 | #include <linux/bcd.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/mfd/core.h> | 20 | #include <linux/mfd/core.h> |
21 | #include <linux/random.h> | ||
21 | 22 | ||
22 | #include <linux/mfd/wm831x/core.h> | 23 | #include <linux/mfd/wm831x/core.h> |
23 | #include <linux/mfd/wm831x/otp.h> | 24 | #include <linux/mfd/wm831x/otp.h> |
@@ -66,6 +67,7 @@ static DEVICE_ATTR(unique_id, 0444, wm831x_unique_id_show, NULL); | |||
66 | 67 | ||
67 | int wm831x_otp_init(struct wm831x *wm831x) | 68 | int wm831x_otp_init(struct wm831x *wm831x) |
68 | { | 69 | { |
70 | char uuid[WM831X_UNIQUE_ID_LEN]; | ||
69 | int ret; | 71 | int ret; |
70 | 72 | ||
71 | ret = device_create_file(wm831x->dev, &dev_attr_unique_id); | 73 | ret = device_create_file(wm831x->dev, &dev_attr_unique_id); |
@@ -73,6 +75,12 @@ int wm831x_otp_init(struct wm831x *wm831x) | |||
73 | dev_err(wm831x->dev, "Unique ID attribute not created: %d\n", | 75 | dev_err(wm831x->dev, "Unique ID attribute not created: %d\n", |
74 | ret); | 76 | ret); |
75 | 77 | ||
78 | ret = wm831x_unique_id_read(wm831x, uuid); | ||
79 | if (ret == 0) | ||
80 | add_device_randomness(uuid, sizeof(uuid)); | ||
81 | else | ||
82 | dev_err(wm831x->dev, "Failed to read UUID: %d\n", ret); | ||
83 | |||
76 | return ret; | 84 | return ret; |
77 | } | 85 | } |
78 | 86 | ||