* [PATCH] docs: printk-formats: update size-casting examples
@ 2021-06-09 19:50 Carlos Llamas
2021-06-13 23:08 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: Carlos Llamas @ 2021-06-09 19:50 UTC (permalink / raw)
To: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Andy Shevchenko,
Jonathan Corbet
Cc: Christoph Hellwig, linux-doc, linux-kernel, kernel-team, Carlos Llamas
Since commit 72deb455b5ec ("block: remove CONFIG_LBDAF") sector_t and
blkcnt_t types are no longer variable in size, making them unsuitable
examples for casting to the largest possible type. This patch replaces
such examples with cycles_t and blk_status_t types, whose sizes depend
on architecture and config options respectively.
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
Documentation/core-api/printk-formats.rst | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index f063a384c7c8..385c0cc52f1f 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -37,14 +37,13 @@ Integer types
u64 %llu or %llx
-If <type> is dependent on a config option for its size (e.g., sector_t,
-blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
-format specifier of its largest possible type and explicitly cast to it.
+If <type> is architecture-dependent for its size (e.g., cycles_t, tcflag_t) or
+is dependent on a config option for its size (e.g., blk_status_t), use a format
+specifier of its largest possible type and explicitly cast to it.
Example::
- printk("test: sector number/total blocks: %llu/%llu\n",
- (unsigned long long)sector, (unsigned long long)blockcount);
+ printk("test: latency: %llu cycles\n", (unsigned long long)time);
Reminder: sizeof() returns type size_t.
--
2.32.0.272.g935e593368-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] docs: printk-formats: update size-casting examples
2021-06-09 19:50 [PATCH] docs: printk-formats: update size-casting examples Carlos Llamas
@ 2021-06-13 23:08 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2021-06-13 23:08 UTC (permalink / raw)
To: Carlos Llamas, Petr Mladek, Steven Rostedt, Sergey Senozhatsky,
Andy Shevchenko
Cc: Christoph Hellwig, linux-doc, linux-kernel, kernel-team, Carlos Llamas
Carlos Llamas <cmllamas@google.com> writes:
> Since commit 72deb455b5ec ("block: remove CONFIG_LBDAF") sector_t and
> blkcnt_t types are no longer variable in size, making them unsuitable
> examples for casting to the largest possible type. This patch replaces
> such examples with cycles_t and blk_status_t types, whose sizes depend
> on architecture and config options respectively.
>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
> Documentation/core-api/printk-formats.rst | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
Applied, thanks.
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-13 23:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 19:50 [PATCH] docs: printk-formats: update size-casting examples Carlos Llamas
2021-06-13 23:08 ` Jonathan Corbet
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).