From patchwork Mon Feb 15 14:21:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12088293 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 86619C433E0 for ; Mon, 15 Feb 2021 14:22:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25CEB64DEC for ; Mon, 15 Feb 2021 14:22:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25CEB64DEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64F1389D4B; Mon, 15 Feb 2021 14:22:02 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id E521389B68; Mon, 15 Feb 2021 14:22:00 +0000 (UTC) IronPort-SDR: PDZ+D92wNpeBLPJp/rybkgG2JpIU9dFDLTmWmwB059O3uPG8fjUOwaKhL5p/cLbTr2/CutxxPX 0tGN2Io2GjiQ== X-IronPort-AV: E=McAfee;i="6000,8403,9895"; a="179190195" X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="179190195" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 06:21:59 -0800 IronPort-SDR: FCMRpCe1wqWToEDOuR4p3xD8eTrfb+0xgVw9TpJbJnhvdWYjZa/OlhEhZBil5dSPZAi0g5Ubji syY4bvn1+o6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="361288896" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 15 Feb 2021 06:21:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3C7F914A; Mon, 15 Feb 2021 16:21:52 +0200 (EET) From: Andy Shevchenko To: Alex Deucher , Mikita Lipski , Eryk Brol , Chris Wilson , "David S. Miller" , Rahul Lakkireddy , Francis Laniel , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, netdev@vger.kernel.org Date: Mon, 15 Feb 2021 16:21:35 +0200 Message-Id: <20210215142137.64476-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v1 1/3] string: Consolidate yesno() helpers under string.h hood X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Raju Rangoju , Leo Li , David Airlie , Jakub Kicinski , Andy Shevchenko , Harry Wentland , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We have already few similar implementation and a lot of code that can benefit of the yesno() helper. Consolidate yesno() helpers under string.h hood. Signed-off-by: Andy Shevchenko Acked-by: Jani Nikula --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 6 +----- drivers/gpu/drm/i915/i915_utils.h | 6 +----- drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 12 +----------- include/linux/string.h | 5 +++++ 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 360952129b6d..7fde4f90e513 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -23,6 +23,7 @@ * */ +#include #include #include @@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry { uint32_t param1; }; -static inline const char *yesno(bool v) -{ - return v ? "yes" : "no"; -} - /* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array * * Function takes in attributes passed to debugfs write entry diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index abd4dcd9f79c..e6da5a951132 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -408,11 +409,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) #define MBps(x) KBps(1000 * (x)) #define GBps(x) ((u64)1000 * MBps((x))) -static inline const char *yesno(bool v) -{ - return v ? "yes" : "no"; -} - static inline const char *onoff(bool v) { return v ? "on" : "off"; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 7d49fd4edc9e..c857d73abbd7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -2015,17 +2016,6 @@ static const struct file_operations rss_debugfs_fops = { /* RSS Configuration. */ -/* Small utility function to return the strings "yes" or "no" if the supplied - * argument is non-zero. - */ -static const char *yesno(int x) -{ - static const char *yes = "yes"; - static const char *no = "no"; - - return x ? yes : no; -} - static int rss_config_show(struct seq_file *seq, void *v) { struct adapter *adapter = seq->private; diff --git a/include/linux/string.h b/include/linux/string.h index 9521d8cab18e..fd946a5e18c8 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -308,4 +308,9 @@ static __always_inline size_t str_has_prefix(const char *str, const char *prefix return strncmp(str, prefix, len) == 0 ? len : 0; } +static inline const char *yesno(bool yes) +{ + return yes ? "yes" : "no"; +} + #endif /* _LINUX_STRING_H_ */ From patchwork Mon Feb 15 14:21:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12088295 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=ham 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 C7AD9C433E6 for ; Mon, 15 Feb 2021 14:22:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FCED64DDA for ; Mon, 15 Feb 2021 14:22:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FCED64DDA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 70F7089E5A; Mon, 15 Feb 2021 14:22:03 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9371389B68; Mon, 15 Feb 2021 14:22:01 +0000 (UTC) IronPort-SDR: tv2xg4hqvB51dCGWjoHtZgT4Y2fOXHOonjyjFWrAJRH3Fhw0cAVdhLAPJ+Qpj9z3KP3pSYv2TA PAliv8X5/UTA== X-IronPort-AV: E=McAfee;i="6000,8403,9895"; a="161830204" X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="161830204" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 06:22:01 -0800 IronPort-SDR: w7T/z1VFVWlR/LW4CR4XGWtZyzYnMaNnMFakq3Y8b67+CXAnBwGE18k/9e0e2m6Uqf7mh9l0tJ pkdHwQWBtseg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="425485083" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2021 06:21:55 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 176711F1; Mon, 15 Feb 2021 16:21:55 +0200 (EET) From: Andy Shevchenko To: Alex Deucher , Mikita Lipski , Eryk Brol , Chris Wilson , "David S. Miller" , Rahul Lakkireddy , Francis Laniel , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, netdev@vger.kernel.org Date: Mon, 15 Feb 2021 16:21:36 +0200 Message-Id: <20210215142137.64476-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210215142137.64476-1-andriy.shevchenko@linux.intel.com> References: <20210215142137.64476-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v1 2/3] string: Move onoff() helper under string.h hood X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Raju Rangoju , Leo Li , David Airlie , Jakub Kicinski , Andy Shevchenko , Harry Wentland , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We have already an implementation and a lot of code that can benefit of the onoff() helper. Move it under string.h hood. Signed-off-by: Andy Shevchenko --- drivers/gpu/drm/i915/i915_utils.h | 5 ----- include/linux/string.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index e6da5a951132..d2ac357896d4 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -409,11 +409,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) #define MBps(x) KBps(1000 * (x)) #define GBps(x) ((u64)1000 * MBps((x))) -static inline const char *onoff(bool v) -{ - return v ? "on" : "off"; -} - static inline const char *enableddisabled(bool v) { return v ? "enabled" : "disabled"; diff --git a/include/linux/string.h b/include/linux/string.h index fd946a5e18c8..2a0589e945d9 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -313,4 +313,9 @@ static inline const char *yesno(bool yes) return yes ? "yes" : "no"; } +static inline const char *onoff(bool on) +{ + return on ? "on" : "off"; +} + #endif /* _LINUX_STRING_H_ */ From patchwork Mon Feb 15 14:21:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12088297 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=ham 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 A8878C433DB for ; Mon, 15 Feb 2021 14:22:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5754164DE0 for ; Mon, 15 Feb 2021 14:22:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5754164DE0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8A4B89EAC; Mon, 15 Feb 2021 14:22:08 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5516689EAC; Mon, 15 Feb 2021 14:22:07 +0000 (UTC) IronPort-SDR: OHQNEM6hotWdAAvjJZWBqrRKaGCYxUkNwO517xwDP05GGg7ME+KyACsuQfW42s8BK/qEWl5fsH UkGWLrcuGLQg== X-IronPort-AV: E=McAfee;i="6000,8403,9895"; a="180134246" X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="180134246" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 06:22:06 -0800 IronPort-SDR: gjS+uCy1RooYV8N9lYHIdqLJT2peNhOwkX157krPVoc1icBBrMwSRfcbzevRHxh9+vpd1sj8YJ veRJtpYMOhPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="580191385" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 15 Feb 2021 06:21:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9E9A8220; Mon, 15 Feb 2021 16:21:55 +0200 (EET) From: Andy Shevchenko To: Alex Deucher , Mikita Lipski , Eryk Brol , Chris Wilson , "David S. Miller" , Rahul Lakkireddy , Francis Laniel , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, netdev@vger.kernel.org Date: Mon, 15 Feb 2021 16:21:37 +0200 Message-Id: <20210215142137.64476-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210215142137.64476-1-andriy.shevchenko@linux.intel.com> References: <20210215142137.64476-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v1 3/3] string: Move enableddisabled() helper under string.h hood X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Raju Rangoju , Leo Li , David Airlie , Jakub Kicinski , Andy Shevchenko , Harry Wentland , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We have already an implementation and a lot of code that can benefit of the enableddisabled() helper. Move it under string.h hood. Signed-off-by: Andy Shevchenko --- drivers/gpu/drm/i915/i915_utils.h | 5 ----- include/linux/string.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index d2ac357896d4..b05d72b4dd93 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -409,11 +409,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) #define MBps(x) KBps(1000 * (x)) #define GBps(x) ((u64)1000 * MBps((x))) -static inline const char *enableddisabled(bool v) -{ - return v ? "enabled" : "disabled"; -} - void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint); static inline void __add_taint_for_CI(unsigned int taint) { diff --git a/include/linux/string.h b/include/linux/string.h index 2a0589e945d9..25f055aa4c31 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -318,4 +318,9 @@ static inline const char *onoff(bool on) return on ? "on" : "off"; } +static inline const char *enableddisabled(bool enabled) +{ + return enabled ? "enabled" : "disabled"; +} + #endif /* _LINUX_STRING_H_ */