From patchwork Tue Feb 16 15:50:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 383514 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C18AC433E6 for ; Tue, 16 Feb 2021 15:54:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32B4364DF0 for ; Tue, 16 Feb 2021 15:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbhBPPyU (ORCPT ); Tue, 16 Feb 2021 10:54:20 -0500 Received: from mga03.intel.com ([134.134.136.65]:56597 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbhBPPyP (ORCPT ); Tue, 16 Feb 2021 10:54:15 -0500 IronPort-SDR: uFxRYTFChpiJliSYlvD73+cDX1QnlP2q1EkWIKk5KFj7VpA2yBlGqBHPUiEl0c5kabWt4LfWFk JdCh6aP6hTng== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="182993763" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="182993763" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 07:51:01 -0800 IronPort-SDR: iBvJFjhniTxxdNc4/RTkPjD0M2S0ohTwbRcN6KtHkNPp8clIvTB6KHKbArxCWrP3cHPJUxoinK HoHO8nuqrO3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="384458645" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 16 Feb 2021 07:51:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 23B931F1; Tue, 16 Feb 2021 17:50:58 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek Subject: [PATCH v1 1/7] leds: lp50xx: Don't spam logs when probe is deferred Date: Tue, 16 Feb 2021 17:50:44 +0200 Message-Id: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org When requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe(). Signed-off-by: Andy Shevchenko --- drivers/leds/leds-lp50xx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index f13117eed976..a2d18ec8fd2b 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -455,12 +455,9 @@ static int lp50xx_probe_dt(struct lp50xx *priv) int i = 0; priv->enable_gpio = devm_gpiod_get_optional(priv->dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(priv->enable_gpio)) { - ret = PTR_ERR(priv->enable_gpio); - dev_err(&priv->client->dev, "Failed to get enable gpio: %d\n", - ret); - return ret; - } + if (IS_ERR(priv->enable_gpio)) + return dev_err_probe(priv->dev, PTR_ERR(priv->enable_gpio), + "Failed to get enable GPIO\n"); priv->regulator = devm_regulator_get(priv->dev, "vled"); if (IS_ERR(priv->regulator)) From patchwork Tue Feb 16 15:50:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 383515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72AFBC433DB for ; Tue, 16 Feb 2021 15:52:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4250C64E07 for ; Tue, 16 Feb 2021 15:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbhBPPwy (ORCPT ); Tue, 16 Feb 2021 10:52:54 -0500 Received: from mga03.intel.com ([134.134.136.65]:56597 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbhBPPwv (ORCPT ); Tue, 16 Feb 2021 10:52:51 -0500 IronPort-SDR: SoEJ46dAvzjVMhClb0GHc5XC9eCs/t43J5JyxXjxCa8n53hgZ1Bv19m1/lgJg/wXYj1KntbJMY d8dnyFC6w04Q== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="182993769" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="182993769" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 07:51:01 -0800 IronPort-SDR: Yy5hBAW2qArpAq34HwntmjUAStF/Mh513N/VgmnaAHT2R6hWG6/bOadqBvAAjMQLB5EYTlN+Qn IHCF5D3L6B6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="592220863" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 16 Feb 2021 07:51:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4A25D35A; Tue, 16 Feb 2021 17:50:59 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek Subject: [PATCH v1 4/7] leds: lp50xx: Get rid of redundant explicit casting Date: Tue, 16 Feb 2021 17:50:47 +0200 Message-Id: <20210216155050.29322-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> References: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org In the line like u32 bar = ...; u8 foo = (u8)(bar >> 8) & 0xff; is no need to have neither explicit casting nor ' & 0xff' part. Get rid of them. Signed-off-by: Andy Shevchenko --- drivers/leds/leds-lp50xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 0723b2688552..58cd25fe565d 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -360,8 +360,8 @@ static int lp50xx_set_banks(struct lp50xx *priv, u32 led_banks[]) bank_enable_mask |= (1 << led_banks[i]); } - led_config_lo = (u8)(bank_enable_mask & 0xff); - led_config_hi = (u8)(bank_enable_mask >> 8) & 0xff; + led_config_lo = bank_enable_mask; + led_config_hi = bank_enable_mask >> 8; ret = regmap_write(priv->regmap, LP50XX_LED_CFG0, led_config_lo); if (ret) From patchwork Tue Feb 16 15:50:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 383517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF099C433DB for ; Tue, 16 Feb 2021 15:52:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79AD864DF0 for ; Tue, 16 Feb 2021 15:52:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229699AbhBPPwt (ORCPT ); Tue, 16 Feb 2021 10:52:49 -0500 Received: from mga02.intel.com ([134.134.136.20]:30345 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbhBPPws (ORCPT ); Tue, 16 Feb 2021 10:52:48 -0500 IronPort-SDR: oEX8sR/2fPSqJ5bAbx1etgZB1W+vllYH5Onz+grsF2oVhuE7gJ31ZfxbRbY0k2y8kqg9RBZofJ 5Gi5y/aSurQQ== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="170053936" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="170053936" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 07:51:01 -0800 IronPort-SDR: rgrn2CMqlMiRx23Yl3ddunPP4jEXLQiRtbVdF5aqhE96pq0rNwS1GQqkJJ3LfOxJcq5ccNKQY2 e6CeI2elUesA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="364145355" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 16 Feb 2021 07:51:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5555F35E; Tue, 16 Feb 2021 17:50:59 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek Subject: [PATCH v1 5/7] leds: lp50xx: Get rid of redundant check in lp50xx_enable_disable() Date: Tue, 16 Feb 2021 17:50:48 +0200 Message-Id: <20210216155050.29322-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> References: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Since GPIO is optional the API is NULL aware and will check descriptor anyway. Remove duplicate redundant check in lp50xx_enable_disable(). Signed-off-by: Andy Shevchenko --- drivers/leds/leds-lp50xx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 58cd25fe565d..2b4981b5778d 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -382,11 +382,9 @@ static int lp50xx_enable_disable(struct lp50xx *priv, int enable_disable) { int ret; - if (priv->enable_gpio) { - ret = gpiod_direction_output(priv->enable_gpio, enable_disable); - if (ret) - return ret; - } + ret = gpiod_direction_output(priv->enable_gpio, enable_disable); + if (ret) + return ret; if (enable_disable) return regmap_write(priv->regmap, LP50XX_DEV_CFG0, LP50XX_CHIP_EN); From patchwork Tue Feb 16 15:50:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 383516 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F532C433E9 for ; Tue, 16 Feb 2021 15:52:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36E4464E07 for ; Tue, 16 Feb 2021 15:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230378AbhBPPwx (ORCPT ); Tue, 16 Feb 2021 10:52:53 -0500 Received: from mga11.intel.com ([192.55.52.93]:6756 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230059AbhBPPwv (ORCPT ); Tue, 16 Feb 2021 10:52:51 -0500 IronPort-SDR: 43Dxz9MApAOVV9RHa0NrFdzfn4wlllQktVf9tcb1p2c4Eq6mWToepxCSSGayHUFyNXO9MdUg5d +mhZj9T8dUrw== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="179417994" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="179417994" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 07:51:03 -0800 IronPort-SDR: Hy5Ez2qMCmZgFthigJdzemOKsXhT4LQpiGSWDkqYtVBGFkVo6AMx8ip5Zh/TL4Z7SVIIs8/a1G KpgOXszbdvEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="512563338" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 16 Feb 2021 07:51:02 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5F17D2D5; Tue, 16 Feb 2021 17:50:59 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek Subject: [PATCH v1 6/7] leds: lp50xx: Add missed bits.h and convert to BIT() Date: Tue, 16 Feb 2021 17:50:49 +0200 Message-Id: <20210216155050.29322-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> References: <20210216155050.29322-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add missed bits.h and convert to BIT() in lp50xx_set_banks(). Signed-off-by: Andy Shevchenko --- drivers/leds/leds-lp50xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 2b4981b5778d..0c6a5a9dd162 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -2,6 +2,7 @@ // TI LP50XX LED chip family driver // Copyright (C) 2018-20 Texas Instruments Incorporated - https://www.ti.com/ +#include #include #include #include @@ -357,7 +358,7 @@ static int lp50xx_set_banks(struct lp50xx *priv, u32 led_banks[]) for (i = 0; i < priv->chip_info->max_modules; i++) { if (led_banks[i]) - bank_enable_mask |= (1 << led_banks[i]); + bank_enable_mask |= BIT(led_banks[i]); } led_config_lo = bank_enable_mask;