Skip to content

Commit d7c176e

Browse files
Carlos LlamasJonathan Corbet
authored andcommitted
docs: printk-formats: update size-casting examples
Since commit 72deb45 ("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> Link: https://lore.kernel.org/r/20210609195058.3518943-1-cmllamas@google.com Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent a9edc03 commit d7c176e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Documentation/core-api/printk-formats.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@ Integer types
3737
u64 %llu or %llx
3838

3939

40-
If <type> is dependent on a config option for its size (e.g., sector_t,
41-
blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
42-
format specifier of its largest possible type and explicitly cast to it.
40+
If <type> is architecture-dependent for its size (e.g., cycles_t, tcflag_t) or
41+
is dependent on a config option for its size (e.g., blk_status_t), use a format
42+
specifier of its largest possible type and explicitly cast to it.
4343

4444
Example::
4545

46-
printk("test: sector number/total blocks: %llu/%llu\n",
47-
(unsigned long long)sector, (unsigned long long)blockcount);
46+
printk("test: latency: %llu cycles\n", (unsigned long long)time);
4847

4948
Reminder: sizeof() returns type size_t.
5049

0 commit comments

Comments
 (0)