|
@@ -17,6 +17,9 @@
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
*/
|
|
|
|
|
|
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
+
|
|
|
+#include <linux/kernel.h>
|
|
|
#include <linux/module.h>
|
|
|
#include <linux/hw_random.h>
|
|
|
#include <asm/vio.h>
|
|
@@ -24,10 +27,15 @@
|
|
|
|
|
|
static int pseries_rng_data_read(struct hwrng *rng, u32 *data)
|
|
|
{
|
|
|
- if (plpar_hcall(H_RANDOM, (unsigned long *)data) != H_SUCCESS) {
|
|
|
- printk(KERN_ERR "pseries rng hcall error\n");
|
|
|
- return 0;
|
|
|
+ int rc;
|
|
|
+
|
|
|
+ rc = plpar_hcall(H_RANDOM, (unsigned long *)data);
|
|
|
+ if (rc != H_SUCCESS) {
|
|
|
+ pr_err_ratelimited("H_RANDOM call failed %d\n", rc);
|
|
|
+ return -EIO;
|
|
|
}
|
|
|
+
|
|
|
+ /* The hypervisor interface returns 64 bits */
|
|
|
return 8;
|
|
|
}
|
|
|
|