Commit 6d73ceab authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Shuah Khan (Samsung OSG)

selftests: timers: rtcpie: restore previous PIE rate

After the test ends, restore the PIE rate to its previous value to be less
disruptive.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
parent 843b20bc
...@@ -28,7 +28,7 @@ static const char default_rtc[] = "/dev/rtc0"; ...@@ -28,7 +28,7 @@ static const char default_rtc[] = "/dev/rtc0";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i, fd, retval, irqcount = 0; int i, fd, retval, irqcount = 0;
unsigned long tmp, data; unsigned long tmp, data, old_pie_rate;
const char *rtc = default_rtc; const char *rtc = default_rtc;
struct timeval start, end, diff; struct timeval start, end, diff;
...@@ -51,7 +51,7 @@ int main(int argc, char **argv) ...@@ -51,7 +51,7 @@ int main(int argc, char **argv)
} }
/* Read periodic IRQ rate */ /* Read periodic IRQ rate */
retval = ioctl(fd, RTC_IRQP_READ, &tmp); retval = ioctl(fd, RTC_IRQP_READ, &old_pie_rate);
if (retval == -1) { if (retval == -1) {
/* not all RTCs support periodic IRQs */ /* not all RTCs support periodic IRQs */
if (errno == EINVAL) { if (errno == EINVAL) {
...@@ -61,7 +61,7 @@ int main(int argc, char **argv) ...@@ -61,7 +61,7 @@ int main(int argc, char **argv)
perror("RTC_IRQP_READ ioctl"); perror("RTC_IRQP_READ ioctl");
exit(errno); exit(errno);
} }
fprintf(stderr, "\nPeriodic IRQ rate is %ldHz.\n", tmp); fprintf(stderr, "\nPeriodic IRQ rate is %ldHz.\n", old_pie_rate);
fprintf(stderr, "Counting 20 interrupts at:"); fprintf(stderr, "Counting 20 interrupts at:");
fflush(stderr); fflush(stderr);
...@@ -124,6 +124,8 @@ int main(int argc, char **argv) ...@@ -124,6 +124,8 @@ int main(int argc, char **argv)
} }
done: done:
ioctl(fd, RTC_IRQP_SET, old_pie_rate);
fprintf(stderr, "\n\n\t\t\t *** Test complete ***\n"); fprintf(stderr, "\n\n\t\t\t *** Test complete ***\n");
close(fd); close(fd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment