summaryrefslogtreecommitdiffstats
path: root/sys-utils/rtcwake.c
diff options
context:
space:
mode:
authorSami Kerola2015-01-10 18:07:09 +0100
committerKarel Zak2015-06-29 13:39:37 +0200
commit5fde2f0d34e71301dc146bfec616564d8c60c872 (patch)
treef5d8f3da33eeb687575988831f8fa386cd2de792 /sys-utils/rtcwake.c
parentrtcwake: replace long if else statement with switch case (diff)
downloadkernel-qcow2-util-linux-5fde2f0d34e71301dc146bfec616564d8c60c872.tar.gz
kernel-qcow2-util-linux-5fde2f0d34e71301dc146bfec616564d8c60c872.tar.xz
kernel-qcow2-util-linux-5fde2f0d34e71301dc146bfec616564d8c60c872.zip
rtcwake: remove RTC_ALM_READ and RTC_ALM_SET compatibility
The RTC_WKALM_RD and RTC_WKALM_SET have been available since 2.6.17, and preferred way since 2007. Keeping the fallbacks to the old interface is no longer needed. Reference: https://github.com/torvalds/linux/commit/e824290e5dcfaf2120da587b16d10dfdff8d5d3e Reference: https://github.com/torvalds/linux/commit/f8245c26886c912627ebc49f714e4491261224c4 Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/rtcwake.c')
-rw-r--r--sys-utils/rtcwake.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 4eb539624..3c8238d27 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -249,24 +249,9 @@ static int setup_alarm(struct rtcwake_control *ctl, int fd, time_t *wakeup)
wake.enabled = 1;
- /* First try the preferred RTC_WKALM_SET */
if (!ctl->dryrun && ioctl(fd, RTC_WKALM_SET, &wake) < 0) {
- wake.enabled = 0;
- /* Fall back on the non-preferred way of setting wakeups; only
- * works for alarms < 24 hours from now */
- if ((ctl->rtc_time + (24 * 60 * 60)) > *wakeup) {
- if (ioctl(fd, RTC_ALM_SET, &wake.time) < 0) {
- warn(_("set rtc alarm failed"));
- return -1;
- }
- if (ioctl(fd, RTC_AIE_ON, 0) < 0) {
- warn(_("enable rtc alarm failed"));
- return -1;
- }
- } else {
- warn(_("set rtc wake alarm failed"));
- return -1;
- }
+ warn(_("set rtc wake alarm failed"));
+ return -1;
}
return 0;
@@ -357,19 +342,9 @@ static int print_alarm(struct rtcwake_control *ctl, int fd)
struct tm tm;
time_t alarm;
- /* First try the preferred RTC_WKALM_RD */
if (ioctl(fd, RTC_WKALM_RD, &wake) < 0) {
- /* Fall back on the non-preferred way of reading wakeups; only
- * works for alarms < 24 hours from now
- *
- * set wake.enabled to 1 and determine from value of the year-1
- * means disabled
- */
- wake.enabled = 1;
- if (ioctl(fd, RTC_ALM_READ, &wake.time) < 0) {
- warn(_("read rtc alarm failed"));
- return -1;
- }
+ warn(_("read rtc alarm failed"));
+ return -1;
}
if (wake.enabled != 1 || wake.time.tm_year == -1) {
@@ -659,16 +634,11 @@ int main(int argc, char **argv)
}
if (!ctl.dryrun) {
- /* try to disable the alarm with the preferred RTC_WKALM_RD and
- * RTC_WKALM_SET calls, if it fails fall back to RTC_AIE_OFF
- */
struct rtc_wkalrm wake;
if (ioctl(fd, RTC_WKALM_RD, &wake) < 0) {
- if (ioctl(fd, RTC_AIE_OFF, 0) < 0) {
- warn(_("disable rtc alarm interrupt failed"));
- rc = EXIT_FAILURE;
- }
+ warn(_("read rtc alarm failed"));
+ rc = EXIT_FAILURE;
} else {
wake.enabled = 0;
if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) {