@@ -52,14 +52,30 @@ MODULE_PARM_DESC(default_quality,
static int hwrng_init(struct hwrng *rng);
static void start_khwrngd(void);
-static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
- int wait);
-
static size_t rng_buffer_size(void)
{
return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES;
}
+static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
+ int wait) {
+ int present;
+
+ BUG_ON(!mutex_is_locked(&reading_mutex));
+ if (rng->read)
+ return rng->read(rng, (void *)buffer, size, wait);
+
+ if (rng->data_present)
+ present = rng->data_present(rng, wait);
+ else
+ present = 1;
+
+ if (present)
+ return rng->data_read(rng, (u32 *)buffer);
+
+ return 0;
+}
+
static void add_early_randomness(struct hwrng *rng)
{
int bytes_read;
@@ -178,25 +194,6 @@ static int rng_dev_open(struct inode *inode, struct file *filp)
return 0;
}
-static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
- int wait) {
- int present;
-
- BUG_ON(!mutex_is_locked(&reading_mutex));
- if (rng->read)
- return rng->read(rng, (void *)buffer, size, wait);
-
- if (rng->data_present)
- present = rng->data_present(rng, wait);
- else
- present = 1;
-
- if (present)
- return rng->data_read(rng, (u32 *)buffer);
-
- return 0;
-}
-
static ssize_t rng_dev_read(struct file *filp, char __user *buf,
size_t size, loff_t *offp)
{
Rearrange rng_get_data such that its forward declaration is not required. Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> --- drivers/char/hw_random/core.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-)