Skip to contentSkip to conversation

docs: printk-formats: update size-casting examples

PATCH Applied Carlos Llamas 2 participants 2 messages Jun 9, 2021 – Jun 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: printk-formats: update size-casting examples

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.

---
 Documentation/core-api/printk-formats.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Documentation/core-api/printk-formats.rst +4 -5
index f063a384c7c8..385c0cc52f1f 100644
@@ -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.
 
Signature · 1 line
2.32.0.272.g935e593368-goog
maintainer Applied
#1 lore raw
Quoted 10 lines · 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.

---
 Documentation/core-api/printk-formats.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Applied, thanks.

jon