@@ -49,7 +49,6 @@ module_param(default_quality, ushort, 0644);
MODULE_PARM_DESC(default_quality,
"default entropy content of hwrng per mill");
-static void drop_current_rng(void);
static int hwrng_init(struct hwrng *rng);
static void start_khwrngd(void);
@@ -83,6 +82,17 @@ static inline void cleanup_rng(struct kref *kref)
complete(&rng->cleanup_done);
}
+static void drop_current_rng(void)
+{
+ BUG_ON(!mutex_is_locked(&rng_mutex));
+ if (!current_rng)
+ return;
+
+ /* decrease last reference for triggering the cleanup */
+ kref_put(¤t_rng->ref, cleanup_rng);
+ current_rng = NULL;
+}
+
static int set_current_rng(struct hwrng *rng)
{
int err;
@@ -99,17 +109,6 @@ static int set_current_rng(struct hwrng *rng)
return 0;
}
-static void drop_current_rng(void)
-{
- BUG_ON(!mutex_is_locked(&rng_mutex));
- if (!current_rng)
- return;
-
- /* decrease last reference for triggering the cleanup */
- kref_put(¤t_rng->ref, cleanup_rng);
- current_rng = NULL;
-}
-
/* Returns ERR_PTR(), NULL or refcounted hwrng */
static struct hwrng *get_current_rng(void)
{
Rearrange drop_current_rng such that its forward declaration is not required. Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> --- drivers/char/hw_random/core.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)