diff options
-rw-r--r-- | drivers/char/hw_random/core.c | 10 | ||||
-rw-r--r-- | include/linux/hw_random.h | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 0118b9817a95..84cdf9025737 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -234,11 +234,11 @@ static DEVICE_ATTR(rng_available, S_IRUGO, | |||
234 | NULL); | 234 | NULL); |
235 | 235 | ||
236 | 236 | ||
237 | static void unregister_miscdev(void) | 237 | static void unregister_miscdev(bool suspended) |
238 | { | 238 | { |
239 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); | 239 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); |
240 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); | 240 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); |
241 | misc_deregister(&rng_miscdev); | 241 | __misc_deregister(&rng_miscdev, suspended); |
242 | } | 242 | } |
243 | 243 | ||
244 | static int register_miscdev(void) | 244 | static int register_miscdev(void) |
@@ -313,7 +313,7 @@ out: | |||
313 | } | 313 | } |
314 | EXPORT_SYMBOL_GPL(hwrng_register); | 314 | EXPORT_SYMBOL_GPL(hwrng_register); |
315 | 315 | ||
316 | void hwrng_unregister(struct hwrng *rng) | 316 | void __hwrng_unregister(struct hwrng *rng, bool suspended) |
317 | { | 317 | { |
318 | int err; | 318 | int err; |
319 | 319 | ||
@@ -332,11 +332,11 @@ void hwrng_unregister(struct hwrng *rng) | |||
332 | } | 332 | } |
333 | } | 333 | } |
334 | if (list_empty(&rng_list)) | 334 | if (list_empty(&rng_list)) |
335 | unregister_miscdev(); | 335 | unregister_miscdev(suspended); |
336 | 336 | ||
337 | mutex_unlock(&rng_mutex); | 337 | mutex_unlock(&rng_mutex); |
338 | } | 338 | } |
339 | EXPORT_SYMBOL_GPL(hwrng_unregister); | 339 | EXPORT_SYMBOL_GPL(__hwrng_unregister); |
340 | 340 | ||
341 | 341 | ||
342 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); | 342 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); |
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index 85d11916e9ea..42131820bb89 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h | |||
@@ -44,7 +44,15 @@ struct hwrng { | |||
44 | /** Register a new Hardware Random Number Generator driver. */ | 44 | /** Register a new Hardware Random Number Generator driver. */ |
45 | extern int hwrng_register(struct hwrng *rng); | 45 | extern int hwrng_register(struct hwrng *rng); |
46 | /** Unregister a Hardware Random Number Generator driver. */ | 46 | /** Unregister a Hardware Random Number Generator driver. */ |
47 | extern void hwrng_unregister(struct hwrng *rng); | 47 | extern void __hwrng_unregister(struct hwrng *rng, bool suspended); |
48 | static inline void hwrng_unregister(struct hwrng *rng) | ||
49 | { | ||
50 | __hwrng_unregister(rng, false); | ||
51 | } | ||
52 | static inline void hwrng_unregister_suspended(struct hwrng *rng) | ||
53 | { | ||
54 | __hwrng_unregister(rng, true); | ||
55 | } | ||
48 | 56 | ||
49 | #endif /* __KERNEL__ */ | 57 | #endif /* __KERNEL__ */ |
50 | #endif /* LINUX_HWRANDOM_H_ */ | 58 | #endif /* LINUX_HWRANDOM_H_ */ |