@@ -49,8 +49,6 @@ module_param(default_quality, ushort, 0644);
MODULE_PARM_DESC(default_quality,
"default entropy content of hwrng per mill");
-static int hwrng_init(struct hwrng *rng);
-
static size_t rng_buffer_size(void)
{
return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES;
@@ -108,22 +106,6 @@ static void drop_current_rng(void)
current_rng = NULL;
}
-static int set_current_rng(struct hwrng *rng)
-{
- int err;
-
- BUG_ON(!mutex_is_locked(&rng_mutex));
-
- err = hwrng_init(rng);
- if (err)
- return err;
-
- drop_current_rng();
- current_rng = rng;
-
- return 0;
-}
-
/* Returns ERR_PTR(), NULL or refcounted hwrng */
static struct hwrng *get_current_rng(void)
{
@@ -220,6 +202,22 @@ static int hwrng_init(struct hwrng *rng)
return 0;
}
+static int set_current_rng(struct hwrng *rng)
+{
+ int err;
+
+ BUG_ON(!mutex_is_locked(&rng_mutex));
+
+ err = hwrng_init(rng);
+ if (err)
+ return err;
+
+ drop_current_rng();
+ current_rng = rng;
+
+ return 0;
+}
+
static int rng_dev_open(struct inode *inode, struct file *filp)
{
/* enforce read-only access to this chrdev */
Rearrange set_current_rng such that hwrng_init's forward declaration can be removed. Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> --- drivers/char/hw_random/core.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)