diff options
Diffstat (limited to 'drivers/hw_random/core.c')
-rw-r--r-- | drivers/hw_random/core.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/hw_random/core.c b/drivers/hw_random/core.c index 86214dc8ba..7bc3c33319 100644 --- a/drivers/hw_random/core.c +++ b/drivers/hw_random/core.c @@ -1,10 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016 Pengutronix, Steffen Trumtrar <kernel@pengutronix.de> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * * derived from Linux kernel drivers/char/hw_random/core.c */ @@ -47,10 +44,10 @@ static ssize_t rng_dev_read(struct cdev *cdev, void *buf, size_t size, while (count) { int max = min(count, (size_t)RNG_BUFFER_SIZE); len = hwrng_get_data(rng, rng->buf, max, true); - if (len < 0) { - cur = len; - break; - } + if (len < 0) + return len; + if (!len && ctrlc()) + return cur; memcpy(buf + cur, rng->buf, len); @@ -67,12 +64,12 @@ static struct cdev_operations rng_chrdev_ops = { static int hwrng_register_cdev(struct hwrng *rng) { - struct device_d *dev = rng->dev; + struct device *dev = rng->dev; const char *alias; char *devname; int err; - alias = of_alias_get(dev->device_node); + alias = of_alias_get(dev->of_node); if (alias) { devname = xstrdup(alias); } else { @@ -106,7 +103,7 @@ struct hwrng *hwrng_get_first(void) return list_first_entry(&hwrngs, struct hwrng, list); } -int hwrng_register(struct device_d *dev, struct hwrng *rng) +int hwrng_register(struct device *dev, struct hwrng *rng) { int err; |