Commit:     a41e3dc4060cca2599afa14fbd4c745763746ba8
Parent:     533354d4ac48b7df99f18f952e5d51c3f59ba56c
Author:     Rafael J. Wysocki <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 22:30:13 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Feb 5 09:44:23 2008 -0800

    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 <[EMAIL PROTECTED]>
    Acked-by: Michael Buesch <[EMAIL PROTECTED]>
    Cc: Michael Buesch <[EMAIL PROTECTED]>
    Cc: Pavel Machek <[EMAIL PROTECTED]>
    Cc: "John W. Linville" <[EMAIL PROTECTED]>
    Cc: Alan Stern <[EMAIL PROTECTED]>
    Cc: Len Brown <[EMAIL PROTECTED]>
    Cc: Kay Sievers <[EMAIL PROTECTED]>
    Cc: Richard Purdie <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/char/hw_random/core.c |   10 +++++-----
 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 0118b98..84cdf90 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,
-static void unregister_miscdev(void)
+static void unregister_miscdev(bool suspended)
        device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available);
        device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current);
-       misc_deregister(&rng_miscdev);
+       __misc_deregister(&rng_miscdev, suspended);
 static int register_miscdev(void)
@@ -313,7 +313,7 @@ out:
-void hwrng_unregister(struct hwrng *rng)
+void __hwrng_unregister(struct hwrng *rng, bool suspended)
        int err;
@@ -332,11 +332,11 @@ void hwrng_unregister(struct hwrng *rng)
        if (list_empty(&rng_list))
-               unregister_miscdev();
+               unregister_miscdev(suspended);
 MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 85d1191..4213182 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -44,7 +44,15 @@ struct hwrng {
 /** Register a new Hardware Random Number Generator driver. */
 extern int hwrng_register(struct hwrng *rng);
 /** Unregister a Hardware Random Number Generator driver. */
-extern void hwrng_unregister(struct hwrng *rng);
+extern void __hwrng_unregister(struct hwrng *rng, bool suspended);
+static inline void hwrng_unregister(struct hwrng *rng)
+       __hwrng_unregister(rng, false);
+static inline void hwrng_unregister_suspended(struct hwrng *rng)
+       __hwrng_unregister(rng, true);
 #endif /* __KERNEL__ */
 #endif /* LINUX_HWRANDOM_H_ */
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to