From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Shuah Khan <shuah@kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-rtc@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: [PATCH 2/4] selftests: timers: rtcpie: restore previous PIE rate
Date: Thu, 19 Apr 2018 14:50:28 +0200 [thread overview]
Message-ID: <20180419125030.5076-3-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20180419125030.5076-1-alexandre.belloni@bootlin.com>
After the test ends, restore the PIE rate to its previous value to be less
disruptive.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
tools/testing/selftests/timers/rtcpie.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/timers/rtcpie.c b/tools/testing/selftests/timers/rtcpie.c
index ea98b1f6ac17..47b5bad1b393 100644
--- a/tools/testing/selftests/timers/rtcpie.c
+++ b/tools/testing/selftests/timers/rtcpie.c
@@ -28,7 +28,7 @@ static const char default_rtc[] = "/dev/rtc0";
int main(int argc, char **argv)
{
int i, fd, retval, irqcount = 0;
- unsigned long tmp, data;
+ unsigned long tmp, data, old_pie_rate;
const char *rtc = default_rtc;
struct timeval start, end, diff;
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
}
/* Read periodic IRQ rate */
- retval = ioctl(fd, RTC_IRQP_READ, &tmp);
+ retval = ioctl(fd, RTC_IRQP_READ, &old_pie_rate);
if (retval == -1) {
/* not all RTCs support periodic IRQs */
if (errno == EINVAL) {
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
perror("RTC_IRQP_READ ioctl");
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:");
fflush(stderr);
@@ -124,6 +124,8 @@ int main(int argc, char **argv)
}
done:
+ ioctl(fd, RTC_IRQP_SET, old_pie_rate);
+
fprintf(stderr, "\n\n\t\t\t *** Test complete ***\n");
close(fd);
--
2.17.0
next prev parent reply other threads:[~2018-04-19 12:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 12:50 [PATCH 0/4] selftests: rework RTC tests Alexandre Belloni
2018-04-19 12:50 ` [PATCH 1/4] selftests: timers: move PIE tests out of rtctest Alexandre Belloni
2018-11-29 19:57 ` Rafael David Tinoco
2018-12-01 9:55 ` Alexandre Belloni
2018-04-19 12:50 ` Alexandre Belloni [this message]
2018-04-19 12:50 ` [PATCH 3/4] selftests: move RTC tests to rtc subfolder Alexandre Belloni
2018-04-19 12:50 ` [PATCH 4/4] selftests: rtc: rework rtctest Alexandre Belloni
2018-04-24 19:33 ` [PATCH 0/4] selftests: rework RTC tests Shuah Khan
2018-05-10 17:34 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180419125030.5076-3-alexandre.belloni@bootlin.com \
--to=alexandre.belloni@bootlin.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).