Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330117
b: refs/heads/master
c: 4c24e29
h: refs/heads/master
i:
  330115: 7ebcad6
v: v3
  • Loading branch information
David Fries authored and Linus Torvalds committed Oct 5, 2012
1 parent 2c0bd27 commit 91010db
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be8b6d510072461b50958527e7b157f53e5388d7
refs/heads/master: 4c24e29e65843ed912c14cdc293ed922e33efdcc
8 changes: 7 additions & 1 deletion trunk/drivers/rtc/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ static void rtc_device_release(struct device *dev)
kfree(rtc);
}

#if defined(CONFIG_PM) && defined(CONFIG_RTC_HCTOSYS_DEVICE)
#ifdef CONFIG_RTC_HCTOSYS_DEVICE
/* Result of the last RTC to system clock attempt. */
int rtc_hctosys_ret = -ENODEV;
#endif

#if defined(CONFIG_PM) && defined(CONFIG_RTC_HCTOSYS_DEVICE)
/*
* On suspend(), measure the delta between one RTC and the
* system's wall clock; restore it on resume().
Expand Down Expand Up @@ -84,6 +88,7 @@ static int rtc_resume(struct device *dev)
struct timespec new_system, new_rtc;
struct timespec sleep_time;

rtc_hctosys_ret = -ENODEV;
if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
return 0;

Expand Down Expand Up @@ -117,6 +122,7 @@ static int rtc_resume(struct device *dev)

if (sleep_time.tv_sec >= 0)
timekeeping_inject_sleeptime(&sleep_time);
rtc_hctosys_ret = 0;
return 0;
}

Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/rtc/hctosys.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* the best guess is to add 0.5s.
*/

int rtc_hctosys_ret = -ENODEV;

static int __init rtc_hctosys(void)
{
int err = -ENODEV;
Expand Down Expand Up @@ -56,7 +54,7 @@ static int __init rtc_hctosys(void)

rtc_tm_to_time(&tm, &tv.tv_sec);

do_settimeofday(&tv);
err = do_settimeofday(&tv);

dev_info(rtc->dev.parent,
"setting system clock to "
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/rtc/rtc-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
return n;
}

/**
* rtc_sysfs_show_hctosys - indicate if the given RTC set the system time
*
* Returns 1 if the system clock was set by this RTC at the last
* boot or resume event.
*/
static ssize_t
rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr,
char *buf)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static inline bool is_leap_year(unsigned int year)
return (!(year % 4) && (year % 100)) || !(year % 400);
}

#ifdef CONFIG_RTC_HCTOSYS
#ifdef CONFIG_RTC_HCTOSYS_DEVICE
extern int rtc_hctosys_ret;
#else
#define rtc_hctosys_ret -ENODEV
Expand Down

0 comments on commit 91010db

Please sign in to comment.