Lines 800-806
static void __exit cmos_do_remove(struct
Link Here
|
800 |
static int cmos_suspend(struct device *dev, pm_message_t mesg) |
800 |
static int cmos_suspend(struct device *dev, pm_message_t mesg) |
801 |
{ |
801 |
{ |
802 |
struct cmos_rtc *cmos = dev_get_drvdata(dev); |
802 |
struct cmos_rtc *cmos = dev_get_drvdata(dev); |
803 |
int do_wake = device_may_wakeup(dev); |
|
|
804 |
unsigned char tmp; |
803 |
unsigned char tmp; |
805 |
|
804 |
|
806 |
/* only the alarm might be a wakeup event source */ |
805 |
/* only the alarm might be a wakeup event source */ |
Lines 809-815
static int cmos_suspend(struct device *d
Link Here
|
809 |
if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { |
808 |
if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { |
810 |
unsigned char mask; |
809 |
unsigned char mask; |
811 |
|
810 |
|
812 |
if (do_wake) |
811 |
if (device_may_wakeup(dev)) |
813 |
mask = RTC_IRQMASK & ~RTC_AIE; |
812 |
mask = RTC_IRQMASK & ~RTC_AIE; |
814 |
else |
813 |
else |
815 |
mask = RTC_IRQMASK; |
814 |
mask = RTC_IRQMASK; |
Lines 837-842
static int cmos_suspend(struct device *d
Link Here
|
837 |
return 0; |
836 |
return 0; |
838 |
} |
837 |
} |
839 |
|
838 |
|
|
|
839 |
static inline int cmos_poweroff(struct device *dev) |
840 |
{ |
841 |
return cmos_suspend(dev, PMSG_HIBERNATE); |
842 |
} |
843 |
|
840 |
static int cmos_resume(struct device *dev) |
844 |
static int cmos_resume(struct device *dev) |
841 |
{ |
845 |
{ |
842 |
struct cmos_rtc *cmos = dev_get_drvdata(dev); |
846 |
struct cmos_rtc *cmos = dev_get_drvdata(dev); |
Lines 884-889
static int cmos_resume(struct device *de
Link Here
|
884 |
#else |
888 |
#else |
885 |
#define cmos_suspend NULL |
889 |
#define cmos_suspend NULL |
886 |
#define cmos_resume NULL |
890 |
#define cmos_resume NULL |
|
|
891 |
|
892 |
static inline int cmos_poweroff(struct device *dev) { return -ENOSYS; } |
887 |
#endif |
893 |
#endif |
888 |
|
894 |
|
889 |
/*----------------------------------------------------------------*/ |
895 |
/*----------------------------------------------------------------*/ |
Lines 986-991
static int __exit cmos_platform_remove(s
Link Here
|
986 |
|
992 |
|
987 |
static void cmos_platform_shutdown(struct platform_device *pdev) |
993 |
static void cmos_platform_shutdown(struct platform_device *pdev) |
988 |
{ |
994 |
{ |
|
|
995 |
if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pdev->dev)) |
996 |
return; |
997 |
|
989 |
cmos_do_shutdown(); |
998 |
cmos_do_shutdown(); |
990 |
} |
999 |
} |
991 |
|
1000 |
|