From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CD3B34889C for ; Tue, 11 Nov 2025 15:03:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762873441; cv=none; b=mp7AciEZPE392ZTUkml4DFH+0DtspN8a4rGBokvG+jmxwUEOUKMizWhX9+EyLFr79aEOtyxG/Jc7MlTa+3DKLGi8vHtMGI+yZN8j3gnJD5qhA7gdAHggIaYfvJC7fqjwghWKbvyC3rs7ASakN6Zl8q0RTij1TM5ju35jHWAs7xU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762873441; c=relaxed/simple; bh=ftiPYvx9c/Uo7f5Ce7Yzxcg1QUwJlxqYP2TiKTcKQ1Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ijMX1VUkQDwakUEkqcKp8thYVE4LzQDKYy3lmaseTgU8ulTGLjk9BUaZlhssTizchdN7F4bzModPLJedGfdVhuRBkxaJDMHBP9rCGwOvTKf/0a3DTRIU3OH4DLFS8seMUlvWW5kSJkf44Mpx7j34IdHxq18BteS8e7e8P1kbHbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Wr3VZuHa; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Wr3VZuHa" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b710601e659so680488866b.1 for ; Tue, 11 Nov 2025 07:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1762873437; x=1763478237; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wi+5dbYm5JIgaP/t7Nx547fFCD450JcmYNBqfgVm42E=; b=Wr3VZuHacnX19+kU8w1BvT68Xtso8bA8jlTRBVCYJ1QSuvBs90fW594AJGYD/sbcE7 zxfKSkMaz4WysTITq4/7YriC+cQSmhKybush57z8b7uRuaTcbHBANmIDfT/kvFehUGbD sa2WDGvCupBaFLVNib0xm7M88OsMK+KVbkGvRv4wvS4KHLvTYQG7EePJTLqW1aHI85zL INKcGCRRzF6J7N7BmrhtW9M7UhXv6JUTmkrQzq4x8G7ZqU0H7eSS+ojS9/DTLkAN67Bj 1wDhCFVl0BccErhxh7JzXNm1WChW2BMRTVSKywdBU4Q8uuZOXEejQRVPSvQONAdw7x2q TGYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762873437; x=1763478237; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wi+5dbYm5JIgaP/t7Nx547fFCD450JcmYNBqfgVm42E=; b=YDeSzA4wkx0npg8cTz+EgC3xurKUSHJqPMe8e9v9ARuBIUxyanN+lliOLjhWmD6UzJ 9EZ4iVS/W6vANRvq6rVE/EJXGxuv/iwUclzedy74bpj5gjkExMC3CMlN42rOJFlIB/3j Q/i9YMJbYldQujuyVvgBrCKrLUEJcCKY+DJ13ccjVtLLbsZga4Y1rjjFjdnn3ipw/0yu UF5paTtvuxvP6sdPNd4zEEhE468LyytWS3P662jZqJmjV0o774mi9HXKHn/jG3NSWJ4w 3PJrZbpQbNO44bCsDhWAmVQoAGI+hCcpC2byK/ygCjiQiG4HCN0h8dQuMLCztebJJ1XN z3zw== X-Forwarded-Encrypted: i=1; AJvYcCXZuisWdI4lvKVnglpd6ZN/kPZ921ATyW3xQ8gxuM3ZoMZpGCDN+/AFujrrMVzWyBvr7NxaQD/ywlG7qhlbxF4JhPk=@vger.kernel.org X-Gm-Message-State: AOJu0Yxu3I7KGcmMR6JdE78yZYME8NQbAcMSXVUlNYUzXz3ghtz+XE5k EmgEyxJjfeiRG2+zfgfM2g39GvUrxU2WI2RCLd8aLrz4LT40xYsNezvfe5GUgtOaNHk= X-Gm-Gg: ASbGncuJ+418ccqVSmeYT4nfE5EBnpGcUiuEKbHdgJgm7+2T5udgRox1UvPgT3lw34I TmckbzseNvLXJdU+yNgesj7lBaXMmYaqmoV/Tg3p/emY6e6LDC+PEF8gSlqHTORjjAbdRM0E+tp c0reG6GWl7euOCfTEt4C8V8kOaQN4Q00rxpa9WDLfDx6FQFEI16x53IHSSoIXaEmpX7Z43OOz9p TDWaHg8Ur1OniFQCsDETmlr1QbADjS/yBqnbvlSW+ylt2L5jdJ/dM627CP9SstTpRjjCWRnUUgu tgZS/DR8/oF0esRaYcIyUtPluVYQoboHq22Shqu/qJnF2p1fKy4CvPBbYBiiV9JpZvvi8HLgQ5K iPs3OwMeOITGANejuZ3oK/A0EXL4PDSEVYuNP3s6cfyOQiF63k0FSfamBD6CfpRr2Zc1/7szs8A VHY3vYBNUXucaDFtZNrA== X-Google-Smtp-Source: AGHT+IGWUxoIalLG5xLZllX+zCkekRXIo7e3xykwl2APS2wZQPGHNLqastwX+dw6XlJnfwm9Fe+bGg== X-Received: by 2002:a17:906:f590:b0:b71:cec2:d54 with SMTP id a640c23a62f3a-b72e04e4ebemr1306841566b.57.1762873437355; Tue, 11 Nov 2025 07:03:57 -0800 (PST) Received: from pathway (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b72bdbc9656sm1374243166b.7.2025.11.11.07.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Nov 2025 07:03:56 -0800 (PST) Date: Tue, 11 Nov 2025 16:03:53 +0100 From: Petr Mladek To: Andy Shevchenko Cc: Corey Minyard , Christian =?iso-8859-1?Q?K=F6nig?= , "Dr. David Alan Gilbert" , Alex Deucher , Thomas Zimmermann , Dmitry Baryshkov , Rob Clark , Matthew Brost , Ulf Hansson , Vitaly Lifshits , Manivannan Sadhasivam , Niklas Cassel , Calvin Owens , Vadim Fedorenko , Sagi Maimon , "Martin K. Petersen" , Karan Tilak Kumar , Hans Verkuil , Casey Schaufler , Steven Rostedt , Viacheslav Dubeyko , Max Kellermann , 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 , Sergey Senozhatsky , Jonathan Corbet , Sumit Semwal , Gustavo Padovan , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Konrad Dybcio , Lucas De Marchi , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Rodrigo Vivi , Vladimir Oltean , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Tony Nguyen , Przemek Kitszel , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Rodolfo Giometti , Richard Cochran , Jonathan Lemon , Stefan Haberland , Jan Hoeppner , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Satish Kharat , Sesidhar Baddela , "James E.J. Bottomley" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Xiubo Li , Ilya Dryomov , Masami Hiramatsu , Mathieu Desnoyers , Andrew Morton Subject: Re: [PATCH v2 01/21] lib/vsprintf: Add specifier for printing struct timespec64 Message-ID: References: <20251111122735.880607-1-andriy.shevchenko@linux.intel.com> <20251111122735.880607-2-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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 . 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