hwrng: Use KBUILD_MODNAME in pseries-rng.c
Subsystems (2)
PATCH 1/2 hwrng: Use KBUILD_MODNAME in pseries-rng.c
Signed-off-by Michael Ellerman <[email protected]>
--- drivers/char/hw_random/pseries-rng.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/char/hw_random/pseries-rng.c +2 -3
@@ -21,7 +21,6 @@#include <linux/hw_random.h> #include <asm/vio.h> -#define MODULE_NAME "pseries-rng"static int pseries_rng_data_read (struct hwrng *rng,u32 *data) {
@@ -47,7 +46,7 @@ static unsigned long pseries_rng_get_desired_dma(struct vio_dev *vdev) };static struct hwrng pseries_rng = { - .name =MODULE_NAME , + .name =KBUILD_MODNAME , .data_read = pseries_rng_data_read, };
@@ -70,7 +69,7 @@ static struct vio_device_id pseries_rng_driver_ids[] = {MODULE_DEVICE_TABLE (vio, pseries_rng_driver_ids);static struct vio_driver pseries_rng_driver = { - .name =MODULE_NAME , + .name =KBUILD_MODNAME , .probe = pseries_rng_probe, .remove = pseries_rng_remove, .get_desired_dma = pseries_rng_get_desired_dma,
Signature · 1 line
1.8.1.2
PATCH 2/2 hwrng: Return errors to upper levels in pseries-rng.c
We don't expect to get errors from the hypervisor when reading the rng, but if we do we should pass the error up to the hwrng driver. Otherwise the hwrng driver will continue calling us forever.
Signed-off-by Michael Ellerman <[email protected]>
--- drivers/char/hw_random/pseries-rng.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/char/hw_random/pseries-rng.c +11 -3
@@ -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 ; }
Signature · 1 line
1.8.1.2
Quoted 1 line · Michael Ellerman
Signed-off-by Michael Ellerman <[email protected]>
Both patches applied.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt