diff options
author | KalimochoAz <calimochoazucarado@gmail.com> | 2012-08-30 21:49:20 +0200 |
---|---|---|
committer | KalimochoAz <calimochoazucarado@gmail.com> | 2012-08-30 21:49:20 +0200 |
commit | 2a4a7840c4bf66614b49c2828947f2cccb6ab36f (patch) | |
tree | a2b98163d6f4ae05a9f0557e484cc120603a42c6 /drivers/rtc | |
parent | de60756ed5f5a5c82d5c799850148f68346e5918 (diff) | |
parent | 5aa287dcf1b5879aa0150b0511833c52885f5b4c (diff) | |
download | kernel_samsung_crespo-2a4a7840c4bf66614b49c2828947f2cccb6ab36f.zip kernel_samsung_crespo-2a4a7840c4bf66614b49c2828947f2cccb6ab36f.tar.gz kernel_samsung_crespo-2a4a7840c4bf66614b49c2828947f2cccb6ab36f.tar.bz2 |
Merge branch 'linux-3.0.y' into HEAD
Conflicts:
drivers/net/tun.c
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-wm831x.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index bdc909b..f3c2110 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c @@ -24,7 +24,7 @@ #include <linux/mfd/wm831x/core.h> #include <linux/delay.h> #include <linux/platform_device.h> - +#include <linux/random.h> /* * R16416 (0x4020) - RTC Write Counter @@ -96,6 +96,26 @@ struct wm831x_rtc { unsigned int alarm_enabled:1; }; +static void wm831x_rtc_add_randomness(struct wm831x *wm831x) +{ + int ret; + u16 reg; + + /* + * The write counter contains a pseudo-random number which is + * regenerated every time we set the RTC so it should be a + * useful per-system source of entropy. + */ + ret = wm831x_reg_read(wm831x, WM831X_RTC_WRITE_COUNTER); + if (ret >= 0) { + reg = ret; + add_device_randomness(®, sizeof(reg)); + } else { + dev_warn(wm831x->dev, "Failed to read RTC write counter: %d\n", + ret); + } +} + /* * Read current time and date in RTC */ @@ -449,6 +469,8 @@ static int wm831x_rtc_probe(struct platform_device *pdev) alm_irq, ret); } + wm831x_rtc_add_randomness(wm831x); + return 0; err: |