From patchwork Mon Mar 6 19:55:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF539C64EC4 for ; Mon, 6 Mar 2023 20:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GuIVHsUAUrT77tWQwsXxfOjYyOaYye514DfPLKTSgU4=; b=Y/y3PwBAG8ZScv CpmB1ItogcDqW9yfGYLJ7U0+0AvPRf5geUvSLFOrT2bum5R0rZXsngqUhQ0+AnH3NNGaX4AZDE+HM qbdx2kNe8qhyjUfIObc0nnIjlyfFGPB+xET+lqXMzH1OfzaDldOuPVgE1BnlDfyfD4Dnagr1ECfL9 5GpHJpwxNjxhLx+c7yOHoB8TaTOo+G7IpzWLf6y7Pj1CMcBX5dEmJAWvKIIscv+lVmYK626fKdqM7 vPX+UIqg8b/BTMduOpoY7TlmemUUPnP9dj5/4vzs3kv8M4idmmNbblcbMo/B7mIHgUeeNlzTGqJrh BqZrP5sB0+JENu9VEZ4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGzC-00EiqF-BE; Mon, 06 Mar 2023 19:59:06 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvm-00EgkU-KV for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132534; x=1709668534; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8ZrKn/GVsbCbQusAgr1EBS9ndoJY9gSV2vmluFfDt5o=; b=gAKe6b7sIh15P7c7vUId1A069KlEP95UVSND0VQcq3rtgZibCklAvLdz PETqpbBZ8a34iHB1LaY1SR7DTHxu5lwT2453IRA8iOGz2uzxsRN9EgX30 IaCTbOsfhU8684PTnKnauK6yNPKfG/nQe8nWROcyWmbVnZdXjcypwlRFx ZR2lUVVrvxEcRPc1glCi8PN+PduK2dgcaX8WVSEgJDudAASuM6HnGyU+i xGFvAlZhfCiyFa2ralWomq7fjO45BxlgtJPMkSi6nQ12LdnGjgifINOfq 4C7hhQOUDJj9mjFvfhZrYv1tMD9CJh7/DJGTpfPhNqAhYruiVhDD8PEzo A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483860" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483860" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="1005549560" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="1005549560" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 06 Mar 2023 11:55:28 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 491E9154; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 01/16] lib/string_helpers: Add missing header files to MAINTAINERS database Date: Mon, 6 Mar 2023 21:55:41 +0200 Message-Id: <20230306195556.55475-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115534_814805_82718D4E X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The header files string.h and string_helpers.h are missing in the MAINTAINERS. Add them. Signed-off-by: Andy Shevchenko --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 20544cbdace9..ee157981c4cf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8615,6 +8615,8 @@ F: drivers/input/touchscreen/resistive-adc-touch.c GENERIC STRING LIBRARY R: Andy Shevchenko S: Maintained +F: include/linux/string.h +F: include/linux/string_helpers.h F: lib/string.c F: lib/string_helpers.c F: lib/test_string.c From patchwork Mon Mar 6 19:55:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90915C61DA4 for ; Mon, 6 Mar 2023 20:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dwkZf327Cxmhn1fs4MEdgj0+jyf6yMFskJRKS5XZF30=; b=HatkbGZL0kLQQm /BeKSVScyP2PubrRZyuRVyOomB07vv2LgM55N8ja6m9//rgS3jGjXaauNj5AV1pC7BrOC9k+bF/Pz rkbm5anVABhzr0aHP7OD6YRNJONrRQxtZWai3pytuw9DcNTKM5JqXyYJ9vG7OcCos7LA/5bn7OMRA jOoWbu+e0xKxuQkqPv8mPvwfEJhiJBVSmwjKjVD02W2pKEKUjuvB5jbO+MH+L6jSAO+QlOL9+UiMY IthBycmoUhNM6gGN66RVck+t7+58I4qdxx2qdbi3fmE/A4P/giWcW3LtzTxpDANx3jLE9VQh+6zOJ xPnVN1IsS2CfJK/l1w1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH0D-00EjOY-0N; Mon, 06 Mar 2023 20:00:09 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvo-00EgkU-3B for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132536; x=1709668536; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oNHVpcFZrYbfI1Ngidi0XIrUh6MQDoXmEl3L94PnfHU=; b=Nx1wKoaOUjGIyFb8clp9arrWy7YIOxSalAZysSm6OKwGNyhBbs86dudr D2op6xbLscWP3OxTbFUwTHlYvMjykJA0kszpryCBwAr51p7Ihz1aaGfsg y6hTzxNfOPNRus4ePv1OCZ5A8sNARfWgA2uoGfIltRXl4AdhcJczKXCTN mEIJNjpDL+FXURQsJA+J8N4jewMequ7Ypu+9GHtdYDK2NS62ODyni/2We 12+oMrHCbzAo6Jg0emazaJMvTF8a7xBG+YhOH2BZh7joc8zwCTK2mofeW Nk/tEbvSKpLDiG+htQ6syjHWoCqIUeUNb/QopbiwH3LvZjYnO9nBXbSVF w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483875" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483875" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="1005549561" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="1005549561" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 06 Mar 2023 11:55:28 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 57F61354; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 02/16] lib/string_helpers: Split out string_choices.h Date: Mon, 6 Mar 2023 21:55:42 +0200 Message-Id: <20230306195556.55475-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115536_245520_0CB20904 X-CRM114-Status: GOOD ( 13.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some users may only need the string choice APIs. Split the respective header, i.e. string_choices.h. Include it in the string_helpers.h for backward compatibility. Signed-off-by: Andy Shevchenko --- MAINTAINERS | 1 + include/linux/string_choices.h | 32 ++++++++++++++++++++++++++++++++ include/linux/string_helpers.h | 26 +------------------------- 3 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 include/linux/string_choices.h diff --git a/MAINTAINERS b/MAINTAINERS index ee157981c4cf..64f19e200191 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8616,6 +8616,7 @@ GENERIC STRING LIBRARY R: Andy Shevchenko S: Maintained F: include/linux/string.h +F: include/linux/string_choices.h F: include/linux/string_helpers.h F: lib/string.c F: lib/string_helpers.c diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h new file mode 100644 index 000000000000..b7e7b9fd098c --- /dev/null +++ b/include/linux/string_choices.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_STRING_CHOICES_H_ +#define _LINUX_STRING_CHOICES_H_ + +#include + +static inline const char *str_enable_disable(bool v) +{ + return v ? "enable" : "disable"; +} + +static inline const char *str_enabled_disabled(bool v) +{ + return v ? "enabled" : "disabled"; +} + +static inline const char *str_read_write(bool v) +{ + return v ? "read" : "write"; +} + +static inline const char *str_on_off(bool v) +{ + return v ? "on" : "off"; +} + +static inline const char *str_yes_no(bool v) +{ + return v ? "yes" : "no"; +} + +#endif diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index fae6beaaa217..0f2255738940 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -5,6 +5,7 @@ #include #include #include +#include #include struct device; @@ -113,29 +114,4 @@ void kfree_strarray(char **array, size_t n); char **devm_kasprintf_strarray(struct device *dev, const char *prefix, size_t n); -static inline const char *str_yes_no(bool v) -{ - return v ? "yes" : "no"; -} - -static inline const char *str_on_off(bool v) -{ - return v ? "on" : "off"; -} - -static inline const char *str_enable_disable(bool v) -{ - return v ? "enable" : "disable"; -} - -static inline const char *str_enabled_disabled(bool v) -{ - return v ? "enabled" : "disabled"; -} - -static inline const char *str_read_write(bool v) -{ - return v ? "read" : "write"; -} - #endif From patchwork Mon Mar 6 19:55:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162292 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 133F2C61DA4 for ; Mon, 6 Mar 2023 20:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YYBf/oUiG1Hds7k3/0OT7XfCPSOv88+DvICBN6Ldhes=; b=1wd9acGnkFJ/8Z gGemEcRV/bWZ5QFaPEcpUjZo+DUDicQ4djoVB19s8RE8hI7HPtpnoJPRPmC44MF9T4byuF9w2LPx+ CRojH42VQxFNGrbol532RMwWKMER1u37qLAA4KEljwjzBG61uh31hJ3FxXRk/nXcZnNYotHqHjvC8 wM6z3TGiEf2oNEIONsKz5OlMVaWup5xu5jopC3Sf1a1LSCF3S9GLNBxC2tdc4/b+XY3wZ56Esn626 1w2UBmxQiB24ar/4ZsIcSUCMyYYl4PkiAdMGLmVrGxbsvwcEKlQywQdZG/Xr0HOPVo39v6TH+/yNZ fa+8KqCmT9uhovyTpY6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH2F-00EkNl-1L; Mon, 06 Mar 2023 20:02:15 +0000 Received: from mga06b.intel.com ([134.134.136.31] helo=mga06.intel.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvs-00Egoh-B1 for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132540; x=1709668540; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kqgmkF6/LXf8ZTPjacKEJCrkdjdR/gKDvDdM5DRJJDo=; b=TlZIuuvtk6qJBzfL8Rw6M0RWoWrAkzVXLFMWU0+qeaGHOGcQRX8j/Ymv TJ2etj+EbtLh7u7PMPkh1uPg7BmC4EkOd/d6krYIIo4OSMFuomdLaV+Rw i/XhAFsy4g9sNutWwX5jv654dMsCEHLzwHhg30B87euy8aNY193zRCp9T XixVFziOVPG9KulMmSKqjpdaJsInbOabp+CFwTiRXTsS4uDWf3opv5HYg Vyz12XeaklWs+abiMSVdTISb3KSAvND1B9vglmSgUG8+WG+xOI2IU34LC 2/WrYByk5rgAhFoxnigA99+1eYkPktOREml8VBFUiH+tIIVtdDK1HbrL1 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="398240764" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="398240764" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="819423553" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="819423553" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2023 11:55:28 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 61EF6367; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 03/16] lib/string_choices: Add str_high_low() helper Date: Mon, 6 Mar 2023 21:55:43 +0200 Message-Id: <20230306195556.55475-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115540_482739_BCFD8D60 X-CRM114-Status: GOOD ( 10.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add str_high_low() helper to return 'high' or 'low' string literal. Also add an inversed variant, i.e. str_low_high(). All the same for str_hi_low(). Signed-off-by: Andy Shevchenko --- include/linux/string_choices.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index b7e7b9fd098c..48120222b9b2 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -14,6 +14,18 @@ static inline const char *str_enabled_disabled(bool v) return v ? "enabled" : "disabled"; } +static inline const char *str_hi_lo(bool v) +{ + return v ? "hi" : "lo"; +} +#define str_lo_hi(v) str_hi_lo(!(v)) + +static inline const char *str_high_low(bool v) +{ + return v ? "high" : "low"; +} +#define str_low_high(v) str_high_low(!(v)) + static inline const char *str_read_write(bool v) { return v ? "read" : "write"; From patchwork Mon Mar 6 19:55:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162282 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CF763C61DA4 for ; Mon, 6 Mar 2023 20:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eMcoXjeIMU1hptYrni1SQo+n1VhfuGgJijJqZ0fRgEI=; b=qBvUyFYCc3dK7c s5Sg1Tk42lOE1hc1NWNntJEFrxp669PJIuhlGbY5S2HXSP09oL8L8AFCGlH4LSMOzMqdyw0OiQ2t8 nFePCm/5dNDtBL+hlh6RS3gRpKzPHv7KCjTnIsGexjndxXtE29iSZoB2yinQQpYJQGepQApLAlpi1 W9tgit2F06RJCnffcLLLDDbSl0nrW2C1TjPNFhnS5SaaLIIAPabg9pNXtXTbiy5gBkxNfcldjmm3+ xwakeAuEWg1qZhjzKuodDzvn/S1ImcwgiZa16sP49CL4G77bgbgoI+0CQdHGdslXoJoOuLx41misl 2xaMJWeqokvNKoDa7YiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGzY-00Ej55-Mi; Mon, 06 Mar 2023 19:59:30 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvn-00Egmw-2H for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132535; x=1709668535; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x77bSH20Ou4EihSoiJQDgs4+5OFy75brI2gUDSEqixA=; b=BITvZQWlOtqhfcSBqyXsr4cKTKBcOAKbQNIGou5URZIO2fN1b3sCpzyW VAuXEMnGgHGGwdJHc6eSOe9FqFOeUS3dzP8fYSA3+YCeEuywbsQBSVvCQ ek10pV7WtOcq8eUWiscwRdZh8xoKCz1ItLkH+zJrIjRQmy5H2/iUJ3g4+ LQxoafGRWVlpjWCXagm+KIJDRLTnVL3MD9ujh+EiMbQ/rE4fdW5jfj98d 3l6BaK9YvL5RAxfPZJM9MiWfSCStfbx7yTXR4SxYG3OwKwLZIKNWNMYBm PePalHgHOpHhkCMjNKYQIhJbfgF841aDJ9SP+Z/1iehaMl3tTBYoO6rFh A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483885" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483885" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="1005549562" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="1005549562" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 06 Mar 2023 11:55:28 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6B292398; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 04/16] lib/string_choices: Add str_input_output() helper Date: Mon, 6 Mar 2023 21:55:44 +0200 Message-Id: <20230306195556.55475-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115535_182741_E2B7430E X-CRM114-Status: UNSURE ( 8.73 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add str_input_output() helper to return 'input' or 'output' string literal. Also add an inversed variant, i.e. str_output_input(). All the same for str_in_out(). Signed-off-by: Andy Shevchenko --- include/linux/string_choices.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index 48120222b9b2..ad345df325ec 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -26,6 +26,18 @@ static inline const char *str_high_low(bool v) } #define str_low_high(v) str_high_low(!(v)) +static inline const char *str_in_out(bool v) +{ + return v ? "in" : "out"; +} +#define str_out_in(v) str_in_out(!(v)) + +static inline const char *str_input_output(bool v) +{ + return v ? "input" : "output"; +} +#define str_output_input(v) str_input_output(!(v)) + static inline const char *str_read_write(bool v) { return v ? "read" : "write"; From patchwork Mon Mar 6 19:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C36D9C61DA4 for ; Mon, 6 Mar 2023 20:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z2STQQsflY1/EmBjF8eae90OYYLv9eObIxP2RfeVtxc=; b=k9yBejWSaXRrkG SCo0/8GiV27tvRuzxWPgbA1OX2vCZWjj0821k8rPum4wEyNoETxoEpOzFBAceC6KiS/NFoHS8utsq 8mQmhybXNGOJi4nslTZaTQDptSlcVPfYnM1fjKoD0P//BiUdFUTHbVQTUBhjmK4NyHsSJ/zuaWwgq zCBeaxlxZoaMdCqMFYOOxgHxWF9WPsz9gTS45d+1alalKy2tRL7slFERGsTOeMCUmpsig2ksCpeo+ Txm6xhNfebgUcWs8lwkyUM945dmoiAW+SHKaU1dTxtBKGfFA6d8uGD7r6WX6l4mz+MmoobGsPcISn ySDHw9I7C7cyZgnBpuGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH2y-00Ekhr-36; Mon, 06 Mar 2023 20:03:00 +0000 Received: from mga06b.intel.com ([134.134.136.31] helo=mga06.intel.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvt-00EgpS-Mo for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132541; x=1709668541; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dt4pdLMszFVaAbdqwI08UXnnW0vBxyo1Sqmq45vpnHo=; b=f+3A19+Sb1OHKZkOqtkN6wV8qFdXllCAYLRw2MPd1v98muXw5HMOfJTn qBT0tuwqpF4pWrYRhzD8otAeR55A7uYAfnS4EYrk/XLt8pE7TCqYllvzX 1WUHIIQXcXlq3tSPLBpEauCAy0wFYx4VhaLvez6DNMiqLiOZK66sB2xdo eGKq7mtUJ2N31g1c0mFgjjCyDCDMk+zF1uvML5yiSzmIbJ/AM2rjXq3v/ FmZ/MeGZJHmToWnGtVxSr9TGvncDE2DWHUZbq/qB+9ULTCxn+hcoc6Jsf f7cVQjKfvyo09tqrdL4GZCJpsL8OrL5FHNTN68VXqb3A7IzpNEPsYIgr0 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="398240783" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="398240783" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="819423558" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="819423558" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2023 11:55:29 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7A2E93CB; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 05/16] gpiolib: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:45 +0200 Message-Id: <20230306195556.55475-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115541_844370_24FA487A X-CRM114-Status: GOOD ( 13.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. While at, utilize specifier field for padding the strings where it's required. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib-sysfs.c | 3 ++- drivers/gpio/gpiolib.c | 13 ++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index c1cbf71329f0..54dc53b74dc4 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -82,7 +83,7 @@ static ssize_t direction_show(struct device *dev, mutex_unlock(&data->mutex); - return sysfs_emit(buf, "%s\n", value ? "out" : "in"); + return sysfs_emit(buf, "%s\n", str_out_in(value)); } static ssize_t direction_store(struct device *dev, diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 700195a1faae..b554ad435245 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -4198,6 +4199,8 @@ EXPORT_SYMBOL_GPL(gpiod_get_index_optional); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags) { + bool out = dflags & GPIOD_FLAGS_BIT_DIR_OUT; + bool hi = dflags & GPIOD_FLAGS_BIT_DIR_VAL; struct gpio_chip *gc; struct gpio_desc *local_desc; int hwnum; @@ -4218,10 +4221,7 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, /* Mark GPIO as hogged so it can be identified and removed later */ set_bit(FLAG_IS_HOGGED, &desc->flags); - gpiod_info(desc, "hogged as %s%s\n", - (dflags & GPIOD_FLAGS_BIT_DIR_OUT) ? "output" : "input", - (dflags & GPIOD_FLAGS_BIT_DIR_OUT) ? - (dflags & GPIOD_FLAGS_BIT_DIR_VAL) ? "/high" : "/low" : ""); + gpiod_info(desc, "hogged as %s/%s\n", str_output_input(out), out ? str_high_low(hi) : "?"); return 0; } @@ -4509,10 +4509,9 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev) value = gpio_chip_get_value(gc, desc); is_irq = test_bit(FLAG_USED_AS_IRQ, &desc->flags); active_low = test_bit(FLAG_ACTIVE_LOW, &desc->flags); - seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %s %s %s%s\n", + seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %-3.3s %-2.2s %s%s\n", gpio, desc->name ?: "", desc->label, - is_out ? "out" : "in ", - value >= 0 ? (value ? "hi" : "lo") : "? ", + str_out_in(is_out), value < 0 ? "?" : str_hi_lo(value), is_irq ? "IRQ " : "", active_low ? "ACTIVE LOW" : ""); } else if (desc->name) { From patchwork Mon Mar 6 19:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 776EEC64EC4 for ; Mon, 6 Mar 2023 20:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H6pmJi9aeP5mFrAQEeHurzFcrikFpuAD4JPFyHoR4to=; b=CE1HbSE6Y88DwL sWryR39zCFFTjahfNnRA5YSwOfi8lGfw18JuQXqL/YesZSQKXShU2NiaXsA5Hb5yg+mBA5aT2BIrc z/BimEgCcVhV940R1PZuXu4jNEVNmWUno8vwnMGw+GHNv5ye7IsS5JNEF3mcS0QNiVCLS6ftIg+de 0rfN+dkikjk/5ZSXbdDz4C20wuAEJT0Qvj0k2s8nzzbcvbMJLwe186A3mL7OfesKuQ2K5XFrefqu8 xwykuJMimbTG8itG6zSXUIwCh13gJdRuXRe++ApeNPjPsSC6ekYoyRgSuauGodeMHQk2a9b4UXrD7 csQs5ej9amX6iXdYj01w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH0b-00Ejan-8v; Mon, 06 Mar 2023 20:00:33 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvo-00EgnT-9Y for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132536; x=1709668536; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tShFWIVCdDeqrNoh0yuO5Gnio4e4ieLf0f/Lj6I9KNA=; b=iWklsGNCdF7Ojl6Kg8e0oXm2Nx7aPDdgCHsQh1fJKxL2Lh07gg47Kq2d 8VFTbdrUsY+CgTuyiHJjAfsTEsKMEdWtODqG18yOTPLl0y3/klNgkON2K tx91bJ0jUUXz0eZ91VDs8cSwEvvTaWoCvt5V8P1+fIqgc8/G8hMi1bf0b DHAH5CdwLW4rSqvf91WpJYwMbI0Re5I7sLtOYFXoDG7T9HPyG4VRhYKrQ riZgxayVbjdEHRGLIijYZB17T8YZSitikw8Hbn4XUI9iP0jTdpCgL0etm 18IKiTRXw7QZxzpiHTdeeHFPd7sYjRHNtB34bLPBu9ZJvye5npleBB/Vb w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483895" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483895" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="1005549565" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="1005549565" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 06 Mar 2023 11:55:29 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8366246E; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 06/16] gpio: adnp: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:46 +0200 Message-Id: <20230306195556.55475-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115536_429043_086B380F X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. While at, utilize specifier field for padding the strings where it's required. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-adnp.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index a6439e3daff0..823cad855ee8 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c @@ -11,6 +11,7 @@ #include #include #include +#include #define GPIO_DDR(gpio) (0x00 << (gpio)->reg_shift) #define GPIO_PLR(gpio) (0x01 << (gpio)->reg_shift) @@ -211,25 +212,12 @@ static void adnp_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) for (j = 0; j < 8; j++) { unsigned int bit = (i << adnp->reg_shift) + j; - const char *direction = "input "; - const char *level = "low "; - const char *interrupt = "disabled"; - const char *pending = ""; - if (ddr & BIT(j)) - direction = "output"; - - if (plr & BIT(j)) - level = "high"; - - if (ier & BIT(j)) - interrupt = "enabled "; - - if (isr & BIT(j)) - pending = "pending"; - - seq_printf(s, "%2u: %s %s IRQ %s %s\n", bit, - direction, level, interrupt, pending); + seq_printf(s, "%2u: %-6.6s %-4.4s IRQ %-8.8s %s\n", bit, + str_output_input(ddr & BIT(j)), + str_high_low(plr & BIT(j)), + str_enabled_disabled(ier & BIT(j)), + (isr & BIT(j)) ? "pending" : ""); } } From patchwork Mon Mar 6 19:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A7F4C64EC4 for ; Mon, 6 Mar 2023 20:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VGn30S8GhrUn+fBr7NBpmWRXrObBmqyY8Lcm3BazZY8=; b=Mosl3fZ1gnvp0T bEJ9djKzi3fmdwI6ZPH9R+U87c+ZJH9p8ng84RR/uH85uRPn5fR5i+DfzUxcNHjuXwobFPURjtymZ XDhKKf6C4fXC2RPXxA4OXsfrqLHiPW8HnpzpC88prU9okqlbj+rQ5bWBiS52b98uiHyXXrbWpC8nT t5b+bLIpHSyBRvvI9cgjn7OdON3JZ2hBzmfriRytcMmPxqNxQiZK85+gyKDke1i+ITwJHbwwpOS2t XL/iuNaal0zqqWD50tUHOmzzEHhaQiqWfW4c1nyL3c2RHu3jQW6JsBn/nY/L40d7bnkKUWnv5iLp5 FUldocfkOJVBpMOAA7wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH6j-00EmTl-U4; Mon, 06 Mar 2023 20:06:54 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvv-00Egrr-RD for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132543; x=1709668543; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6SFgifrqhkmsPANQZmuCQE2iTgDgwx3gMBtOgb0D6EI=; b=PfeeZY6SZL/OXV97kY/NWfVXyVlQK9IOCdcH5WDOjM22eefGQoyS/T7h iJSJJ8+NLb4WprTso+XC4jc1FaobdPtSeZ3conwZD+otIpE8l2Dp2oTNr Qok87sq3JH2yAhPGvw8jWYHx3mV84LTkC+jLPnLR20Wam2AsOZL+4weaW /17jnfNrknus9rR/Q4vU7ROUmTGCwwYuBt6s/i/wT4OPwkY5VdKPlQ6xR uc1yC8gvxJXNTNzbXZfBAhk+8iyVMxECcMYogNK8Ryqqi3g6MgOjkWw13 RW/oGpCQANgyd0umyPo5s2RXuf12OghaVTwrmMSkz5d02ihzB5R716Lfm w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333128992" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128992" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185192" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185192" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8C9B5484; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 07/16] gpio: brcmstb: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:47 +0200 Message-Id: <20230306195556.55475-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115543_968712_78385023 X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. Signed-off-by: Andy Shevchenko Reviewed-by: Florian Fainelli --- drivers/gpio/gpio-brcmstb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index c55b35da61a0..a0535be1201c 100644 --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c @@ -9,6 +9,7 @@ #include #include #include +#include enum gio_reg_index { GIO_REG_ODEN = 0, @@ -225,7 +226,7 @@ static int brcmstb_gpio_priv_set_wake(struct brcmstb_gpio_priv *priv, ret = disable_irq_wake(priv->parent_wake_irq); if (ret) dev_err(&priv->pdev->dev, "failed to %s wake-up interrupt\n", - enable ? "enable" : "disable"); + str_enable_disable(enable)); return ret; } From patchwork Mon Mar 6 19:55:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162294 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C220C64EC4 for ; Mon, 6 Mar 2023 20:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bbXs9oyKZhoy27qMTESp+KLVr0rNiTtQa6lqQ/PughI=; b=rEMZuRLJ2RAFlp JhBlBfDhwRR/3Iu8resniLowx03yt9DXFYf3xHb88PqM59K3kMiXzRbsfwFxbxFMLBiav00ewOjbi ARVM2OBwtOEwpMnOINldee5mvCxym9OKhpXVr1OlxPTlAvLjYkJNhCIUpWHctayA9CEgKN5zFJy8l q9UGk7uswNyB+QRGDl5ynM5vMQnsNTfP7NN64a+Zxp/zlgbADyypf+YsvRaRI3sdnPjWxvcn6NBZG obF5kh9CJwIzJLJ1j91jq7HxKfqoa/Rg6XdGLo5RhtGHp5A2sRjUIH7M4CZEUvhMMOJi+klcSUh6p 27zFpWTtZIAaKzI/WfDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH3i-00El4Q-Vw; Mon, 06 Mar 2023 20:03:47 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvu-00Egpd-6x for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132542; x=1709668542; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QkJilS+dwGD4FvKKeEiSHbIXGMw2cebK2jx0ihhp9MY=; b=bQFBSjbA1O63VyFiqxH+Re8QDSlT8fBH1nIv+NjCSeX3c394RVIDXOj9 lfWEuPhedLMWHaqz8+yhckHMBLWfhMc94a6owa0Uo8udgbNjk0Sbh1Lt9 i9l5u2uZHfAIwidDQ/rE8td+O8Hvs06k08smCKSMyW26o/k9AXB8xFhA0 9kTSnK0iDEPzUHCTzRM0jXUcHjN6LXtWMVBxDDq0pIVoQpTRYlNfZqVbH ikQWHLAUNQgHFozG+P8LvC9s6B743/CdrYJEinirOzE28xmjFlDzHzmr2 Y300ZykWeRbIDXOiGTgn5xJfssBV/5dadz2OJNkSqFKvU4oxrfsJURh94 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333128968" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128968" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185191" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185191" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 95E3959E; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 08/16] gpio: crystalcove: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:48 +0200 Message-Id: <20230306195556.55475-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115542_340225_9AC35196 X-CRM114-Status: GOOD ( 12.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. While at, utilize specifier field for padding the strings where it's required. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-crystalcove.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c index 1ee62cd58582..56d628b18397 100644 --- a/drivers/gpio/gpio-crystalcove.c +++ b/drivers/gpio/gpio-crystalcove.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #define CRYSTALCOVE_GPIO_NUM 16 @@ -315,15 +316,15 @@ static void crystalcove_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip &irq); offset = gpio % 8; - seq_printf(s, " gpio-%-2d %s %s %s %s ctlo=%2x,%s %s %s\n", - gpio, ctlo & CTLO_DIR_OUT ? "out" : "in ", - ctli & 0x1 ? "hi" : "lo", - ctli & CTLI_INTCNT_NE ? "fall" : " ", - ctli & CTLI_INTCNT_PE ? "rise" : " ", + seq_printf(s, " gpio-%-2d %-3.3s %-2.2s %-4.4s %-4.4s ctlo=%2x,%-9.9s %-9.9s %s\n", + gpio, str_out_in(ctlo & CTLO_DIR_OUT), + str_hi_lo(ctli & BIT(0)), + ctli & CTLI_INTCNT_NE ? "fall" : "", + ctli & CTLI_INTCNT_PE ? "rise" : "", ctlo, - mirqs0 & BIT(offset) ? "s0 mask " : "s0 unmask", - mirqsx & BIT(offset) ? "sx mask " : "sx unmask", - irq & BIT(offset) ? "pending" : " "); + mirqs0 & BIT(offset) ? "s0 mask" : "s0 unmask", + mirqsx & BIT(offset) ? "sx mask" : "sx unmask", + irq & BIT(offset) ? "pending" : ""); } } From patchwork Mon Mar 6 19:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88D11C61DA4 for ; Mon, 6 Mar 2023 20:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ClUYohoOsmOvCwplFl9SW7tPwtRiFiLFGCNDYaClzoM=; b=sVlGTll4DD+DBb BrCtEShxYY4g/eExuyN+XlqiqldD86wq9/zedNIf4/7RQCq/yi0p2226QX6iwqvbHtVxRip0kkRJx j+VfJsC3VeJmD3Qeujo9CauL7uH9Cfdm738JZSmee/8gqM0HOKnuDOMnjx5aiCDTTY3iS8oQpJa+C iWKzPDgpgPpEtyMslHQvFRFsMmWB6aejAqvZaXQMA0LUuFEx1kbUEnlB/59y0I65rp2MdMzCw60qf G85A50dLAXaheqvaMI5eIK4xPzDAUmtlHE7KwXJjVpD5lQ+nnzU+nIDF4njEJQ7zteP9P5PBbAtPh rpiPtKyD0qCEDA9ri2YQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH4z-00EleH-3Z; Mon, 06 Mar 2023 20:05:05 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvu-00Egq1-7E for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132542; x=1709668542; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=89ohLboU1a/2JdE0Dw4HbVrvYKShu90dTe4vbBA2XKY=; b=hvEmzDItBfb/g96GeD0odP46YK1b8kkXAmDkJ6QXjI0fNGRRl5sZNS4H t7iSEowwYX4h8qQCztFEvYD9VjV1eG7q6ZfJ0X3kOgDUN8CB7xPoNy1Lg vLps6c9c+WGqGoLKA9xW8R20BHxfaE46FAcrFxZX9uUDp+SOgocn1qVxn d6RddDp6iER37ZeWMwuGgJyft23Rpt4UylD4XiEo7TiJ2cbTeEp6kOj0l MHLu0DJOAnXM2ofJ+egs0av413/c+6z/vmQG2vin+eSJJiZIUfV9K94Op 0bS5XUPGIF/krYWUbDQOwievVdnfBNlecQct7ZhTGQnPxUtOfiRTVLy+H g==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333128957" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128957" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185190" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185190" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A15835A7; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 09/16] gpio: grgpio: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:49 +0200 Message-Id: <20230306195556.55475-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115542_352895_C1BAFC09 X-CRM114-Status: GOOD ( 14.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-grgpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index bea0e32c195d..ccd942109f6a 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c @@ -30,6 +30,7 @@ #include #include #include +#include #define GRGPIO_MAX_NGPIO 32 @@ -426,7 +427,7 @@ static int grgpio_probe(struct platform_device *ofdev) } dev_info(&ofdev->dev, "regs=0x%p, base=%d, ngpio=%d, irqs=%s\n", - priv->regs, gc->base, gc->ngpio, priv->domain ? "on" : "off"); + priv->regs, gc->base, gc->ngpio, str_on_off(priv->domain)); return 0; } From patchwork Mon Mar 6 19:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7237DC64EC4 for ; Mon, 6 Mar 2023 20:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/deqPSNO6c8utGDPgmJvgF1V5gD7iORaPGgJcoR6nCs=; b=dkGD53OO+1bUJR XRIfPdt+MlUVPx8ILP9F3gkrrx3Z+Ecld9gT95KG2TEQ/qsHmdA4iOdZdGcHIdoeGzd388I/PYRrR BU6cCnZS+BDRr8wXB4Uf+XdlsvjGW2Ji9H3WIUtoRkmkR0gykMf2sFdc8bLQqnhZSj5OIehB0DK8r XhxAK2c2yNef/QdX8dp99OA1Vn7oHH5fZoN4305E9NpVR/KXZOlatLOhOy4bbuuwPiFKqkLb/giVi Q4HIhcWLGxVonyqKdbNDIkX6Id4bBzFWOdKYATIynuHkMwsWzg/vepAHW9HGMb2OZI8N8mrfSDsZv Q0IOORzhFcw55l9hxH6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH5g-00Em0g-8N; Mon, 06 Mar 2023 20:05:48 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvv-00Egpd-Ny for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132543; x=1709668543; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eW58SfrFEF8kWU8i6jmdX+uDYLVUH74J/iJvZmyuLPI=; b=GdfFas/i5r8+wDVUxARx3LU5rrpBTLhBTb4ljIuKqfvdWFEBSq6JvxU9 HM3ur1lU1ittQmzcXOhn6JFHKyK1TXV/zICWJjglmOyjhQ7gXzWmDzUQR 8zva8ofre+tKgW+I42em7e0a6+1o2zPH5ZFXccTkf5OHAtyaJoKpGeSXU MYebxl8QzhrbJCj8Plegw1J42s7dlNZp0y7BPvMKpZ1MzCMcI9R3JRhtQ 9TejNGxWZBxe5HPYdPmPFDrkXyzbdszI1L3cT/xFTPRIy2AwA7KD4nH2F hnT11liKJ9kBcCatuzS8meHX8XjSYsCbThDyF9KfYv9CZhg4FVqLWuAM0 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333128981" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128981" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185193" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185193" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id ACE8F14F; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 10/16] gpio: mvebu: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:50 +0200 Message-Id: <20230306195556.55475-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115543_822731_A3C4BC21 X-CRM114-Status: GOOD ( 14.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. While at, utilize specifier field for padding the strings where it's required. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-mvebu.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index a68f682aec01..f2bbe928577c 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -48,6 +48,7 @@ #include #include #include +#include /* * GPIO unit register offsets. @@ -897,32 +898,28 @@ static void mvebu_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) lvl_msk = mvebu_gpio_read_level_mask(mvchip); for_each_requested_gpio(chip, i, label) { - u32 msk; - bool is_out; + u32 msk = BIT(i); - msk = BIT(i); - is_out = !(io_conf & msk); + seq_printf(s, " gpio-%-3d (%-20.20s) %-3.3s ", chip->base + i, label, + str_in_out(io_conf & msk)); - seq_printf(s, " gpio-%-3d (%-20.20s)", chip->base + i, label); - - if (is_out) { - seq_printf(s, " out %s %s\n", - out & msk ? "hi" : "lo", + if (!(io_conf & msk)) { + seq_printf(s, "%-2.2s %s\n", str_hi_lo(out & msk), blink & msk ? "(blink )" : ""); continue; } - seq_printf(s, " in %s (act %s) - IRQ", - (data_in ^ in_pol) & msk ? "hi" : "lo", - in_pol & msk ? "lo" : "hi"); + seq_printf(s, "%-2.2s (act %-2.2s) - IRQ ", + str_hi_lo((data_in ^ in_pol) & msk), + str_lo_hi(in_pol & msk)); if (!((edg_msk | lvl_msk) & msk)) { - seq_puts(s, " disabled\n"); + seq_puts(s, "disabled\n"); continue; } if (edg_msk & msk) - seq_puts(s, " edge "); + seq_puts(s, "edge "); if (lvl_msk & msk) - seq_puts(s, " level"); + seq_puts(s, "level"); seq_printf(s, " (%s)\n", cause & msk ? "pending" : "clear "); } } From patchwork Mon Mar 6 19:55:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 122C7C61DA4 for ; Mon, 6 Mar 2023 20:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rUfhHvUTc0tzPl606NkwXlKPL1pJ6FQw1Ar5TzXpPcw=; b=thBdI7O5SMvoG3 RON1voRrSkq4io/ZlWb00WQPEjmq7cbqRg46cKkBzwuarF9vCQElsAN50/t9CWZcMreq/XpSU346+ KxTOPX93SRYB4TE/5i/Y6imo89LwlqV+pAeu68ks8TGlGRr04LK0cjQ5N8M50OVwIY4jhDKXNsJV0 WAjv8hsv/yCH+sLGbvWT0HI4dJVKsuOoelQ7fFD0KeOtbPxwkgUM9OU6XPTPa598cH4WaOYfYVhHf uycX1FTPgG9LylnC0UE0B2PM9n1xaAj2NlNYtmvl/rm+qLaiI++Omuj7WKnQQZnHMbHZfi/Rf+GNA fGNPurV7WahW6goOFCwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH92-00Enb4-OM; Mon, 06 Mar 2023 20:09:18 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvx-00Egrr-JN for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132545; x=1709668545; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jf/vTVPAzC30zKR0ZUsN6jr/4cQFfkw43STBYea8M0I=; b=RskBf01uOJBEVPpV7wvXETKadVBp+8qyuZ5adG5CYUPYukXcehaFxeSQ 4vbb4hFksUKVAD+upr3/2P1QIy+B2h+259FNanLR3dd3AzRkCRWUoayC4 mHZVhizoddB39xGr3YYzc3BGTveZaIAysP1kV+1+1hVfvQ24qwcPhdn+/ t8UAHYtrh65cuXia2dFRvufOnD7WGEpecfpQ4Ll4TOEPAVh0yQuRIdiC4 0wUp7ZHcAamk6SXfWMSp6sgk8c0mLFpsPzdGwGGAH7xKjptbD1E4prb50 LcAwLcjZO7fyPMBUemCSMQFS+AopqNfRsSfR77NgIYhtkNe0+GiLxCMzR w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129027" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129027" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185196" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185196" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B81905B3; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 11/16] gpio: pl061: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:51 +0200 Message-Id: <20230306195556.55475-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115545_725578_268236F0 X-CRM114-Status: GOOD ( 15.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-pl061.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 9fc1f3dd4190..99e71b4490a1 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -25,6 +25,7 @@ #include #include #include +#include #define GPIODIR 0x400 #define GPIOIS 0x404 @@ -165,8 +166,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger) gpioiev &= ~bit; irq_set_handler_locked(d, handle_level_irq); dev_dbg(gc->parent, "line %d: IRQ on %s level\n", - offset, - polarity ? "HIGH" : "LOW"); + offset, str_high_low(polarity)); } else if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { /* Disable level detection */ gpiois &= ~bit; From patchwork Mon Mar 6 19:55:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9296C61DA4 for ; Mon, 6 Mar 2023 20:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TpCu1Z8NNr1nS1ih4IbShtSXKK3tRz0b21WVO/c0300=; b=LWTQSpaOcoG7c+ sF4cvnHQc7EqOvjndRYlAjrnF8EaIegsmJ5s1z/IfkJSN1hS1N6T85noL5e2RDdqRJx3YimRzpPMg pK/KU9zEqlootZycyRG3tM1dSm8tZGjgh3zlwgbfEs3Br9y+6DkD3WVorY6AL9p5hMIJLqU5n5coe w3Um3TTpZHwhGn7yR9kR4SEMJVWY48fmESLAWpjlBgYVW01C9VE1sRP71rcLmmyCDVWpCUgsT4L3l O0C1sFIUKezV4yLFgOeRM9JY/vn49qnYNGpalGdy/L67yhwzuLZoJL9Lp6bZhjVFB1CLkkmLLyOvk JR7KgtAq6nK2tBPQvkoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH1N-00Ejv6-5g; Mon, 06 Mar 2023 20:01:23 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvs-00EgpG-7G for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132540; x=1709668540; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EDvZyVrBDVc7Nwzs9i+qoHy3DJw3++NSTTOOF+lSAxI=; b=elBBbmFOveSrjoKIlVza1kPML3XJ5AJUUtkLgfZNLpnRkRuHjhVbfdJe rQctpexiGsmUo6FV68vzAAFz6RyIULnAlT5M8Zg2MhcfaMA9aS43upntQ abIg7o/rcOYiGhqQwSgc2y04OZyYbp9IykiEbWtxG1sjthg04FHkw8QNE d3LxlNLJgFxLi0/gAHzpDCqTF5IvPdfm7gbKl+QAHeV+Xq4t0mDfi0Gip gLLfI45hSwTDMeksA80JlY3Cy/wXS5PMP4e7JFqj/sJlh2buhUNuNo+uu 9Y8M0YwrtogbtbwZY5uwW+mwkRuD3ga5XZt3wO7ooqHIOMAUQBHXNi2JJ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483929" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483929" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="1005549582" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="1005549582" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C33FB5F8; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 12/16] gpio: stmpe: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:52 +0200 Message-Id: <20230306195556.55475-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115540_380754_D43441E6 X-CRM114-Status: GOOD ( 13.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. While at, utilize specifier field for padding the strings where it's required. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-stmpe.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 0fa4f0a93378..ca8a98b252c2 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -14,6 +14,7 @@ #include #include #include +#include /* * These registers are modified under the irq bus lock and cached to avoid @@ -264,12 +265,12 @@ static void stmpe_dbg_show_one(struct seq_file *s, ret = stmpe_reg_read(stmpe, dir_reg); if (ret < 0) return; - dir = !!(ret & mask); + dir = !!(ret & mask); + seq_printf(s, " gpio-%-3d (%-20.20s) %-3.3s %-2.2s ", gpio, + label ?: "(none)", str_out_in(dir), str_hi_lo(val)); if (dir) { - seq_printf(s, " gpio-%-3d (%-20.20s) out %s", - gpio, label ?: "(none)", - val ? "hi" : "lo"); + seq_putc(s, '\n'); } else { u8 edge_det_reg; u8 rise_reg; @@ -336,11 +337,9 @@ static void stmpe_dbg_show_one(struct seq_file *s, return; irqen = !!(ret & mask); - seq_printf(s, " gpio-%-3d (%-20.20s) in %s %13s %13s %25s %25s", - gpio, label ?: "(none)", - val ? "hi" : "lo", + seq_printf(s, "%13s IRQ-%9s %25s %25s\n", edge_det_values[edge_det], - irqen ? "IRQ-enabled" : "IRQ-disabled", + str_enabled_disabled(irqen), rise_values[rise], fall_values[fall]); } @@ -351,10 +350,8 @@ static void stmpe_dbg_show(struct seq_file *s, struct gpio_chip *gc) unsigned i; unsigned gpio = gc->base; - for (i = 0; i < gc->ngpio; i++, gpio++) { + for (i = 0; i < gc->ngpio; i++, gpio++) stmpe_dbg_show_one(s, gc, i, gpio); - seq_putc(s, '\n'); - } } static struct irq_chip stmpe_gpio_irq_chip = { From patchwork Mon Mar 6 19:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2334C64EC4 for ; Mon, 6 Mar 2023 20:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2HoP4RUCQWIQUTiuXruLZOzu/hlspRAsP4KQs8YgjMk=; b=fO7tfYbqhu0Bun fWcgVBNZhgn0r1i/5BALCs3NadJ4LhloF34+bDaV2Tu1QyXbMIWbfq3lhnRjVzH6NXBNxSoV3fE2e RN6hKpsdkO8j37AOfig4fEXD00u43XHcTOB1cYiZ1jpGBw55w4cK4D+7+STW6hz6LcrxoLnbk/vHU +uqIV3vAQ3P+saM81bWW07Y+ibZns6lkNoqkSmsaSRq9PmGcDOwIt0kyf4GSrCTdKiX6aZfgrBgzB U6fYpuRlkqRHSK3qy4UR1DRRF6Xe8zbACQHqrHaSX8T+5CFVK9wQ+8S+2ZE7/1dcuB6jYUrZnyrf6 MYi/iaXC4i9coSASSv+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH7b-00EmtQ-Er; Mon, 06 Mar 2023 20:07:49 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvw-00Egq1-IM for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132544; x=1709668544; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uanU4QaIMKCYnVoRuj1LvDKlEUvFT3OubkE3zS0A1GQ=; b=O2Ngi8SBD79ScbM8kaRmtk8GG5PusQ1d5ryfoKRGZjhKPPmBoXvcEO2B JaaMZNtnFIURawIDQb4oI8WiILrnkNyiA012HAEoYsp4zUqMGoRNmVgZL kyVUc4qtILSbOqV9uvb+O5t8T8+01fNnAt8I8zBzOjNM8Yt2Cq6eaokPs fGUu6lBv88UX6NtZC5WtPH4l7gLxdaSnpplyp/QqMFQN+YlO4GTkjnOPP nsrCpr+KXQ/4bw7/kTLxKgjg1y4t00mJDq6v4m+1WzbhtTl1w5KX/i0fy grRsfRYiNzrNhh5OLXaFs/wVSMDg2XPk3FXUA7xUONFoqb8v4oubSLlt8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129004" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129004" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185198" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185198" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CE4C8609; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 13/16] gpio: wcove: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:53 +0200 Message-Id: <20230306195556.55475-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115544_652425_7BEEE0DD X-CRM114-Status: GOOD ( 12.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. While at, utilize specifier field for padding the strings where it's required. Signed-off-by: Andy Shevchenko Acked-by: Kuppuswamy Sathyanarayanan --- drivers/gpio/gpio-wcove.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c index c18b6b47384f..8d30fd04dede 100644 --- a/drivers/gpio/gpio-wcove.c +++ b/drivers/gpio/gpio-wcove.c @@ -15,6 +15,7 @@ #include #include #include +#include /* * Whiskey Cove PMIC has 13 physical GPIO pins divided into 3 banks: @@ -391,14 +392,14 @@ static void wcove_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) break; } - seq_printf(s, " gpio-%-2d %s %s %s %s ctlo=%2x,%s %s\n", - gpio, ctlo & CTLO_DIR_OUT ? "out" : "in ", - ctli & 0x1 ? "hi" : "lo", - ctli & CTLI_INTCNT_NE ? "fall" : " ", - ctli & CTLI_INTCNT_PE ? "rise" : " ", + seq_printf(s, " gpio-%-2d %-3.3s %-2.2s %-4.4s %-4.4s ctlo=%2x,%-6.6s %s\n", + gpio, str_out_in(ctlo & CTLO_DIR_OUT), + str_hi_lo(ctli & BIT(0)), + ctli & CTLI_INTCNT_NE ? "fall" : "", + ctli & CTLI_INTCNT_PE ? "rise" : "", ctlo, - irq_mask & mask ? "mask " : "unmask", - irq_status & mask ? "pending" : " "); + irq_mask & mask ? "mask" : "unmask", + irq_status & mask ? "pending" : ""); } } From patchwork Mon Mar 6 19:55:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43596C64EC4 for ; Mon, 6 Mar 2023 20:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zBfu3qhEyw8nfljU6V/t/ZbxKVOgPAR4LGDxTD2jXGI=; b=b8eWVGxMgLjs2i 3sRB5ZVa2W9a+vmZI8du05p8Jkv9YftL1AranOWq0wZpvWVXeeJGXKPvjLmfrIJ614Du9oyyqTdkY VVZeeqvECj6D8gSO6ENevdJLFtJwSNK6dZfHzgbZQYEP6N6mFwg+R+MRm9FAB3AhXUZa81x/jf9QU sGWjLFg9P0AMThvWQb9zM2YQ+kHbASmNrZKQnmtSW6u4b9Fw1jRi7x5IsuPfFfMtSYcDfikISh7Lj G34k+k+7o70DgDWKQf3LRD8Uvr82o1y4mlAsv/LILuD6c44uQ1erYoV5iVlD3rLCJ5hs1kQYB33ZW XFtcT0+RWTc/rFINP8iA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH8G-00EnEl-Ib; Mon, 06 Mar 2023 20:08:28 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvx-00Egpd-AP for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132545; x=1709668545; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5nB1Cjf4Z6soJzkyRCy4W4jPVtCrh+QSwebJoZzzTHU=; b=FwAUEpaSGExn5eC9NtNZP3rmPDDCbVPRnA04unX4cNxt6BF+5RgMmS/z aiVpd8KAoipbYjLJik9KfdN3CmOVc1jYc5ImuP5Fk678lXXam+r4WWEAX 7TKec04RhLFu2TAdzhjKoegcM/iwGCDDeuH1UsraB2E+jzp38k5DZY+oL MLOL31JGoUgrUoL6vlenYMUddU8eWDPmOhB7vo8ncU/lhJ8rIT+CKFWVL iKpXoDUA0T8hFBWKwjjk/3+i1qRD+lu69DdEqvFf2y+qnO1BUR/aTrayO 1lDU/6dgau1OcfrDFpwgDm38tX0QjH76sP+79YdqYmztuPj6aVgPSzgJ8 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129016" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129016" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185197" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185197" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D96A063E; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 14/16] gpio: wm831x: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:54 +0200 Message-Id: <20230306195556.55475-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115545_403344_835A61F7 X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. Signed-off-by: Andy Shevchenko Acked-by: Charles Keepax --- drivers/gpio/gpio-wm831x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c index 7eaf8a28638c..5456485ce801 100644 --- a/drivers/gpio/gpio-wm831x.c +++ b/drivers/gpio/gpio-wm831x.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -229,8 +230,8 @@ static void wm831x_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) seq_printf(s, " %s %s %s %s%s\n" " %s%s (0x%4x)\n", - reg & WM831X_GPN_DIR ? "in" : "out", - wm831x_gpio_get(chip, i) ? "high" : "low", + str_in_out(reg & WM831X_GPN_DIR), + str_high_low(wm831x_gpio_get(chip, i)), pull, powerdomain, reg & WM831X_GPN_POL ? "" : " inverted", From patchwork Mon Mar 6 19:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5079FC61DA4 for ; Mon, 6 Mar 2023 20:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=82uw7yww9BgPCVfVPLoZohgZnzWYOMBlG31N8GI5kL8=; b=dgRdr909IX/EDv LmYLQZCkj6qM4m7hJG9y7iqzBNvdDFvOvGEf00tje8mMfBimEznpmO7uUIjFT2InnU9c16XJ6F1Yp 2asIeG7U80d8cIJeMhf7zCHttQiD+MPUFNfO/3Cwzi0/i/oRuitTWQQ5wAmgmBVt2p8ia6LshSVb6 TXORb/kKOpv9EoqWxhMIVtYgzWQsRB+QsRThDrq9QB/Ehbe7fNBSlQiJtm01c/G/O0gZ1FATeZLnC JBvhWiasAXYv/HhUfEc5PdYoN9kQ465Aaih+md4GnzpBzJ4Xvxc3NAHil0IW1TdDLzMAF2r47gWUD OwZRD7s5XZ9FhVEK/v0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZHAB-00EoBd-Bw; Mon, 06 Mar 2023 20:10:27 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvy-00Egpd-Pv for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132546; x=1709668546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RK6y2QSRrHDRA5pznFKjVWh2L43LhEIXd/tLzjqoka0=; b=TPjFJVpnb156RTUtiOdmPxJl4wRxgbngLGi+HaIevyokwE0hGbdM2EBV 5660XbpdkEUk5RkTaHCjiKDA2PCcnXysDfEGMvN/WId012gSo3cdcH5nO GNiOrYa7tmmYHXcjwa9SaNRo8lBXm5uUXjEZgGxZcM6H+UQ1+pyOmFcBo Q1swnGzbhZesosl8IaH4aOg+pvb0B5UfITIEep2rCsZ5f1Ijikma3VOEm AoKWyv+PGyix6XsVBzO/lnBClCpY1MQGseo3nSsEhkNw/HsPwgmZj5S0t IY5IQ4pcLS4ElqlwveoD5NEHnUHXANZLpSdD7rssLGha37+0QMif4e7Fs Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129057" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129057" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185204" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185204" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:36 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E54AF65A; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 15/16] gpio: wm8994: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:55 +0200 Message-Id: <20230306195556.55475-16-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115546_918407_4028A5E7 X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. Signed-off-by: Andy Shevchenko Acked-by: Charles Keepax --- drivers/gpio/gpio-wm8994.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index f4a474cef32d..15757d94448a 100644 --- a/drivers/gpio/gpio-wm8994.c +++ b/drivers/gpio/gpio-wm8994.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -215,10 +216,7 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) continue; } - if (reg & WM8994_GPN_DIR) - seq_printf(s, "in "); - else - seq_printf(s, "out "); + seq_printf(s, "%s ", str_in_out(reg & WM8994_GPN_DIR)); if (reg & WM8994_GPN_PU) seq_printf(s, "pull up "); From patchwork Mon Mar 6 19:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13162307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF5D9C6FD1B for ; Mon, 6 Mar 2023 20:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zRlrbbh71tWxXUDqwd0NcGV4rZBuRYSFd+KqD1nC9H0=; b=UBH3AjM5RU5Col vB9F3NmxdhrFw6IuE98jRcVAzCjhc8TU9qz7VsZUZrA4hi8pQ47NW1KuSY2NsGGweb8zNaU6tu4yi RMwMDc+mWCssUIjjGbSCCgDZVs7Qu7xVuroRNI/4TkHSBAvGCVZwla5jkMH0SUhQ+3lEanTVL9cVU 9i8VcP9oI3+7YRxaamzKVSctBbB7TwnlTCHprv6cnIm1PPjAzpqEfzIypZhCSrMGZAYxRElV+rhHY ueAL0sW5idxPxzU4LGhuESFdkyLxiQMOLu8zIHtolpJNIfC0+24BqG4pr9x80l1pty0x73UekZAgv RKFtVwSRvEznraKQ+tCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZH9h-00Enuz-7G; Mon, 06 Mar 2023 20:09:58 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZGvy-00Egq1-2e for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 19:55:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132546; x=1709668546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z9mXunzTxFtyQxWYx0D3ZdzQzJ0LQXRYVBzePKOyr2Y=; b=VQ8vRKgeRaOV9nhO8W9mBek+fUvoZdeAB0ZTtjp18pXmLKjea3P9kE91 Zap3/kCgaiSmlK6Ht618xYyjh5oRYJUmiMYp4tjFGUjKkYpF3uqZIdV+U jpCWAWssGiQcoboKWPsYwqg5u++q2uqDD+hHZWcYrDQNR4Df+DIHESB5c dksjIfYl7SI1ZzS1gE4HThc/731JKuQQm1R7ZxmrcVFZn84eK7gCTDimI 4ksTXD+JZldTfjQFjHHLrpsg4xoLZYASwvqi3xfmHPpZdMae0DLnv3AA6 PbFIC6TLywOkbAsZ4QSa51WVVgSvlfAKCMEJevnrmf9i3Ctmo+zFlNeNU Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129044" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129044" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:55:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="745185205" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="745185205" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2023 11:55:36 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id EDC5787; Mon, 6 Mar 2023 21:56:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Schspa Shi , Marc Zyngier , Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, patches@opensource.cirrus.com Cc: Linus Walleij , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Maxime Coquelin , Alexandre Torgue , Kuppuswamy Sathyanarayanan , Nandor Han , Semi Malinen Subject: [PATCH v1 16/16] gpio: xra1403: Utilize helpers from string_choices.h Date: Mon, 6 Mar 2023 21:55:56 +0200 Message-Id: <20230306195556.55475-17-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> References: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230306_115546_273809_6E64696A X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are a few helpers available to convert a boolean variable to the dedicated string literals depending on the application. Use them in the driver. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-xra1403.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c index 49c878cfd5c6..bc17beaba9e7 100644 --- a/drivers/gpio/gpio-xra1403.c +++ b/drivers/gpio/gpio-xra1403.c @@ -15,6 +15,7 @@ #include #include #include +#include /* XRA1403 registers */ #define XRA_GSR 0x00 /* GPIO State */ @@ -140,8 +141,8 @@ static void xra1403_dbg_show(struct seq_file *s, struct gpio_chip *chip) for_each_requested_gpio(chip, i, label) { seq_printf(s, " gpio-%-3d (%-12s) %s %s\n", chip->base + i, label, - (gcr & BIT(i)) ? "in" : "out", - (gsr & BIT(i)) ? "hi" : "lo"); + str_in_out(gcr & BIT(i)), + str_hi_lo(gsr & BIT(i))); } } #else