68 lines
2.3 KiB
Diff
68 lines
2.3 KiB
Diff
From 583e206c66f7af8847851530daf0728f9074b3a3 Mon Sep 17 00:00:00 2001
|
|
From: Miroslav Lichvar <mlichvar@redhat.com>
|
|
Date: Wed, 18 May 2022 11:33:36 +0200
|
|
Subject: [PATCH 08/57] sysoff: Change log level of ioctl error messages.
|
|
|
|
Change the log level of ioctl error messages to the error level to make
|
|
them visible in default configuration, with the exception of EOPNOTSUPP
|
|
which is expected in probing and should stay at the debug level to avoid
|
|
confusing users.
|
|
|
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
|
[commit 270709323a161ff1cb83af511ce50691152c75cf upstream]
|
|
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
|
|
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
|
---
|
|
sysoff.c | 14 +++++++++++---
|
|
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/sysoff.c b/sysoff.c
|
|
index 5d3b907..a425275 100644
|
|
--- a/sysoff.c
|
|
+++ b/sysoff.c
|
|
@@ -28,6 +28,14 @@
|
|
|
|
#define NS_PER_SEC 1000000000LL
|
|
|
|
+static void print_ioctl_error(const char *name)
|
|
+{
|
|
+ if (errno == EOPNOTSUPP)
|
|
+ pr_debug("ioctl %s: %s", name, strerror(errno));
|
|
+ else
|
|
+ pr_err("ioctl %s: %s", name, strerror(errno));
|
|
+}
|
|
+
|
|
static int64_t pctns(struct ptp_clock_time *t)
|
|
{
|
|
return t->sec * NS_PER_SEC + t->nsec;
|
|
@@ -38,7 +46,7 @@ static int sysoff_precise(int fd, int64_t *result, uint64_t *ts)
|
|
struct ptp_sys_offset_precise pso;
|
|
memset(&pso, 0, sizeof(pso));
|
|
if (ioctl(fd, PTP_SYS_OFFSET_PRECISE, &pso)) {
|
|
- pr_debug("ioctl PTP_SYS_OFFSET_PRECISE: %m");
|
|
+ print_ioctl_error("PTP_SYS_OFFSET_PRECISE");
|
|
return -errno;
|
|
}
|
|
*result = pctns(&pso.sys_realtime) - pctns(&pso.device);
|
|
@@ -98,7 +106,7 @@ static int sysoff_extended(int fd, int n_samples,
|
|
memset(&pso, 0, sizeof(pso));
|
|
pso.n_samples = n_samples;
|
|
if (ioctl(fd, PTP_SYS_OFFSET_EXTENDED, &pso)) {
|
|
- pr_debug("ioctl PTP_SYS_OFFSET_EXTENDED: %m");
|
|
+ print_ioctl_error("PTP_SYS_OFFSET_EXTENDED");
|
|
return -errno;
|
|
}
|
|
*result = sysoff_estimate(&pso.ts[0][0], 1, n_samples, ts, delay);
|
|
@@ -112,7 +120,7 @@ static int sysoff_basic(int fd, int n_samples,
|
|
memset(&pso, 0, sizeof(pso));
|
|
pso.n_samples = n_samples;
|
|
if (ioctl(fd, PTP_SYS_OFFSET, &pso)) {
|
|
- perror("ioctl PTP_SYS_OFFSET");
|
|
+ print_ioctl_error("PTP_SYS_OFFSET");
|
|
return -errno;
|
|
}
|
|
*result = sysoff_estimate(pso.ts, 0, n_samples, ts, delay);
|
|
--
|
|
2.30.2
|
|
|