Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8091288ybn; Tue, 1 Oct 2019 03:06:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdbcMFTKcWXe7++A84vYyXhzwa1PGhZ0AvS22cldzQWkKqMB3XA3J+QWRg9lImGji9bIrf X-Received: by 2002:a50:fb16:: with SMTP id d22mr24480751edq.30.1569924386370; Tue, 01 Oct 2019 03:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569924386; cv=none; d=google.com; s=arc-20160816; b=BeHXPXX+7N76oyFJBMIa2OVjx26ybvwiPr9HjKmdathVxnJ22KNtL/8WNI2FJBr+QH GZzerT4XJlMDAysOdJkdJQ0RBZsExFfMJjURYQQXvi9j58cHqq1zoLhd7057S1QGoQfn YsIQIWLrSsCxct6VHMayGCAnRda5jGJGGb+7Dr+Wv5qBaD68Xj9r+MkvGmphF3lvzERn TgtUXkM/Ywq1kKvqbG/XpNNbTANmFCd2spHXvbZmnOaXBCxCtN72yNWonk66atw0urc7 WoUpRzKc7g8BHVoxmJIXjFZQzh60bxNwbP35fRy1nOkYifmDFQJ0H+N9OVs6RqSvDtjp NqGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=Z4EVHngin1y9DCG+9LFqAnndrrhki6cSLniwiDTSMlQ=; b=YWM5m6+/4FuiACTHcV1wPrINs9cN/gVrD543fVj2U+qf5thGIv6fushkmrka2HorgL xpca2ukOYMLoOHddyflEciGPeJusLU2banmmDExAWpLcEscAd9EtKFgfJA7PGZxGObbY jkm9mlMJsbdlB8hwrCHLZ+LzGYL5OgYI+YdRmHG/k2Vg9c+tPi/sXNoh91TPi5BQo2b1 dGWheia9gWqHxhC4SaQjffmnchMH3Ziyaj6MQ3c4nDW//yV3o8hbNYH0u0h3m2lla2X/ sgeW70ToEihNhWrkr78XNuQ4wKbOVAnZ6XzXCq2HBE+v/DvKzupw2ewWVRrrIm3bVS3Z xXDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14si8426427edf.102.2019.10.01.03.06.01; Tue, 01 Oct 2019 03:06:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729816AbfJAKE5 (ORCPT + 99 others); Tue, 1 Oct 2019 06:04:57 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:5935 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725765AbfJAKE5 (ORCPT ); Tue, 1 Oct 2019 06:04:57 -0400 X-UUID: 5e04e5acbef54d609690fa8a3f4104b2-20191001 X-UUID: 5e04e5acbef54d609690fa8a3f4104b2-20191001 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1278566965; Tue, 01 Oct 2019 18:04:52 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 1 Oct 2019 18:04:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 1 Oct 2019 18:04:48 +0800 From: Miles Chen To: Jonathan Corbet CC: , , , , Miles Chen Subject: [PATCH] docs: printk-formats: add ptrdiff_t type to printk-formats Date: Tue, 1 Oct 2019 18:04:49 +0800 Message-ID: <20191001100449.19481-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When print the difference between two pointers, we should use the ptrdiff_t modifier %t. Signed-off-by: Miles Chen --- 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