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: 12088273 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 26608C433E0 for ; Mon, 15 Feb 2021 14:22:10 +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 DE37364DE0 for ; Mon, 15 Feb 2021 14:22:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE37364DE0 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=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB38A89EF7; 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 Subject: [PATCH v1 2/3] string: Move onoff() helper under string.h hood 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Raju Rangoju , Leo Li , David Airlie , Rodrigo Vivi , Jakub Kicinski , Andy Shevchenko , =?utf-8?q?Christian_K?= =?utf-8?q?=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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_ */