Commit 408cc6eb authored by Michał Mirosław's avatar Michał Mirosław Committed by Jonathan Cameron

iio: magnetometer: ak8974: add_device_randomness (serial number)

Mix device-specific data into randomness pool.
Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 21be26fc
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/random.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -470,6 +471,7 @@ static int ak8974_detect(struct ak8974 *ak8974) ...@@ -470,6 +471,7 @@ static int ak8974_detect(struct ak8974 *ak8974)
ret = ak8974_get_u16_val(ak8974, AMI305_SN, &sn); ret = ak8974_get_u16_val(ak8974, AMI305_SN, &sn);
if (ret) if (ret)
return ret; return ret;
add_device_randomness(&sn, sizeof(sn));
dev_info(&ak8974->i2c->dev, dev_info(&ak8974->i2c->dev,
"detected %s, FW ver %02x, S/N: %04x\n", "detected %s, FW ver %02x, S/N: %04x\n",
name, fw, sn); name, fw, sn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment