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

    leds: add possibility to remove leds classdevs during suspend/resume
    Make it possible to unregister a led classdev object in a safe way during a
    suspend/resume cycle.
    Signed-off-by: Rafael J. Wysocki <[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/leds/led-class.c |   13 +++++++++----
 include/linux/leds.h     |   10 +++++++++-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 64c66b3..4a93878 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -137,12 +137,14 @@ err_out:
- * led_classdev_unregister - unregisters a object of led_properties class.
+ * __led_classdev_unregister - unregisters a object of led_properties class.
  * @led_cdev: the led device to unregister
+ * @suspended: indicates whether system-wide suspend or resume is in progress
  * Unregisters a previously registered via led_classdev_register object.
-void led_classdev_unregister(struct led_classdev *led_cdev)
+void __led_classdev_unregister(struct led_classdev *led_cdev,
+                                     bool suspended)
        device_remove_file(led_cdev->dev, &dev_attr_brightness);
@@ -153,13 +155,16 @@ void led_classdev_unregister(struct led_classdev 
-       device_unregister(led_cdev->dev);
+       if (suspended)
+               device_pm_schedule_removal(led_cdev->dev);
+       else
+               device_unregister(led_cdev->dev);
 static int __init leds_init(void)
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b4130ff..00f89fd 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -54,7 +54,15 @@ struct led_classdev {
 extern int led_classdev_register(struct device *parent,
                                 struct led_classdev *led_cdev);
-extern void led_classdev_unregister(struct led_classdev *led_cdev);
+extern void __led_classdev_unregister(struct led_classdev *led_cdev, bool sus);
+static inline void led_classdev_unregister(struct led_classdev *lcd)
+       __led_classdev_unregister(lcd, false);
+static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
+       __led_classdev_unregister(lcd, true);
 extern void led_classdev_suspend(struct led_classdev *led_cdev);
 extern void led_classdev_resume(struct led_classdev *led_cdev);
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