From: Petr Mladek <pmladek@suse.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Corey Minyard" <corey@minyard.net>,
"Christian König" <christian.koenig@amd.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
"Rob Clark" <robin.clark@oss.qualcomm.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Vitaly Lifshits" <vitaly.lifshits@intel.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Niklas Cassel" <cassel@kernel.org>,
"Calvin Owens" <calvin@wbinvd.org>,
"Vadim Fedorenko" <vadim.fedorenko@linux.dev>,
"Sagi Maimon" <maimon.sagi@gmail.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Karan Tilak Kumar" <kartilak@cisco.com>,
"Hans Verkuil" <hverkuil+cisco@kernel.org>,
"Casey Schaufler" <casey@schaufler-ca.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Viacheslav Dubeyko" <Slava.Dubeyko@ibm.com>,
"Max Kellermann" <max.kellermann@ionos.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, linux-mmc@vger.kernel.org,
netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-pci@vger.kernel.org, linux-s390@vger.kernel.org,
linux-scsi@vger.kernel.org, linux-staging@lists.linux.dev,
ceph-devel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Gustavo Padovan" <gustavo@padovan.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Dmitry Baryshkov" <lumag@kernel.org>,
"Abhinav Kumar" <abhinav.kumar@linux.dev>,
"Jessica Zhang" <jesszhan0024@gmail.com>,
"Sean Paul" <sean@poorly.run>,
"Marijn Suijten" <marijn.suijten@somainline.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Tony Nguyen" <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rodolfo Giometti" <giometti@enneenne.com>,
"Richard Cochran" <richardcochran@gmail.com>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
"Stefan Haberland" <sth@linux.ibm.com>,
"Jan Hoeppner" <hoeppner@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Satish Kharat" <satishkh@cisco.com>,
"Sesidhar Baddela" <sebaddel@cisco.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Xiubo Li" <xiubli@redhat.com>,
"Ilya Dryomov" <idryomov@gmail.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 01/21] lib/vsprintf: Add specifier for printing struct timespec64
Date: Tue, 11 Nov 2025 16:03:53 +0100 [thread overview]
Message-ID: <aRNQWc8O2y94zoj8@pathway> (raw)
In-Reply-To: <20251111122735.880607-2-andriy.shevchenko@linux.intel.com>
On Tue 2025-11-11 13:20:01, Andy Shevchenko wrote:
> A handful drivers want to print a content of the struct timespec64
> in a format of %lld:%09ld. In order to make their lives easier, add
> the respecting specifier directly to the printf() implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> Documentation/core-api/printk-formats.rst | 11 ++++++++--
> lib/tests/printf_kunit.c | 4 ++++
> lib/vsprintf.c | 25 +++++++++++++++++++++++
> 3 files changed, 38 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
> index 7f2f11b48286..c0b1b6089307 100644
> --- a/Documentation/core-api/printk-formats.rst
> +++ b/Documentation/core-api/printk-formats.rst
> @@ -547,11 +547,13 @@ Time and date
> %pt[RT]s YYYY-mm-dd HH:MM:SS
> %pt[RT]d YYYY-mm-dd
> %pt[RT]t HH:MM:SS
> - %pt[RT][dt][r][s]
> + %ptSp <seconds>.<nanoseconds>
I know that that there was no good choice. But I am curious.
Does the 'p' stands for some particular word, for example, "plain" ?
I do not want to start bike shedding but I think about
using 'n' as "number".
> + %pt[RST][dt][r][s]
>
> For printing date and time as represented by::
>
> - R struct rtc_time structure
> + R content of struct rtc_time
> + S content of struct timespec64
> T time64_t type
>
> in human readable format.
> @@ -563,6 +565,11 @@ The %pt[RT]s (space) will override ISO 8601 separator by using ' ' (space)
> instead of 'T' (Capital T) between date and time. It won't have any effect
> when date or time is omitted.
>
> +The %ptSp is equivalent to %lld.%09ld for the content of the struct timespec64.
> +When the other specifiers are given, it becomes the respective equivalent of
> +%ptT[dt][r][s].%09ld. In other words, the seconds are being printed in
> +the human readable format followed by a dot and nanoseconds.
> +
> Passed by reference.
>
> struct clk
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 3f99834fd788..fdd06e8957a3 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -2464,6 +2488,7 @@ early_param("no_hash_pointers", no_hash_pointers_enable);
> * - 'g' For block_device name (gendisk + partition number)
> * - 't[RT][dt][r][s]' For time and date as represented by:
We should add 'S' here as well:
* - 't[RST][dt][r][s]' For time and date as represented by:
That said, I am not sure about the optional '[p]'. We could
either do:
* - 't[RST][p][dt][r][s]' For time and date as represented by:
or
* - 'tSp' For time represented by struct timespec64 printed
as seconds.nanoseconds
* - 't[RST][dt][r][s]' For time and date as represented by:
> * R struct rtc_time
> + * S struct timespec64
> * T time64_t
> * - 'C' For a clock, it prints the name (Common Clock Framework) or address
> * (legacy clock framework) of the clock
Otherwise, it looks good.
Best Regards,
Petr
next prev parent reply other threads:[~2025-11-11 15:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 12:20 [PATCH v2 00/21] treewide: Introduce %ptS for struct timespec64 and convert users Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 01/21] lib/vsprintf: Add specifier for printing struct timespec64 Andy Shevchenko
2025-11-11 15:03 ` Petr Mladek [this message]
2025-11-11 12:20 ` [PATCH v2 02/21] ceph: Switch to use %ptSp Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 03/21] libceph: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 04/21] dma-buf: " Andy Shevchenko
2025-11-11 14:43 ` Sumit Semwal
2025-11-11 12:20 ` [PATCH v2 05/21] drm/amdgpu: " Andy Shevchenko
2025-11-11 14:49 ` Deucher, Alexander
2025-11-11 12:20 ` [PATCH v2 06/21] drm/msm: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 07/21] drm/vblank: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 08/21] drm/xe: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 09/21] e1000e: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 10/21] igb: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 11/21] ipmi: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 12/21] media: av7110: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 13/21] mmc: mmc_test: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 14/21] net: dsa: sja1105: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 15/21] PCI: epf-test: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 16/21] pps: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 17/21] ptp: ocp: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 18/21] s390/dasd: " Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 19/21] scsi: fnic: Switch to use %ptS Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 20/21] scsi: snic: Switch to use %ptSp Andy Shevchenko
2025-11-11 12:20 ` [PATCH v2 21/21] tracing: " Andy Shevchenko
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=aRNQWc8O2y94zoj8@pathway \
--to=pmladek@suse.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=Slava.Dubeyko@ibm.com \
--cc=abhinav.kumar@linux.dev \
--cc=agordeev@linux.ibm.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=bhelgaas@google.com \
--cc=borntraeger@linux.ibm.com \
--cc=calvin@wbinvd.org \
--cc=casey@schaufler-ca.com \
--cc=cassel@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=corey@minyard.net \
--cc=davem@davemloft.net \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=freedreno@lists.freedesktop.org \
--cc=giometti@enneenne.com \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@padovan.org \
--cc=hca@linux.ibm.com \
--cc=hoeppner@linux.ibm.com \
--cc=hverkuil+cisco@kernel.org \
--cc=idryomov@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=jonathan.lemon@gmail.com \
--cc=kartilak@cisco.com \
--cc=kishon@kernel.org \
--cc=konradybcio@kernel.org \
--cc=kuba@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linux@treblig.org \
--cc=lucas.demarchi@intel.com \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maimon.sagi@gmail.com \
--cc=mani@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=martin.petersen@oracle.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=matthew.brost@intel.com \
--cc=max.kellermann@ionos.com \
--cc=mchehab@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mripard@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=rodrigo.vivi@intel.com \
--cc=rostedt@goodmis.org \
--cc=satishkh@cisco.com \
--cc=sean@poorly.run \
--cc=sebaddel@cisco.com \
--cc=senozhatsky@chromium.org \
--cc=simona@ffwll.ch \
--cc=sth@linux.ibm.com \
--cc=sumit.semwal@linaro.org \
--cc=svens@linux.ibm.com \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=ulf.hansson@linaro.org \
--cc=vadim.fedorenko@linux.dev \
--cc=vitaly.lifshits@intel.com \
--cc=xiubli@redhat.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).