diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-02-05 01:30:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:23 -0500 |
commit | a41e3dc4060cca2599afa14fbd4c745763746ba8 (patch) | |
tree | c97d189602b6564054f348dbfc2c865baafecd96 /drivers/char/hw_random | |
parent | 533354d4ac48b7df99f18f952e5d51c3f59ba56c (diff) |
HWRNG: add possibility to remove hwrng devices during suspend/resume
Make it possible to unregister a Hardware Random Number Generator
device object in a safe way during a suspend/resume cycle.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Michael Buesch <mb@bu3sch.de>
Cc: Michael Buesch <mb@bu3sch.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r-- | drivers/char/hw_random/core.c | 10 |
1 files changed, 5 insertions, 5 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"); |