linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: printk-formats: add ptrdiff_t type to printk-formats
@ 2019-10-01 10:04 Miles Chen
  2019-11-07 20:10 ` Jonathan Corbet
  0 siblings, 1 reply; 2+ messages in thread
From: Miles Chen @ 2019-10-01 10:04 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: linux-doc, linux-kernel, linux-mediatek, wsd_upstream, Miles Chen

When print the difference between two pointers, we should use
the ptrdiff_t modifier %t.

Signed-off-by: Miles Chen <miles.chen@mediatek.com>
---
 Documentation/core-api/printk-formats.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index ecbebf4ca8e7..8a0f49cd158b 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -135,6 +135,20 @@ equivalent to %lx (or %lu). %px is preferred because it is more uniquely
 grep'able. If in the future we need to modify the way the kernel handles
 printing pointers we will be better equipped to find the call sites.
 
+Pointer Differences
+-------------------
+
+::
+
+	%td	2560
+	%tx	a00
+
+For printing the pointer differences, use the %t modifier for ptrdiff_t.
+
+Example::
+
+	printk("test: difference between pointers: %td\n", ptr2 - ptr1);
+
 Struct Resources
 ----------------
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] docs: printk-formats: add ptrdiff_t type to printk-formats
  2019-10-01 10:04 [PATCH] docs: printk-formats: add ptrdiff_t type to printk-formats Miles Chen
@ 2019-11-07 20:10 ` Jonathan Corbet
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2019-11-07 20:10 UTC (permalink / raw)
  To: Miles Chen; +Cc: linux-doc, linux-kernel, linux-mediatek, wsd_upstream

On Tue, 1 Oct 2019 18:04:49 +0800
Miles Chen <miles.chen@mediatek.com> wrote:

> When print the difference between two pointers, we should use
> the ptrdiff_t modifier %t.
> 
> Signed-off-by: Miles Chen <miles.chen@mediatek.com>
> ---
>  Documentation/core-api/printk-formats.rst | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)

Applied, thanks.

jon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-07 20:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 10:04 [PATCH] docs: printk-formats: add ptrdiff_t type to printk-formats Miles Chen
2019-11-07 20:10 ` 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).