Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/class: convert from Legacy pm ops to dev_pm_ops

Convert drivers/rtc/class to use dev_pm_ops for power management and
remove Legacy PM ops hooks. With this change, rtc 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 rtc class.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Shuah Khan <shuahkhan@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Shuah Khan and committed by
Linus Torvalds
92e7f04a 4c5591c1

+6 -6
+6 -6
drivers/rtc/class.c
··· 38 38 int rtc_hctosys_ret = -ENODEV; 39 39 #endif 40 40 41 - #if defined(CONFIG_PM) && defined(CONFIG_RTC_HCTOSYS_DEVICE) 41 + #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_RTC_HCTOSYS_DEVICE) 42 42 /* 43 43 * On suspend(), measure the delta between one RTC and the 44 44 * system's wall clock; restore it on resume(). ··· 47 47 static struct timespec old_rtc, old_system, old_delta; 48 48 49 49 50 - static int rtc_suspend(struct device *dev, pm_message_t mesg) 50 + static int rtc_suspend(struct device *dev) 51 51 { 52 52 struct rtc_device *rtc = to_rtc_device(dev); 53 53 struct rtc_time tm; ··· 135 135 return 0; 136 136 } 137 137 138 + static SIMPLE_DEV_PM_OPS(rtc_class_dev_pm_ops, rtc_suspend, rtc_resume); 139 + #define RTC_CLASS_DEV_PM_OPS (&rtc_class_dev_pm_ops) 138 140 #else 139 - #define rtc_suspend NULL 140 - #define rtc_resume NULL 141 + #define RTC_CLASS_DEV_PM_OPS NULL 141 142 #endif 142 143 143 144 ··· 337 336 pr_err("couldn't create class\n"); 338 337 return PTR_ERR(rtc_class); 339 338 } 340 - rtc_class->suspend = rtc_suspend; 341 - rtc_class->resume = rtc_resume; 339 + rtc_class->pm = RTC_CLASS_DEV_PM_OPS; 342 340 rtc_dev_init(); 343 341 rtc_sysfs_init(rtc_class); 344 342 return 0;