Skip to content

Commit

Permalink
leds: Convert led class driver from legacy pm ops to dev_pm_ops
Browse files Browse the repository at this point in the history
Convert drivers/leds/led-class to use dev_pm_ops for power management and
remove Legacy PM ops hooks. With this change, led class registers
suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy
class->suspend/resume. When __device_suspend() runs call-backs, it will
find class->pm ops for the led class.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
Shuah Khan authored and Bryan Wu committed Jun 21, 2013
1 parent ae6cdb0 commit 73e1ab4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void led_classdev_resume(struct led_classdev *led_cdev)
}
EXPORT_SYMBOL_GPL(led_classdev_resume);

static int led_suspend(struct device *dev, pm_message_t state)
static int led_suspend(struct device *dev)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);

Expand All @@ -176,6 +176,11 @@ static int led_resume(struct device *dev)
return 0;
}

static const struct dev_pm_ops leds_class_dev_pm_ops = {
.suspend = led_suspend,
.resume = led_resume,
};

/**
* led_classdev_register - register a new object of led_classdev class.
* @parent: The device to register.
Expand Down Expand Up @@ -252,8 +257,7 @@ static int __init leds_init(void)
leds_class = class_create(THIS_MODULE, "leds");
if (IS_ERR(leds_class))
return PTR_ERR(leds_class);
leds_class->suspend = led_suspend;
leds_class->resume = led_resume;
leds_class->pm = &leds_class_dev_pm_ops;
leds_class->dev_attrs = led_class_attrs;
return 0;
}
Expand Down

0 comments on commit 73e1ab4

Please sign in to comment.