From patchwork Wed Apr 28 13:59:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 12228933 X-Patchwork-Delegate: luca@coelho.fi Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24855C43460 for ; Wed, 28 Apr 2021 13:59:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE90F61443 for ; Wed, 28 Apr 2021 13:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239991AbhD1OA3 (ORCPT ); Wed, 28 Apr 2021 10:00:29 -0400 Received: from foss.arm.com ([217.140.110.172]:42912 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239116AbhD1OA2 (ORCPT ); Wed, 28 Apr 2021 10:00:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E80661042; Wed, 28 Apr 2021 06:59:42 -0700 (PDT) Received: from entos-ampere-02.shanghai.arm.com (entos-ampere-02.shanghai.arm.com [10.169.214.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EBF853F694; Wed, 28 Apr 2021 06:59:36 -0700 (PDT) From: Jia He To: Linus Torvalds , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Luca Coelho , Kalle Valo , "David S. Miller" , Jakub Kicinski , Heiko Carstens , Vasily Gorbik Cc: Christian Borntraeger , Johannes Berg , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, Jia He Subject: [PATCH 1/4] iwlwifi: mvm: Explicitly use %pd1 in debugfs entry Date: Wed, 28 Apr 2021 21:59:26 +0800 Message-Id: <20210428135929.27011-1-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org '%pd'(no digit following) will mean to print last 4 components of file dentry. Hence explicitly use %pd1 instead. Signed-off-by: Jia He --- drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c index 38d0bfb649cc..41ccbb4286c2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c @@ -752,7 +752,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) * find * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/ */ - snprintf(buf, 100, "../../../%pd3/%pd", + snprintf(buf, 100, "../../../%pd3/%pd1", dbgfs_dir, mvmvif->dbgfs_dir); From patchwork Wed Apr 28 13:59:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 12228935 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C7B3C43460 for ; Wed, 28 Apr 2021 13:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E425F61431 for ; Wed, 28 Apr 2021 13:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240084AbhD1OAj (ORCPT ); Wed, 28 Apr 2021 10:00:39 -0400 Received: from foss.arm.com ([217.140.110.172]:42942 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240085AbhD1OAe (ORCPT ); Wed, 28 Apr 2021 10:00:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 651B3ED1; Wed, 28 Apr 2021 06:59:49 -0700 (PDT) Received: from entos-ampere-02.shanghai.arm.com (entos-ampere-02.shanghai.arm.com [10.169.214.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7279A3F694; Wed, 28 Apr 2021 06:59:43 -0700 (PDT) From: Jia He To: Linus Torvalds , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Luca Coelho , Kalle Valo , "David S. Miller" , Jakub Kicinski , Heiko Carstens , Vasily Gorbik Cc: Christian Borntraeger , Johannes Berg , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, Jia He Subject: [PATCH 2/4] lib/vsprintf.c: Make %p{D,d} mean as much components as possible Date: Wed, 28 Apr 2021 21:59:27 +0800 Message-Id: <20210428135929.27011-2-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210428135929.27011-1-justin.he@arm.com> References: <20210428135929.27011-1-justin.he@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Linus Torvalds We have '%pD'(no digit following) for printing a filename. It may not be perfect (by default it only prints one component. %pD4 should be more than good enough, but we should make plain "%pD" mean "as much of the path that is reasonable" rather than "as few components as possible" (ie 1). Signed-off-by: Linus Torvalds Signed-off-by: Jia He Signed-off-by: Jia He --- Documentation/core-api/printk-formats.rst | 3 ++- lib/vsprintf.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst index 9be6de402cb9..aa76cbec0dae 100644 --- a/Documentation/core-api/printk-formats.rst +++ b/Documentation/core-api/printk-formats.rst @@ -413,7 +413,8 @@ dentry names For printing dentry name; if we race with :c:func:`d_move`, the name might be a mix of old and new ones, but it won't oops. %pd dentry is a safer equivalent of %s dentry->d_name.name we used to use, %pd prints ``n`` -last components. %pD does the same thing for struct file. +last components. %pD does the same thing for struct file. By default, %p{D,d} +is equal to %p{D,d}4. Passed by reference. diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 6c56c62fd9a5..5b563953f970 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -880,11 +880,11 @@ char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_sp int i, n; switch (fmt[1]) { - case '2': case '3': case '4': + case '1': case '2': case '3': case '4': depth = fmt[1] - '0'; break; default: - depth = 1; + depth = 4; } rcu_read_lock(); From patchwork Wed Apr 28 13:59:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 12228937 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C5E4C43470 for ; Wed, 28 Apr 2021 13:59:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D945861440 for ; Wed, 28 Apr 2021 13:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240091AbhD1OAm (ORCPT ); Wed, 28 Apr 2021 10:00:42 -0400 Received: from foss.arm.com ([217.140.110.172]:42980 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240085AbhD1OAl (ORCPT ); Wed, 28 Apr 2021 10:00:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E0AAF1063; Wed, 28 Apr 2021 06:59:55 -0700 (PDT) Received: from entos-ampere-02.shanghai.arm.com (entos-ampere-02.shanghai.arm.com [10.169.214.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E2D703F694; Wed, 28 Apr 2021 06:59:49 -0700 (PDT) From: Jia He To: Linus Torvalds , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Luca Coelho , Kalle Valo , "David S. Miller" , Jakub Kicinski , Heiko Carstens , Vasily Gorbik Cc: Christian Borntraeger , Johannes Berg , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, Jia He Subject: [PATCH 3/4] s390/hmcdrv: Remove the redundant directory path in debug message Date: Wed, 28 Apr 2021 21:59:28 +0800 Message-Id: <20210428135929.27011-3-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210428135929.27011-1-justin.he@arm.com> References: <20210428135929.27011-1-justin.he@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org It would be better to use full file path with '%pD' instead of hard coding. Signed-off-by: Jia He --- drivers/s390/char/hmcdrv_dev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/s390/char/hmcdrv_dev.c b/drivers/s390/char/hmcdrv_dev.c index 20e9cd542e03..cdde75508c8a 100644 --- a/drivers/s390/char/hmcdrv_dev.c +++ b/drivers/s390/char/hmcdrv_dev.c @@ -137,7 +137,7 @@ static int hmcdrv_dev_open(struct inode *inode, struct file *fp) if (rc) module_put(THIS_MODULE); - pr_debug("open file '/dev/%pD' with return code %d\n", fp, rc); + pr_debug("open file '%pD' with return code %d\n", fp, rc); return rc; } @@ -146,7 +146,7 @@ static int hmcdrv_dev_open(struct inode *inode, struct file *fp) */ static int hmcdrv_dev_release(struct inode *inode, struct file *fp) { - pr_debug("closing file '/dev/%pD'\n", fp); + pr_debug("closing file '%pD'\n", fp); kfree(fp->private_data); fp->private_data = NULL; hmcdrv_ftp_shutdown(); @@ -231,7 +231,7 @@ static ssize_t hmcdrv_dev_read(struct file *fp, char __user *ubuf, retlen = hmcdrv_dev_transfer((char *) fp->private_data, *pos, ubuf, len); - pr_debug("read from file '/dev/%pD' at %lld returns %zd/%zu\n", + pr_debug("read from file '%pD' at %lld returns %zd/%zu\n", fp, (long long) *pos, retlen, len); if (retlen > 0) @@ -248,7 +248,7 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf, { ssize_t retlen; - pr_debug("writing file '/dev/%pD' at pos. %lld with length %zd\n", + pr_debug("writing file '%pD' at pos. %lld with length %zd\n", fp, (long long) *pos, len); if (!fp->private_data) { /* first expect a cmd write */ @@ -272,7 +272,7 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf, if (retlen > 0) *pos += retlen; - pr_debug("write to file '/dev/%pD' returned %zd\n", fp, retlen); + pr_debug("write to file '%pD' returned %zd\n", fp, retlen); return retlen; } From patchwork Wed Apr 28 13:59:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 12228939 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9695FC433B4 for ; Wed, 28 Apr 2021 14:00:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66006613FA for ; Wed, 28 Apr 2021 14:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240136AbhD1OAs (ORCPT ); Wed, 28 Apr 2021 10:00:48 -0400 Received: from foss.arm.com ([217.140.110.172]:43014 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240119AbhD1OAr (ORCPT ); Wed, 28 Apr 2021 10:00:47 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5961211B3; Wed, 28 Apr 2021 07:00:02 -0700 (PDT) Received: from entos-ampere-02.shanghai.arm.com (entos-ampere-02.shanghai.arm.com [10.169.214.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 65F353F694; Wed, 28 Apr 2021 06:59:56 -0700 (PDT) From: Jia He To: Linus Torvalds , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Luca Coelho , Kalle Valo , "David S. Miller" , Jakub Kicinski , Heiko Carstens , Vasily Gorbik Cc: Christian Borntraeger , Johannes Berg , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, Jia He Subject: [PATCH 4/4] lib/test_printf: Explicitly add components number to %pD and %pd Date: Wed, 28 Apr 2021 21:59:29 +0800 Message-Id: <20210428135929.27011-4-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210428135929.27011-1-justin.he@arm.com> References: <20210428135929.27011-1-justin.he@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org After changing the default components number from 1 to 4 for %pD and %pd, it would be better to explicitly add the number in test_printf cases. Add a test case of %pd5 to verify if it can be capped by 4 components. Signed-off-by: Jia He --- lib/test_printf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/test_printf.c b/lib/test_printf.c index 27b964ec723d..899cd55d1c90 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -478,18 +478,20 @@ static struct dentry test_dentry[4] __initdata = { static void __init dentry(void) { - test("foo", "%pd", &test_dentry[0]); + test("foo", "%pd1", &test_dentry[0]); test("foo", "%pd2", &test_dentry[0]); - test("(null)", "%pd", NULL); - test("(efault)", "%pd", PTR_INVALID); - test("(null)", "%pD", NULL); - test("(efault)", "%pD", PTR_INVALID); + test("(null)", "%pd1", NULL); + test("(efault)", "%pd1", PTR_INVALID); + test("(null)", "%pD1", NULL); + test("(efault)", "%pD1", PTR_INVALID); - test("romeo", "%pd", &test_dentry[3]); + test("romeo", "%pd1", &test_dentry[3]); test("alfa/romeo", "%pd2", &test_dentry[3]); test("bravo/alfa/romeo", "%pd3", &test_dentry[3]); test("/bravo/alfa/romeo", "%pd4", &test_dentry[3]); + test("/bravo/alfa/romeo", "%pd", &test_dentry[3]); + test("/bravo/alfa/romeo", "%pd5", &test_dentry[3]); test("/bravo/alfa", "%pd4", &test_dentry[2]); test("bravo/alfa |bravo/alfa ", "%-12pd2|%*pd2", &test_dentry[2], -12, &test_dentry[2]);