From: Erez Geva <erez.geva.ext@siemens.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Cong Wang <xiyou.wangcong@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>, Andrei Vagin <avagin@gmail.com>,
Dmitry Safonov <0x7f454c46@gmail.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
Ingo Molnar <mingo@kernel.org>,
John Stultz <john.stultz@linaro.org>,
Michal Kubecek <mkubecek@suse.cz>,
Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Richard Cochran <richardcochran@gmail.com>,
Stephen Boyd <sboyd@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Vladis Dronov <vdronov@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Eric Dumazet <edumazet@google.com>
Cc: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Vedang Patel <vedang.patel@intel.com>,
Simon Sudler <simon.sudler@siemens.com>,
Andreas Meisinger <andreas.meisinger@siemens.com>,
Andreas Bucher <andreas.bucher@siemens.com>,
Henning Schild <henning.schild@siemens.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Andreas Zirkler <andreas.zirkler@siemens.com>,
Ermin Sakic <ermin.sakic@siemens.com>,
An Ninh Nguyen <anninh.nguyen@siemens.com>,
Michael Saenger <michael.saenger@siemens.com>,
Bernd Maehringer <bernd.maehringer@siemens.com>,
Gisela Greinert <gisela.greinert@siemens.com>,
Erez Geva <erez.geva.ext@siemens.com>,
Erez Geva <ErezGeva2@gmail.com>
Subject: [PATCH 1/7] POSIX clock ID check function
Date: Thu, 1 Oct 2020 22:51:35 +0200 [thread overview]
Message-ID: <20201001205141.8885-2-erez.geva.ext@siemens.com> (raw)
In-Reply-To: <20201001205141.8885-1-erez.geva.ext@siemens.com>
Add function to check whether a clock ID refer to
a file descriptor of a POSIX dynamic clock.
Signed-off-by: Erez Geva <erez.geva.ext@siemens.com>
---
include/linux/posix-timers.h | 5 +++++
kernel/time/posix-timers.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 896c16d2c5fb..7cb551bbb763 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -57,6 +57,11 @@ static inline int clockid_to_fd(const clockid_t clk)
return ~(clk >> 3);
}
+static inline bool is_clockid_fd_clock(const clockid_t clk)
+{
+ return (clk < 0) && ((clk & CLOCKFD_MASK) == CLOCKFD);
+}
+
#ifdef CONFIG_POSIX_TIMERS
/**
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index bf540f5a4115..806465233303 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -1400,7 +1400,7 @@ static const struct k_clock *clockid_to_kclock(const clockid_t id)
clockid_t idx = id;
if (id < 0) {
- return (id & CLOCKFD_MASK) == CLOCKFD ?
+ return is_clockid_fd_clock(id) ?
&clock_posix_dynamic : &clock_posix_cpu;
}
--
2.20.1
next prev parent reply other threads:[~2020-10-01 21:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 20:51 [PATCH 0/7] TC-ETF support PTP clocks series Erez Geva
2020-10-01 20:51 ` Erez Geva [this message]
2020-10-01 21:56 ` [PATCH 1/7] POSIX clock ID check function Thomas Gleixner
2020-10-01 20:51 ` [PATCH 2/7] Function to retrieve main clock state Erez Geva
2020-10-01 22:05 ` Thomas Gleixner
2020-10-02 0:19 ` Thomas Gleixner
2020-10-01 20:51 ` [PATCH 3/7] Functions to fetch POSIX dynamic clock object Erez Geva
2020-10-01 23:35 ` Thomas Gleixner
2020-10-01 20:51 ` [PATCH 4/7] Fix qdisc_watchdog_schedule_range_ns range check Erez Geva
2020-10-01 22:44 ` Thomas Gleixner
2020-10-01 20:51 ` [PATCH 5/7] Traffic control using high-resolution timer issue Erez Geva
2020-10-01 23:07 ` Thomas Gleixner
2020-10-01 20:51 ` [PATCH 6/7] TC-ETF code improvements Erez Geva
2020-10-01 20:51 ` [PATCH 7/7] TC-ETF support PTP clocks Erez Geva
2020-10-02 0:33 ` Thomas Gleixner
2020-10-02 11:05 ` Geva, Erez
2020-10-02 19:01 ` [PATCH 0/7] TC-ETF support PTP clocks series Vinicius Costa Gomes
2020-10-02 19:56 ` Geva, Erez
2020-10-03 0:10 ` Thomas Gleixner
2020-10-09 11:17 ` AW: " Meisinger, Andreas
2020-10-09 15:39 ` Thomas Gleixner
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=20201001205141.8885-2-erez.geva.ext@siemens.com \
--to=erez.geva.ext@siemens.com \
--cc=0x7f454c46@gmail.com \
--cc=ErezGeva2@gmail.com \
--cc=andreas.bucher@siemens.com \
--cc=andreas.meisinger@siemens.com \
--cc=andreas.zirkler@siemens.com \
--cc=anninh.nguyen@siemens.com \
--cc=avagin@gmail.com \
--cc=bernd.maehringer@siemens.com \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=ermin.sakic@siemens.com \
--cc=frederic@kernel.org \
--cc=gisela.greinert@siemens.com \
--cc=henning.schild@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=jesus.sanchez-palencia@intel.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=john.stultz@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.saenger@siemens.com \
--cc=mingo@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=richardcochran@gmail.com \
--cc=sboyd@kernel.org \
--cc=simon.sudler@siemens.com \
--cc=tglx@linutronix.de \
--cc=vdronov@redhat.com \
--cc=vedang.patel@intel.com \
--cc=vinicius.gomes@intel.com \
--cc=xiyou.wangcong@gmail.com \
/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).