diff options
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r-- | drivers/char/hw_random/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/hw_random/atmel-rng.c | 16 | ||||
-rw-r--r-- | drivers/char/hw_random/bcm2835-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/bcm63xx-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/core.c | 12 | ||||
-rw-r--r-- | drivers/char/hw_random/exynos-rng.c | 3 | ||||
-rw-r--r-- | drivers/char/hw_random/msm-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/mxc-rnga.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/n2-drv.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/octeon-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/omap3-rom-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/pasemi-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/ppc4xx-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/pseries-rng.c | 11 | ||||
-rw-r--r-- | drivers/char/hw_random/timeriomem-rng.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/tx4939-rng.c | 1 |
17 files changed, 24 insertions, 32 deletions
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 91a04ae8003c..de57b38809c7 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -64,7 +64,7 @@ config HW_RANDOM_AMD config HW_RANDOM_ATMEL tristate "Atmel Random Number Generator support" - depends on ARCH_AT91 && HAVE_CLK + depends on ARCH_AT91 && HAVE_CLK && OF default HW_RANDOM ---help--- This driver provides kernel-side support for the Random Number diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c index 851bc7e20ad2..0fcc9e69a346 100644 --- a/drivers/char/hw_random/atmel-rng.c +++ b/drivers/char/hw_random/atmel-rng.c @@ -67,7 +67,7 @@ static int atmel_trng_probe(struct platform_device *pdev) if (IS_ERR(trng->clk)) return PTR_ERR(trng->clk); - ret = clk_enable(trng->clk); + ret = clk_prepare_enable(trng->clk); if (ret) return ret; @@ -95,7 +95,7 @@ static int atmel_trng_remove(struct platform_device *pdev) hwrng_unregister(&trng->rng); writel(TRNG_KEY, trng->base + TRNG_CR); - clk_disable(trng->clk); + clk_disable_unprepare(trng->clk); return 0; } @@ -105,7 +105,7 @@ static int atmel_trng_suspend(struct device *dev) { struct atmel_trng *trng = dev_get_drvdata(dev); - clk_disable(trng->clk); + clk_disable_unprepare(trng->clk); return 0; } @@ -114,7 +114,7 @@ static int atmel_trng_resume(struct device *dev) { struct atmel_trng *trng = dev_get_drvdata(dev); - return clk_enable(trng->clk); + return clk_prepare_enable(trng->clk); } static const struct dev_pm_ops atmel_trng_pm_ops = { @@ -123,15 +123,21 @@ static const struct dev_pm_ops atmel_trng_pm_ops = { }; #endif /* CONFIG_PM */ +static const struct of_device_id atmel_trng_dt_ids[] = { + { .compatible = "atmel,at91sam9g45-trng" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, atmel_trng_dt_ids); + static struct platform_driver atmel_trng_driver = { .probe = atmel_trng_probe, .remove = atmel_trng_remove, .driver = { .name = "atmel-trng", - .owner = THIS_MODULE, #ifdef CONFIG_PM .pm = &atmel_trng_pm_ops, #endif /* CONFIG_PM */ + .of_match_table = atmel_trng_dt_ids, }, }; diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c index e900961cdd2e..7192ec25f667 100644 --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c @@ -99,7 +99,6 @@ MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match); static struct platform_driver bcm2835_rng_driver = { .driver = { .name = "bcm2835-rng", - .owner = THIS_MODULE, .of_match_table = bcm2835_rng_of_match, }, .probe = bcm2835_rng_probe, diff --git a/drivers/char/hw_random/bcm63xx-rng.c b/drivers/char/hw_random/bcm63xx-rng.c index 36581ea562cb..ba6a65ac023b 100644 --- a/drivers/char/hw_random/bcm63xx-rng.c +++ b/drivers/char/hw_random/bcm63xx-rng.c @@ -162,7 +162,6 @@ static struct platform_driver bcm63xx_rng_driver = { .remove = bcm63xx_rng_remove, .driver = { .name = "bcm63xx-rng", - .owner = THIS_MODULE, }, }; diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index aa30a25c8d49..1500cfd799a7 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -281,7 +281,6 @@ static ssize_t hwrng_attr_available_show(struct device *dev, char *buf) { int err; - ssize_t ret = 0; struct hwrng *rng; err = mutex_lock_interruptible(&rng_mutex); @@ -289,16 +288,13 @@ static ssize_t hwrng_attr_available_show(struct device *dev, return -ERESTARTSYS; buf[0] = '\0'; list_for_each_entry(rng, &rng_list, list) { - strncat(buf, rng->name, PAGE_SIZE - ret - 1); - ret += strlen(rng->name); - strncat(buf, " ", PAGE_SIZE - ret - 1); - ret++; + strlcat(buf, rng->name, PAGE_SIZE); + strlcat(buf, " ", PAGE_SIZE); } - strncat(buf, "\n", PAGE_SIZE - ret - 1); - ret++; + strlcat(buf, "\n", PAGE_SIZE); mutex_unlock(&rng_mutex); - return ret; + return strlen(buf); } static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c index 9f8277cc44b4..fed0830bf724 100644 --- a/drivers/char/hw_random/exynos-rng.c +++ b/drivers/char/hw_random/exynos-rng.c @@ -143,7 +143,7 @@ static int exynos_rng_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) +#ifdef CONFIG_PM static int exynos_rng_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -169,7 +169,6 @@ static UNIVERSAL_DEV_PM_OPS(exynos_rng_pm_ops, exynos_rng_runtime_suspend, static struct platform_driver exynos_rng_driver = { .driver = { .name = "exynos-rng", - .owner = THIS_MODULE, .pm = &exynos_rng_pm_ops, }, .probe = exynos_rng_probe, diff --git a/drivers/char/hw_random/msm-rng.c b/drivers/char/hw_random/msm-rng.c index 148521e51dc6..cea1c703d62f 100644 --- a/drivers/char/hw_random/msm-rng.c +++ b/drivers/char/hw_random/msm-rng.c @@ -185,7 +185,6 @@ static struct platform_driver msm_rng_driver = { .remove = msm_rng_remove, .driver = { .name = KBUILD_MODNAME, - .owner = THIS_MODULE, .of_match_table = of_match_ptr(msm_rng_of_match), } }; diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c index 6a86b6f56af2..6cbb72ec6013 100644 --- a/drivers/char/hw_random/mxc-rnga.c +++ b/drivers/char/hw_random/mxc-rnga.c @@ -206,7 +206,6 @@ static int __exit mxc_rnga_remove(struct platform_device *pdev) static struct platform_driver mxc_rnga_driver = { .driver = { .name = "mxc_rnga", - .owner = THIS_MODULE, }, .remove = __exit_p(mxc_rnga_remove), }; diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index 292a5889f675..843d6f6aee7a 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c @@ -750,7 +750,6 @@ MODULE_DEVICE_TABLE(of, n2rng_match); static struct platform_driver n2rng_driver = { .driver = { .name = "n2rng", - .owner = THIS_MODULE, .of_match_table = n2rng_match, }, .probe = n2rng_probe, diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c index b5cc3420c659..be1c3f607398 100644 --- a/drivers/char/hw_random/octeon-rng.c +++ b/drivers/char/hw_random/octeon-rng.c @@ -117,7 +117,6 @@ static int __exit octeon_rng_remove(struct platform_device *pdev) static struct platform_driver octeon_rng_driver = { .driver = { .name = "octeon_rng", - .owner = THIS_MODULE, }, .probe = octeon_rng_probe, .remove = __exit_p(octeon_rng_remove), diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index f66ea258382f..d14dcf788f17 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c @@ -456,7 +456,6 @@ static SIMPLE_DEV_PM_OPS(omap_rng_pm, omap_rng_suspend, omap_rng_resume); static struct platform_driver omap_rng_driver = { .driver = { .name = "omap_rng", - .owner = THIS_MODULE, .pm = OMAP_RNG_PM, .of_match_table = of_match_ptr(omap_rng_of_match), }, diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c index 6f2eaffed623..a405cdcd8dd2 100644 --- a/drivers/char/hw_random/omap3-rom-rng.c +++ b/drivers/char/hw_random/omap3-rom-rng.c @@ -126,7 +126,6 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) static struct platform_driver omap3_rom_rng_driver = { .driver = { .name = "omap3-rom-rng", - .owner = THIS_MODULE, }, .probe = omap3_rom_rng_probe, .remove = omap3_rom_rng_remove, diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c index c0347d1dded0..3eb7bdd7f93b 100644 --- a/drivers/char/hw_random/pasemi-rng.c +++ b/drivers/char/hw_random/pasemi-rng.c @@ -142,7 +142,6 @@ static struct of_device_id rng_match[] = { static struct platform_driver rng_driver = { .driver = { .name = "pasemi-rng", - .owner = THIS_MODULE, .of_match_table = rng_match, }, .probe = rng_probe, diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c index 521f76b0934b..c85d31a5f9e3 100644 --- a/drivers/char/hw_random/ppc4xx-rng.c +++ b/drivers/char/hw_random/ppc4xx-rng.c @@ -133,7 +133,6 @@ static struct of_device_id ppc4xx_rng_match[] = { static struct platform_driver ppc4xx_rng_driver = { .driver = { .name = MODULE_NAME, - .owner = THIS_MODULE, .of_match_table = ppc4xx_rng_match, }, .probe = ppc4xx_rng_probe, diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c index 6226aa08c36a..bcf86f91800a 100644 --- a/drivers/char/hw_random/pseries-rng.c +++ b/drivers/char/hw_random/pseries-rng.c @@ -25,18 +25,21 @@ #include <asm/vio.h> -static int pseries_rng_data_read(struct hwrng *rng, u32 *data) +static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) { + u64 buffer[PLPAR_HCALL_BUFSIZE]; + size_t size = max < 8 ? max : 8; int rc; - rc = plpar_hcall(H_RANDOM, (unsigned long *)data); + rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer); if (rc != H_SUCCESS) { pr_err_ratelimited("H_RANDOM call failed %d\n", rc); return -EIO; } + memcpy(data, buffer, size); /* The hypervisor interface returns 64 bits */ - return 8; + return size; } /** @@ -55,7 +58,7 @@ static unsigned long pseries_rng_get_desired_dma(struct vio_dev *vdev) static struct hwrng pseries_rng = { .name = KBUILD_MODNAME, - .data_read = pseries_rng_data_read, + .read = pseries_rng_read, }; static int __init pseries_rng_probe(struct vio_dev *dev, diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c index b6ab9ac3f34d..cf37db263ecd 100644 --- a/drivers/char/hw_random/timeriomem-rng.c +++ b/drivers/char/hw_random/timeriomem-rng.c @@ -200,7 +200,6 @@ MODULE_DEVICE_TABLE(of, timeriomem_rng_match); static struct platform_driver timeriomem_rng_driver = { .driver = { .name = "timeriomem_rng", - .owner = THIS_MODULE, .of_match_table = timeriomem_rng_match, }, .probe = timeriomem_rng_probe, diff --git a/drivers/char/hw_random/tx4939-rng.c b/drivers/char/hw_random/tx4939-rng.c index 09c5fbea2b93..a7b694913416 100644 --- a/drivers/char/hw_random/tx4939-rng.c +++ b/drivers/char/hw_random/tx4939-rng.c @@ -158,7 +158,6 @@ static int __exit tx4939_rng_remove(struct platform_device *dev) static struct platform_driver tx4939_rng_driver = { .driver = { .name = "tx4939-rng", - .owner = THIS_MODULE, }, .remove = tx4939_rng_remove, }; |