rtc: cleanup example code
No functional changes here, just tighten up style/whitespace. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
8a0ba4e017
commit
8696e70267
@@ -268,8 +268,8 @@ int main(int argc, char **argv)
|
|||||||
/* This read will block */
|
/* This read will block */
|
||||||
retval = read(fd, &data, sizeof(unsigned long));
|
retval = read(fd, &data, sizeof(unsigned long));
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
perror("read");
|
perror("read");
|
||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
fprintf(stderr, " %d",i);
|
fprintf(stderr, " %d",i);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@@ -326,11 +326,11 @@ test_READ:
|
|||||||
rtc_tm.tm_sec %= 60;
|
rtc_tm.tm_sec %= 60;
|
||||||
rtc_tm.tm_min++;
|
rtc_tm.tm_min++;
|
||||||
}
|
}
|
||||||
if (rtc_tm.tm_min == 60) {
|
if (rtc_tm.tm_min == 60) {
|
||||||
rtc_tm.tm_min = 0;
|
rtc_tm.tm_min = 0;
|
||||||
rtc_tm.tm_hour++;
|
rtc_tm.tm_hour++;
|
||||||
}
|
}
|
||||||
if (rtc_tm.tm_hour == 24)
|
if (rtc_tm.tm_hour == 24)
|
||||||
rtc_tm.tm_hour = 0;
|
rtc_tm.tm_hour = 0;
|
||||||
|
|
||||||
retval = ioctl(fd, RTC_ALM_SET, &rtc_tm);
|
retval = ioctl(fd, RTC_ALM_SET, &rtc_tm);
|
||||||
@@ -407,8 +407,8 @@ test_PIE:
|
|||||||
"\n...Periodic IRQ rate is fixed\n");
|
"\n...Periodic IRQ rate is fixed\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
perror("RTC_IRQP_SET ioctl");
|
perror("RTC_IRQP_SET ioctl");
|
||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\n%ldHz:\t", tmp);
|
fprintf(stderr, "\n%ldHz:\t", tmp);
|
||||||
@@ -417,27 +417,27 @@ test_PIE:
|
|||||||
/* Enable periodic interrupts */
|
/* Enable periodic interrupts */
|
||||||
retval = ioctl(fd, RTC_PIE_ON, 0);
|
retval = ioctl(fd, RTC_PIE_ON, 0);
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
perror("RTC_PIE_ON ioctl");
|
perror("RTC_PIE_ON ioctl");
|
||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=1; i<21; i++) {
|
for (i=1; i<21; i++) {
|
||||||
/* This blocks */
|
/* This blocks */
|
||||||
retval = read(fd, &data, sizeof(unsigned long));
|
retval = read(fd, &data, sizeof(unsigned long));
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
perror("read");
|
perror("read");
|
||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
fprintf(stderr, " %d",i);
|
fprintf(stderr, " %d",i);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
irqcount++;
|
irqcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable periodic interrupts */
|
/* Disable periodic interrupts */
|
||||||
retval = ioctl(fd, RTC_PIE_OFF, 0);
|
retval = ioctl(fd, RTC_PIE_OFF, 0);
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
perror("RTC_PIE_OFF ioctl");
|
perror("RTC_PIE_OFF ioctl");
|
||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user