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: 659571 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06A8FC64EC4 for ; Mon, 6 Mar 2023 19:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbjCFTzi (ORCPT ); Mon, 6 Mar 2023 14:55:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbjCFTzg (ORCPT ); Mon, 6 Mar 2023 14:55:36 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4E967015; Mon, 6 Mar 2023 11:55:34 -0800 (PST) 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="400483867" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483867" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660223 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C663AC6FD1C for ; Mon, 6 Mar 2023 19:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230165AbjCFTzj (ORCPT ); Mon, 6 Mar 2023 14:55:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbjCFTzh (ORCPT ); Mon, 6 Mar 2023 14:55:37 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD4A6A047; Mon, 6 Mar 2023 11:55:34 -0800 (PST) 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=oNHVpcFZrYbfI1Ngidi0XIrUh6MQDoXmEl3L94PnfHU=; b=XfhWqvcyPsRKzmhAdVrKDvjnA2LlpiSOVcEuIaWKqEo1O8yQhG7giLOT IQ3W8lvAmA9eC3DJaOOP20WK5SS1Yzh0Pu7+x3vSmG1AdJDcV+nXJ4x38 l5HZrIIIDxVLKbhCZdRBAmJWRY6rLKRjqYbwVO6RmFxiDwA/llLZCzbkq OQ1GDi0c0yL6vxEa4syE5myMRP6ydF5WRtxkVuFuzGtOzH8va3wZITDC+ dgp+xyYqRY+LY3wsqkmRrdQlQ+2Tt0dW2h0qV8Jn6VfOrN2UycCeJjfcH D/VBSxWTjXneCmPsvyd8RluMTkSpmaOIFYQ/iR0tKE7zEVa4g58/u/eOD w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483882" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483882" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 659569 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D15CC6FD1A for ; Mon, 6 Mar 2023 19:55:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230176AbjCFTzm (ORCPT ); Mon, 6 Mar 2023 14:55:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjCFTzk (ORCPT ); Mon, 6 Mar 2023 14:55:40 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA65256522; Mon, 6 Mar 2023 11:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132539; x=1709668539; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kqgmkF6/LXf8ZTPjacKEJCrkdjdR/gKDvDdM5DRJJDo=; b=M8oDdntv+9UpQtYk5qzoJH7JFWjdMGIAbklgz13ZXpmCoKTW7YSLPwcO jsEetOsNV35aA0aIoQTMSqX56fHK5j7AKKUvMZjoH/ji/30rUQUgtVexm l//OVMAuJIXLy2FdThuKuIvUH9GIwOGCOXVh2cX3ejQmkJfMJcaLiiBl3 Pa6dEreOcBtPOGtl3UMg+VYjVhe7AsXTdnOI4CwEr7fELSXsiCZmh6bwM Dm1/vfULvwGHGnXvaybyq03aWecIGf8XnK6HDKl0qyymYy9ReUGwYNdvw aDny+kmEL+kPzCpYIKFxCxP6FM0VlixffyVQazILUVm7NSwh8H+I9wWKH g==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="398240771" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="398240771" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 659570 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0108C6FD1D for ; Mon, 6 Mar 2023 19:55:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbjCFTzk (ORCPT ); Mon, 6 Mar 2023 14:55:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjCFTzh (ORCPT ); Mon, 6 Mar 2023 14:55:37 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A77A64A93; Mon, 6 Mar 2023 11:55:36 -0800 (PST) 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=x77bSH20Ou4EihSoiJQDgs4+5OFy75brI2gUDSEqixA=; b=cMryF/q2DkCkGdjn36ecf/XF5C/Kdn/qJO3rQFe5iTgajiG6nR5bLnlJ pgA5t5nWmhjnQLHfBGmau/ZeYXdMrQKxh491XwFjlKqzfyb/BU+o/PCDv oUQ2B8N22aJh0yF4wWDoSWG4hSRZkjtHARIMv4blbIjTCRbTmhEm8rdix adiWN0u4mfDQzWas5FerAK/fBnGfBMSVkSUKRbF82hp+Z57y8Cm4HUSFz teN6rr9gStnG8Pjv4NDmditY057hyrt0+VwRgz7iyLpZPZgK+9ijInGvS ckR7VRvvq54Kko+G78+LQuK8iKq+CRgYuuayM3VBBSbqcqAg2WzIlQzqI Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="400483892" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483892" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660219 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CEFCC61DA4 for ; Mon, 6 Mar 2023 19:55:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbjCFTzv (ORCPT ); Mon, 6 Mar 2023 14:55:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbjCFTzq (ORCPT ); Mon, 6 Mar 2023 14:55:46 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE8F169238; Mon, 6 Mar 2023 11:55:41 -0800 (PST) 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="398240789" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="398240789" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660222 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67A42C74A44 for ; Mon, 6 Mar 2023 19:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbjCFTzl (ORCPT ); Mon, 6 Mar 2023 14:55:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbjCFTzh (ORCPT ); Mon, 6 Mar 2023 14:55:37 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C681664C6; Mon, 6 Mar 2023 11:55:36 -0800 (PST) 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="400483899" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483899" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660218 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 688D7C61DA4 for ; Mon, 6 Mar 2023 19:56:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbjCFT4O (ORCPT ); Mon, 6 Mar 2023 14:56:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbjCFTzv (ORCPT ); Mon, 6 Mar 2023 14:55:51 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A9067008; Mon, 6 Mar 2023 11:55:44 -0800 (PST) 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=6SFgifrqhkmsPANQZmuCQE2iTgDgwx3gMBtOgb0D6EI=; b=V36p920UqBS5EVvio5dFDx77kcRqDNpKHT2LwEabVWd1gLF2gYd3Kn4j qhHOUjzq4nB/IZA+Dk8GmcINgA+dBueFtoRETbUVRHHq+p2aSGJjBgMqJ D8xrqLqVR1ihRcSg9ptBpq2Yi8jooVLEbb5ykwUzxSCCvdXVmn+0WBoVo kSG9X5kE2Uitjov6TsB40kr2d3p8EV25cSM1WfZWLZwiYRTzyca2m7/Wa dXyCaBmcrJvwOWk3rzzjr6dCx5At2oUuAA9tjsEY1cp/mnM8M29kUtTt2 P2fGAn4xLpbH22gV5BIc/TKwD+Kf9kkTEPpOWgwf1UWITgDrrS5CNI1Lo w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129000" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129000" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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-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: 659567 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1A3C6FD1A for ; Mon, 6 Mar 2023 19:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbjCFTzw (ORCPT ); Mon, 6 Mar 2023 14:55:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229646AbjCFTzr (ORCPT ); Mon, 6 Mar 2023 14:55:47 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47CE96BC3E; Mon, 6 Mar 2023 11:55:42 -0800 (PST) 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="333128974" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128974" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 659568 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C701C6FD1A for ; Mon, 6 Mar 2023 19:55:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjCFTzo (ORCPT ); Mon, 6 Mar 2023 14:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbjCFTzl (ORCPT ); Mon, 6 Mar 2023 14:55:41 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0980E65118; Mon, 6 Mar 2023 11:55:40 -0800 (PST) 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=89ohLboU1a/2JdE0Dw4HbVrvYKShu90dTe4vbBA2XKY=; b=DaT3ANVONlrbjp1EzScXqyEpFCqBwVhuB/axhzLXc/DJpR0xF4epipTa hxgxR5V3ckFe+g72FDAtXOZTVlnlXnVE2rfQBuWCiKOwrNca1SkyS+P86 KSq/4tIP0ZWk3om27DojiOipmEBhzDx1Uk2+Qx5KX4omOKsUlp4DKd5yY 6y2BBu5xt7nJGRhI6sj9YRlS4xACrcFGrGGzcOBVth4M2j7WH/x4r55u9 EbNVivj/sGWUo2ZX0hICmk2ecxGPDoVPt+zhQlrSLZTtYP0ZlGMoKNhku d+mWVXtEEQP+PA2yj11Mp56CibJ3bUZAYwAqlIYtnC+/DYqFW3U2APNB+ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333128953" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128953" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660220 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BED0CC6FD1B for ; Mon, 6 Mar 2023 19:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230209AbjCFTzt (ORCPT ); Mon, 6 Mar 2023 14:55:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbjCFTzp (ORCPT ); Mon, 6 Mar 2023 14:55:45 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5DB566D03; Mon, 6 Mar 2023 11:55:41 -0800 (PST) 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=eW58SfrFEF8kWU8i6jmdX+uDYLVUH74J/iJvZmyuLPI=; b=ID1AJ2P8jY4AqR7ZT1IypnLatK4OUlNCNNtsS7iHS2sdWLj7UGN2XroD 72d9T4JndoF4bV40nzh9GAIT92bL/7xP5Y/jxtw+dYlrB9m7RILKR/yC9 AE49h4ggQDKnlslXkN+LjA39BNZblQbRjOM7XH+2ciu5yrSBxsB761ObE IReKFSWbI7tURVD4Ybv4ZHF5nrRxRb4X1O13aoBZ9r9R4QL77xBcdjHXd EFG4mySsqSl6BHFfoh2T8P/vu95Sc2vemKnaZSb0FOLlkZAucLR0bujJV nhWTGsPsclCATNha3322BkZ2JVQ2/yJphO6PBnWvWYnSoSlCnqcesrhlV g==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333128988" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333128988" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660217 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5E7FC6FD1A for ; Mon, 6 Mar 2023 19:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbjCFT4d (ORCPT ); Mon, 6 Mar 2023 14:56:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbjCFT4P (ORCPT ); Mon, 6 Mar 2023 14:56:15 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D1874A61; Mon, 6 Mar 2023 11:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132550; x=1709668550; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jf/vTVPAzC30zKR0ZUsN6jr/4cQFfkw43STBYea8M0I=; b=k3CVGC5xyALFHyqjoLIKUI5rjXyvajzGt757PmOi2FvcyaYlrfr/YSMS 2PXTsLn05NprAm3X35oYjDVhGiyqFNOjwlF6D41EbrOf+8PUBkk5/x6C5 FgjFiCD+94x40oTuXiXOMXBLfu+iUTt0/uOE/JL2Ugh3ljhAoEjskStx9 qVeX1iUHL86fmHZJI7gkUkcSJyzCcpQBLo0iSpCwCZzgBLg5Iszlz0Yky mcD2icMW2voY1vCPNeEil1CsnzR7ZnsWWLiqVjq8oiAzttT6Eg+PUGxlF NSjKd9DlB6mtMTwBTDiRSDW3NOmAJ1ywkZ75J2Rf2e4mK1d7qksiuonsw A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129033" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129033" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 660221 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05565C742A7 for ; Mon, 6 Mar 2023 19:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbjCFTzn (ORCPT ); Mon, 6 Mar 2023 14:55:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjCFTzl (ORCPT ); Mon, 6 Mar 2023 14:55:41 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E898D59427; Mon, 6 Mar 2023 11:55:39 -0800 (PST) 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="400483922" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="400483922" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 659565 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20939C6FD1D for ; Mon, 6 Mar 2023 19:56:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbjCFT4S (ORCPT ); Mon, 6 Mar 2023 14:56:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbjCFT4G (ORCPT ); Mon, 6 Mar 2023 14:56:06 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DD96A047; Mon, 6 Mar 2023 11:55:46 -0800 (PST) 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=uanU4QaIMKCYnVoRuj1LvDKlEUvFT3OubkE3zS0A1GQ=; b=AXwMHazS3PNUp6GHomch8z6bRBb+8YkVRL4dNibvlqQvY6O/rKh0N7x9 PzKn99ZUfoNuilMyc6Ou88SrOBZ6/JjF11wKpch3aWo5uaapJf4DydnJ/ 6pJBGEF+RjCbGm9nc7aGouBT6yELNYJRfsDzsTPPCkudh+JJTUibhAvfE 5++dzkSXBzjAODfo8bXP0DcqupESS4ahlUjpm4vK3GfxHnTHXbvMpDJHP XqE3PmZE7PmccWUtSDElFgBSH90XSCrXQnDYBd028758ITZUXoi6tIXO1 KRkFRC+H6WTu0GPoVtofYJBs1FMWmKkFLlb/uxSvMfcD8lZdyhQ03FCOv w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129019" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129019" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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: 659566 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 020DEC6FD1C for ; Mon, 6 Mar 2023 19:56:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbjCFT4P (ORCPT ); Mon, 6 Mar 2023 14:56:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbjCFTzv (ORCPT ); Mon, 6 Mar 2023 14:55:51 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730AE7585A; Mon, 6 Mar 2023 11:55:45 -0800 (PST) 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="333129031" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129031" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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-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: 660216 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9FCC61DA4 for ; Mon, 6 Mar 2023 19:56:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbjCFT4p (ORCPT ); Mon, 6 Mar 2023 14:56:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbjCFT43 (ORCPT ); Mon, 6 Mar 2023 14:56:29 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A71247C9E4; Mon, 6 Mar 2023 11:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132554; x=1709668554; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RK6y2QSRrHDRA5pznFKjVWh2L43LhEIXd/tLzjqoka0=; b=mlDz2Wr48JwU8k7+WTZtzMU/7jeuhVJXqN8wTq6TMP0Wlai2U/pnpw3l CO8OEf2q2V4QQSYXiUMzd/CMW4M3WwGbP6eZ/9n5nJnxWWsH+QGt90kQS opUTUaF7Y3HPDM07L+DGfeM7Qlv0k6PJKMR6nWlXIxDn9fMxQNGGnXhyD NlkBm6wmrultP5UplLPIA1ymTJpoOmavca2ejKBSidk7Y7QeTZEhUx+Yk wYxT2Rr4yuE5c9406WGvJX6JSaRy0XLLCf3UpSLLbj+RhZbZYaNQet5rE 2vsbrhrxcrk//aaZ/ZslRrIFk7Z/eSjyTvPpZEGDB2Vve+CoXUJg5pMUR Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129051" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129051" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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-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: 659564 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9AC0C64EC4 for ; Mon, 6 Mar 2023 19:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbjCFT4e (ORCPT ); Mon, 6 Mar 2023 14:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbjCFT4Q (ORCPT ); Mon, 6 Mar 2023 14:56:16 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C8D7664C7; Mon, 6 Mar 2023 11:55:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678132552; x=1709668552; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z9mXunzTxFtyQxWYx0D3ZdzQzJ0LQXRYVBzePKOyr2Y=; b=Ih5XHDYMjtD0cz0TMSQiXyHKSDKfnufpV//bJv0nhLgh5Wbn6VNAkcXw bpYN+QoLmOa9H7/Lm0940umiZUNAJZIwFQaJ2HcreJpdGOzM5fFaYOHem xiV8QTV28OLCjWT14GoTtXIx4bd4TdYV7Sg7/86jtGwC4CWWa8NCDiwbz 3MAGB+5ke+hfAaTIchNwV/1+nfWWu08UXf9sxQpWekfdAfnQliH+Ohy+R 6I4g1VUZ4hqLFOk69zK60pfoUz11VVNM32ZIvrk5DENmn9wNxUYOWAB1x 2r7bC38Wq2lUyO+R1d64CHuzasZKvhYqHGi6LJ+vXOXjhZBvPIvCRV/68 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="333129039" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="333129039" 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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