[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1Y3ICj-0007dO-44@gondolin.me.apana.org.au>
Date: Tue, 23 Dec 2014 16:40:21 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Fengguang Wu <fengguang.wu@...el.com>,
Rusty Russell <rusty@...tcorp.com.au>, LKP <lkp@...org>,
linux-kernel@...r.kernel.org,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
Amos Kong <akong@...hat.com>, m@...s.ch, mpm@...enic.com,
amit.shah@...hat.com
Subject: [PATCH 4/5] hwrng: core - Drop current rng in set_current_rng
Rather than having callers of set_current_rng call drop_current_rng,
we can do it directly in set_current_rng.
Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
---
drivers/char/hw_random/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 1d342f0..787ef42 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -70,6 +70,7 @@ 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 void start_khwrngd(void);
static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
@@ -105,6 +106,7 @@ static inline void cleanup_rng(struct kref *kref)
static void set_current_rng(struct hwrng *rng)
{
BUG_ON(!mutex_is_locked(&rng_mutex));
+ drop_current_rng();
current_rng = rng;
}
@@ -315,7 +317,6 @@ static ssize_t hwrng_attr_current_store(struct device *dev,
err = hwrng_init(rng);
if (err)
break;
- drop_current_rng();
set_current_rng(rng);
err = 0;
break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists