Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1213501ybe; Fri, 13 Sep 2019 12:52:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCFAdLz292tL3S60yBo3w718vaTavO5Q6rBHcAxZpEuDbsAOnIczqoKiBOI2GpiSWKQvrg X-Received: by 2002:a50:d090:: with SMTP id v16mr49717244edd.176.1568404322647; Fri, 13 Sep 2019 12:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568404322; cv=none; d=google.com; s=arc-20160816; b=UmjiplZvS98VIEkTvgnSM3/PwOHQib4TZe7/J9+qBz1Qvn85b81JRAuWCsGByscDDj Ngc/KjQBr8/eI5ZEDuFxdK8+HGSnn81Pgqw/oruK0gR7fayMi0TuC/cCq3CY8NKcB7gi wTuutN2/6tkLGZGbBXfpOhF+VgA2ALwUhLdfflDJ5TcTqXWI/D1GcGr4uTcA4NWefit0 48v7HPbEHX5gUvNBNrW9oRw+92oz5u7yBzBwfp3OFMP5mpH5b8BGMwLDQJL5y3Y5LM2b SRopnHaCn8w5ODYi39P0ds2PFe4XcUhPSA5wvZVZUPco11imqESKFYlgPD47pbtNGnXM Y5Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ddCzuxLVaJBz6wW5D5HjMqguwXt4DiG0OggFIEe98t8=; b=dBSU2Y0pfzTpuXW69vo4HyQBTRm3NY9R7nzPZcpseyP1EwuYmZH8AnVbXDBSoVoFNk YjmFPLIo6D/OfoviVPDbDhPfsjEzUjmEt4cialZdzM5WQJeD6jiHtVIds1cuKgOOLplo hpcAOQ2qC87HZ1l0cvIAybX7/Rd/HxD1sofvSLhKwjR4mbaVTi3bwC0TbQJ7rTWbxM4d z6NdGfYIoQefFHcMy1l0Uxw+P1zeXfvOJPOoj9yYrCiTJrvUFBL61yzMLLjxAPe3q1yq n/MQbRvz/3VriV+S7+Z1bL5zpCqqqA2QxxDLNyz9Z4bmBCDM7WI78u5ZSdCDIFgjJjwz bMMA== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si15370282ejz.304.2019.09.13.12.51.38; Fri, 13 Sep 2019 12:52:02 -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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388202AbfIMS7T (ORCPT + 99 others); Fri, 13 Sep 2019 14:59:19 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59214 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfIMS7N (ORCPT ); Fri, 13 Sep 2019 14:59:13 -0400 Received: from turingmachine.home (unknown [IPv6:2804:431:c7f4:5bfc:5711:794d:1c68:5ed3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tonyk) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 62B5928F197; Fri, 13 Sep 2019 19:59:08 +0100 (BST) From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: corbet@lwn.net, axboe@kernel.dk, kernel@collabora.com, krisman@collabora.com, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH 4/4] coding-style: add explanation about pr_fmt macro Date: Fri, 13 Sep 2019 15:57:46 -0300 Message-Id: <20190913185746.337429-5-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913185746.337429-1-andrealmeid@collabora.com> References: <20190913185746.337429-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pr_fmt macro is useful to format log messages printed by pr_XXXX() functions. Add text to explain the purpose of it, how to use and an example. Signed-off-by: André Almeida --- Documentation/process/coding-style.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index f4a2198187f9..276787bc2ff2 100644 --- a/Documentation/process/coding-style.rst +++ b/Documentation/process/coding-style.rst @@ -819,7 +819,15 @@ which you should use to make sure messages are matched to the right device and driver, and are tagged with the right level: dev_err(), dev_warn(), dev_info(), and so forth. For messages that aren't associated with a particular device, defines pr_notice(), pr_info(), -pr_warn(), pr_err(), etc. +pr_warn(), pr_err(), etc. It's possible to format pr_XXX() messages using the +macro pr_fmt() to prevent rewriting the style of messages. It should be +defined before including ``include/printk.h``, to avoid compiler warning about +redefinitions. This is particularly useful for adding the name of the module at +the beginning of the message, for instance: + +.. code-block:: c + + #define pr_fmt(fmt) "module_name: " fmt Coming up with good debugging messages can be quite a challenge; and once you have them, they can be a huge help for remote troubleshooting. However -- 2.23.0