From patchwork Thu Aug 27 18:58:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 439B81731 for ; Thu, 27 Aug 2020 18:58:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 217BC22BEB for ; Thu, 27 Aug 2020 18:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554731; bh=DFt+pEv7wsjkuWkpKqMAjj60zynK5r22glOth/UG58o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rhK66Wj0NMAmk2mNA6kpfLpe+6s2qvMZOtQQu0jgb7nGAR8VBk69AK4LqmuAh5SOm EhxbzoY8hfyIc4LRWPmSLlIBWra+DZqsi1nQwzF1xqGklNsEj0oAEY7lHK7EM5hFfi Sao3zBMMSSmvjKQwiuxZO1Brm/VdfTXU9WhslKjk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727048AbgH0S6q (ORCPT ); Thu, 27 Aug 2020 14:58:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:48614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgH0S6p (ORCPT ); Thu, 27 Aug 2020 14:58:45 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98B1F22BEB; Thu, 27 Aug 2020 18:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554725; bh=DFt+pEv7wsjkuWkpKqMAjj60zynK5r22glOth/UG58o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q7NQXndYVEf21OUJMIWGJosO1HQHp57eYV358IHleMQtft7IQmm0lNOD0JLGpwtLj 01m5PDS800ywbm9G7BAtnYgr6uKzE/iL3SM/Ftinbj6j2shfqv5PUCnIcYveT9Smou Akz5qZiYMD7jGoSMq5CnFYdkErD0qAl/ArPhMlmM= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 01/27] Input: gpio_keys_polled - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:03 +0200 Message-Id: <20200827185829.30096-2-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/keyboard/gpio_keys_polled.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index c3937d2fc744..ba00ecfbd343 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -299,13 +299,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) NULL, GPIOD_IN, button->desc); if (IS_ERR(bdata->gpiod)) { - error = PTR_ERR(bdata->gpiod); - if (error != -EPROBE_DEFER) - dev_err(dev, - "failed to get gpio: %d\n", - error); fwnode_handle_put(child); - return error; + return dev_err_probe(dev, PTR_ERR(bdata->gpiod), + "failed to get gpio\n"); } } else if (gpio_is_valid(button->gpio)) { /* From patchwork Thu Aug 27 18:58:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B1A31731 for ; Thu, 27 Aug 2020 18:58:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 694A322CB3 for ; Thu, 27 Aug 2020 18:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554732; bh=BwfgtYwfZRXQcOsZb1hJsrMr/vfMEucNWSrgiCt3KzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IX+aQNX7LxwWFcVA2KtD7ElhVJetAIaCThmmmdpGK564GJMkmnK7K0Js+1y5Wurb6 QV8rXPskMnRm8xka4EIbO0ma0XCQSdLarxrCiGghH8h4hU0FqEzd+8hPDFvoxJJllE 7ltByhLwcV8x6fL/5O3Qe8vihc2mVojPrM36/tjU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbgH0S6v (ORCPT ); Thu, 27 Aug 2020 14:58:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:48694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgH0S6t (ORCPT ); Thu, 27 Aug 2020 14:58:49 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EEA4922BEA; Thu, 27 Aug 2020 18:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554728; bh=BwfgtYwfZRXQcOsZb1hJsrMr/vfMEucNWSrgiCt3KzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vVr5/MCQlD3GDecFebJAnOHVmPlCdu8HYSjZdSYUNlbbvD2mlXpHmalyLwX+/8MeG mocsbKQXRz+eUYyafKgIQs4wlUIohOO+X2wpQEEgX9pDFlmljRiPnLnPoTf6tsUPqK GJBL2iWYUyz/aY9Q68jfRgHe+FVl2CH7g/suW5hY= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 02/27] Input: gpio-vibra - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:04 +0200 Message-Id: <20200827185829.30096-3-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Remove unneeded PTR_ERR_OR_ZERO, as pointed by Andy. --- drivers/input/misc/gpio-vibra.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c index f79f75595dd7..13c69f173620 100644 --- a/drivers/input/misc/gpio-vibra.c +++ b/drivers/input/misc/gpio-vibra.c @@ -113,22 +113,14 @@ static int gpio_vibrator_probe(struct platform_device *pdev) return -ENOMEM; vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc"); - err = PTR_ERR_OR_ZERO(vibrator->vcc); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to request regulator: %d\n", - err); - return err; - } + if (IS_ERR(vibrator->vcc)) + return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->vcc), + "Failed to request regulator\n"); vibrator->gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW); - err = PTR_ERR_OR_ZERO(vibrator->gpio); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to request main gpio: %d\n", - err); - return err; - } + if (IS_ERR(vibrator->gpio)) + return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->gpio), + "Failed to request main gpio\n"); INIT_WORK(&vibrator->play_work, gpio_vibrator_play_work); From patchwork Thu Aug 27 18:58:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A6DC739 for ; Thu, 27 Aug 2020 18:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3CC822BEA for ; Thu, 27 Aug 2020 18:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554739; bh=r5Xm7hCPTgUxCPDwRqkBbYLBFo+wmkUoqPhKAWH0uTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=b6/RIb/j+k55aIyXoNmGU7PTHu2vUiMmk5xCF4LsfjtgXecxZrnj8xdY6sXWnC6Nn AiaLX4eumSYnx7EHBHqtUeSC2qxOvbKrW4QcbEHhEocIqFm21e5mNmfeHbWssBx34u NmRjMqqpzxFYyjicVFKEtPfvpXY5uJgNWFxxyVDw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbgH0S6y (ORCPT ); Thu, 27 Aug 2020 14:58:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:48832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727877AbgH0S6x (ORCPT ); Thu, 27 Aug 2020 14:58:53 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D86D22BF3; Thu, 27 Aug 2020 18:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554732; bh=r5Xm7hCPTgUxCPDwRqkBbYLBFo+wmkUoqPhKAWH0uTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8XnVCSwAskwG29dNxeSfmoMTP3/55x3xAH6Z2r24xOzmgU7ncFlhgjK9teOemAM2 gloX1ekbbkj9zllC5jy9hsqEfIlIWMbwY/o6o9bb12HY/e5heOrYfLSnnwajy5H/1Y 3ypd+6+M82lldUwO3fVKxuhv5W0m+bOLv8aZ05y8= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 03/27] Input: pwm-beeper - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:05 +0200 Message-Id: <20200827185829.30096-4-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/misc/pwm-beeper.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index d6b12477748a..8c0085e8c552 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -132,13 +132,8 @@ static int pwm_beeper_probe(struct platform_device *pdev) return -ENOMEM; beeper->pwm = devm_pwm_get(dev, NULL); - if (IS_ERR(beeper->pwm)) { - error = PTR_ERR(beeper->pwm); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to request PWM device: %d\n", - error); - return error; - } + if (IS_ERR(beeper->pwm)) + return dev_err_probe(dev, PTR_ERR(beeper->pwm), "Failed to request PWM device\n"); /* Sync up PWM state and ensure it is off. */ pwm_init_state(beeper->pwm, &state); @@ -151,13 +146,9 @@ static int pwm_beeper_probe(struct platform_device *pdev) } beeper->amplifier = devm_regulator_get(dev, "amp"); - if (IS_ERR(beeper->amplifier)) { - error = PTR_ERR(beeper->amplifier); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get 'amp' regulator: %d\n", - error); - return error; - } + if (IS_ERR(beeper->amplifier)) + return dev_err_probe(dev, PTR_ERR(beeper->amplifier), + "Failed to get 'amp' regulator\n"); INIT_WORK(&beeper->work, pwm_beeper_work); From patchwork Thu Aug 27 18:58:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7978317C7 for ; Thu, 27 Aug 2020 18:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5694722BEA for ; Thu, 27 Aug 2020 18:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554739; bh=WbuIUV4K6WbEXrmF/VhS+y87lS2sy9UGDIEz3E4QwWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1lwcLiyxmDvUasRBy46d9j2ca+gJvEmPUzZIXYX5ZS5uuKO9dZTOgAMk6q59z0Xyn T7h89DWUjae3NtPjybOnEiRAcobVETCutk1PFd162w+REYJmnXK5s/lAavsEo0c9qi CWKa154+XNqddwItL3ZXY1QuuHVtri2hv+M91Qus= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727911AbgH0S66 (ORCPT ); Thu, 27 Aug 2020 14:58:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:48928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbgH0S64 (ORCPT ); Thu, 27 Aug 2020 14:58:56 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98CE922BEA; Thu, 27 Aug 2020 18:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554735; bh=WbuIUV4K6WbEXrmF/VhS+y87lS2sy9UGDIEz3E4QwWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ut2/W2sV8VFb8FIGfuqy1l/mEmrCPxevdzXFOyakkwsfDl6ikmgKg8Q8t7jooXUHC e+m6q+1iN/GYFpR5EclsvwG4uKKbLCPBatLMofskhmygv8T9FUiVt3iCzlufcqxFjk k5FwSaFD/p8cRlmeEpsqtPkqo1tmslNYp+nLkxuQ= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 04/27] Input: pwm-vibra - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:06 +0200 Message-Id: <20200827185829.30096-5-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Remove unneeded PTR_ERR_OR_ZERO, as pointed by Andy. --- drivers/input/misc/pwm-vibra.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 81e777a04b88..45c4f6a02177 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -134,22 +134,14 @@ static int pwm_vibrator_probe(struct platform_device *pdev) return -ENOMEM; vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc"); - err = PTR_ERR_OR_ZERO(vibrator->vcc); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to request regulator: %d", - err); - return err; - } + if (IS_ERR(vibrator->vcc)) + return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->vcc), + "Failed to request regulator\n"); vibrator->pwm = devm_pwm_get(&pdev->dev, "enable"); - err = PTR_ERR_OR_ZERO(vibrator->pwm); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to request main pwm: %d", - err); - return err; - } + if (IS_ERR(vibrator->pwm)) + return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->pwm), + "Failed to request main pwm\n"); INIT_WORK(&vibrator->play_work, pwm_vibrator_play_work); From patchwork Thu Aug 27 18:58:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E30613A4 for ; Thu, 27 Aug 2020 19:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23BA422BF5 for ; Thu, 27 Aug 2020 19:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554853; bh=lTP4eUtATnmEnI0HqNZwmrnqoYep1G5LOirB6UKLfcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=D3QKY3lPOpxxYimVIeXL7HM89TMzanT4mxu5cWPxOQerauMFP6dq0oOxIWRO6JSo3 OdizjtVRwSd0L84nQ0Yw0kZ8cmTRZkFnvDE5kof/NJDRPYQH0VsdawpcIMMnE3kfZQ j6RXgqAKc4MY6UyvSRkV/3IOOgPXVjLgc10k244M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbgH0S67 (ORCPT ); Thu, 27 Aug 2020 14:58:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:49014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727913AbgH0S67 (ORCPT ); Thu, 27 Aug 2020 14:58:59 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC8A322BF3; Thu, 27 Aug 2020 18:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554738; bh=lTP4eUtATnmEnI0HqNZwmrnqoYep1G5LOirB6UKLfcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGQrB7o+DQa7HKDbYBD5iqkM+vGnWt1nyGK8SB27tPLOd4u8CNu0vxDZgAGsiTo6q aCz1Qu5ZrCiI95OA4ysL+qHlnkb3TQLH5mraFpVAqiYNDt3YTfZnjWTd2oC9O//RtZ CRj0ExTo/FleloV5trX1FTw5OzA+3HBelFryAbTo= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 05/27] Input: rotary_encoder - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:07 +0200 Message-Id: <20200827185829.30096-6-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/misc/rotary_encoder.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 6d613f2a017c..ea56c9f4975a 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev) device_property_read_bool(dev, "rotary-encoder,relative-axis"); encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN); - if (IS_ERR(encoder->gpios)) { - err = PTR_ERR(encoder->gpios); - if (err != -EPROBE_DEFER) - dev_err(dev, "unable to get gpios: %d\n", err); - return err; - } + if (IS_ERR(encoder->gpios)) + return dev_err_probe(dev, PTR_ERR(encoder->gpios), "unable to get gpios\n"); if (encoder->gpios->ndescs < 2) { dev_err(dev, "not enough gpios found\n"); return -EINVAL; From patchwork Thu Aug 27 18:58:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741421 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A84E13A4 for ; Thu, 27 Aug 2020 19:00:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7829A22BEA for ; Thu, 27 Aug 2020 19:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554849; bh=L/neO1101gcKrTCP6+XWg4JDM1kHZtdbRdGwRIgyRB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xoxjePRuSBiWXY+qpRGyn3ridkIeBLLZo+sk6di1ddTY+/zCfJ4E+RyEJwfW4WhwO HZH8ethyx2wHmtln0qrojqRitBaR6wIV4ZYxkO+2gO0sP6VEjlIuUmXZ+P1CEC/Bxj /HrWmplu29j7MBgQpeIOCNPz+Fene0Og6gdPgb44= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbgH0S7F (ORCPT ); Thu, 27 Aug 2020 14:59:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbgH0S7C (ORCPT ); Thu, 27 Aug 2020 14:59:02 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3524F22BEB; Thu, 27 Aug 2020 18:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554742; bh=L/neO1101gcKrTCP6+XWg4JDM1kHZtdbRdGwRIgyRB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6X4r80zTaSo+/cmTuk5oJTGt1uKasZWDSQkci9sL1XJ492hbiTO5Osn0VCVsIZUQ HdeFVon6g6fvNue6poeqI/erUiZtcHaGevaIzzcnoLzdiaGtks4dJUVSJ0UThkjAi5 E1QGxCEPZ2l8t14ay+a7AI1fJV65SP7PIVLVgIWA= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 06/27] Input: elan_i2c - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:08 +0200 Message-Id: <20200827185829.30096-7-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/mouse/elan_i2c_core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index c599e21a8478..d703b0d5a3bd 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1229,13 +1229,8 @@ static int elan_probe(struct i2c_client *client, mutex_init(&data->sysfs_mutex); data->vcc = devm_regulator_get(dev, "vcc"); - if (IS_ERR(data->vcc)) { - error = PTR_ERR(data->vcc); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get 'vcc' regulator: %d\n", - error); - return error; - } + if (IS_ERR(data->vcc)) + return dev_err_probe(dev, PTR_ERR(data->vcc), "Failed to get 'vcc' regulator\n"); error = regulator_enable(data->vcc); if (error) { From patchwork Thu Aug 27 18:58:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741335 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E0A7739 for ; Thu, 27 Aug 2020 18:59:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E95A62087E for ; Thu, 27 Aug 2020 18:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554748; bh=JUb3zuXLRCIJMwL7fDm3Li7eKTZnqM4btxV54IXuXgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=A06ClQut2aSKpkkkq0t/Ig0qpJBo04pk3bgG0NAt4kyMwbuEMNjD11/hxzsv9o+Xn iNQJ4wraXQlG6rC26Gb0x10KpES8kYamrY3FTGWTwbTkCpqouAMQKIWtZt++JIo+lU GmdKYdurGsO5orpnAvKUypioOfCYWUrnde0sl4F4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727986AbgH0S7H (ORCPT ); Thu, 27 Aug 2020 14:59:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:49178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbgH0S7G (ORCPT ); Thu, 27 Aug 2020 14:59:06 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8E0A22BEA; Thu, 27 Aug 2020 18:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554745; bh=JUb3zuXLRCIJMwL7fDm3Li7eKTZnqM4btxV54IXuXgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKiQ07/7odXGNddU3tMkEZjgzz3zZk0SIYWXCjLtwrS6YeTHdDyJQIB8G1axnL92i eC9HxdKPr8mK7bipqX6bAGcq0zAHjt0otYH/Dsr5AqIiqZAFBiKbtzex+gfiblz3Af 5fW5ZhUsPqQJLA45dsHMPOHptoSHwQno8LHHLrjc= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 07/27] Input: bu21013_ts - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:09 +0200 Message-Id: <20200827185829.30096-8-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko Acked-by: Linus Walleij --- Changes since v1: 1. Remove unneeded PTR_ERR_OR_ZERO, as pointed by Andy. --- drivers/input/touchscreen/bu21013_ts.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index 2f1f0d7607f8..86bd38243d6c 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -496,12 +496,10 @@ static int bu21013_probe(struct i2c_client *client, /* Named "CS" on the chip, DT binding is "reset" */ ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); - error = PTR_ERR_OR_ZERO(ts->cs_gpiod); - if (error) { - if (error != -EPROBE_DEFER) - dev_err(&client->dev, "failed to get CS GPIO\n"); - return error; - } + if (IS_ERR(ts->cs_gpiod)) + return dev_err_probe(&client->dev, PTR_ERR(ts->cs_gpiod), + "failed to get CS GPIO\n"); + gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS"); error = devm_add_action_or_reset(&client->dev, @@ -516,11 +514,8 @@ static int bu21013_probe(struct i2c_client *client, ts->int_gpiod = devm_gpiod_get_optional(&client->dev, "touch", GPIOD_IN); error = PTR_ERR_OR_ZERO(ts->int_gpiod); - if (error) { - if (error != -EPROBE_DEFER) - dev_err(&client->dev, "failed to get INT GPIO\n"); - return error; - } + if (error) + return dev_err_probe(&client->dev, error, "failed to get INT GPIO\n"); if (ts->int_gpiod) gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT"); From patchwork Thu Aug 27 18:58:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6B65739 for ; Thu, 27 Aug 2020 19:00:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B587F22B4D for ; Thu, 27 Aug 2020 19:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554847; bh=XU3wsdKRcEmN6C4Xh+CGzTTUh29BQR9tNEBC5r7uu9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fQ8tgXjo4IpeJCCHDHcJ0v3eCXRktU94QZ06Kt6MxBlb1D5ZYL288GZ6wuKoi0hpC vWhEIkLNB6+MriDsz03N2WDUKRrDcFL1yYIw0nktGCnc8pEvLB6vSCp105nHEfV3Ur iZKSgk6LLgq8MxZMv4hURaQ18sZBwb861FbfT4qw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727937AbgH0S7K (ORCPT ); Thu, 27 Aug 2020 14:59:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:49282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbgH0S7J (ORCPT ); Thu, 27 Aug 2020 14:59:09 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CAA622BEB; Thu, 27 Aug 2020 18:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554749; bh=XU3wsdKRcEmN6C4Xh+CGzTTUh29BQR9tNEBC5r7uu9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v38Y1XLeq8lhwiBRivr+rekc24A5cyWtWLIZMdKNuHCUX6FV3QThu+KAiZDwXwOPz EfW2axpQYoEqSbo1vEE/jqc55WY80DI8VKhogl3tln0gRiZPw34TOYy177UqQ5VD+r 5mmOMcYzz6oknzIazW3zSexgD4IJl89Z+rcNFMj0= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 08/27] Input: bu21029_ts - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:10 +0200 Message-Id: <20200827185829.30096-9-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/bu21029_ts.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c index 49a8d4bbca3a..96c178b606dc 100644 --- a/drivers/input/touchscreen/bu21029_ts.c +++ b/drivers/input/touchscreen/bu21029_ts.c @@ -360,23 +360,15 @@ static int bu21029_probe(struct i2c_client *client, } bu21029->vdd = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(bu21029->vdd)) { - error = PTR_ERR(bu21029->vdd); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "failed to acquire 'vdd' supply: %d\n", error); - return error; - } + if (IS_ERR(bu21029->vdd)) + return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd), + "failed to acquire 'vdd' supply\n"); bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(bu21029->reset_gpios)) { - error = PTR_ERR(bu21029->reset_gpios); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "failed to acquire 'reset' gpio: %d\n", error); - return error; - } + if (IS_ERR(bu21029->reset_gpios)) + return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios), + "failed to acquire 'reset' gpio\n"); in_dev = devm_input_allocate_device(&client->dev); if (!in_dev) { From patchwork Thu Aug 27 18:58:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741409 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC98C739 for ; Thu, 27 Aug 2020 19:00:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C536122D05 for ; Thu, 27 Aug 2020 19:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554846; bh=58yzE7nTwEaef/I5SNdV8roNQcWGPiVHAIvbkPbo/j0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Nf3f/Iu3Weic+txpGm7x/6sSKf3iIoTlFzfLX4AVtsEM23HZ3YHpbQif7S9G5Oq+u TKNaF4TkM+RZmMhcSddYYZE2cPD2ymEpfAUpou1vfWbqKyEtXBLHkMVLDHEpR4MmoB 904vZ+CTHWNIURENo5vnptjgw+H5c08e2MTve4Ro= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728027AbgH0S7N (ORCPT ); Thu, 27 Aug 2020 14:59:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbgH0S7M (ORCPT ); Thu, 27 Aug 2020 14:59:12 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6CBBD22BEA; Thu, 27 Aug 2020 18:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554752; bh=58yzE7nTwEaef/I5SNdV8roNQcWGPiVHAIvbkPbo/j0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i67ZNRM2AoaLxP8VlFRuuHzKyg+65pNt8UKjAlHGZoMCLxETTvb8IsY4L+96WgTPn hrILQ8U+vp+nGiyJt/w30ntBFZ0s+ESPpy8eu5OUGhIMRNAzjKBAczh34CJoZne+qm WXRfx0oJPPQdSEuFOoaQMa/9WsJdBdt+g7Xr2+bk= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 09/27] Input: chipone_icn8318 - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:11 +0200 Message-Id: <20200827185829.30096-10-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/chipone_icn8318.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c index d91d2fd78649..5bee007184c4 100644 --- a/drivers/input/touchscreen/chipone_icn8318.c +++ b/drivers/input/touchscreen/chipone_icn8318.c @@ -194,12 +194,8 @@ static int icn8318_probe(struct i2c_client *client, return -ENOMEM; data->wake_gpio = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW); - if (IS_ERR(data->wake_gpio)) { - error = PTR_ERR(data->wake_gpio); - if (error != -EPROBE_DEFER) - dev_err(dev, "Error getting wake gpio: %d\n", error); - return error; - } + if (IS_ERR(data->wake_gpio)) + return dev_err_probe(dev, PTR_ERR(data->wake_gpio), "Error getting wake gpio\n"); input = devm_input_allocate_device(dev); if (!input) From patchwork Thu Aug 27 18:58:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741337 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10DCF14E5 for ; Thu, 27 Aug 2020 18:59:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA72C22CB3 for ; Thu, 27 Aug 2020 18:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554760; bh=oefuxCdTWcUVkgR+QTDMbysB6a2BMg5jP1BMM4MlPAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VjM5NsoMoutJ8oGnb4vyifRGsNvCYPHsop1EaTMAVWH8uTaEZwbedzan9vakgGBKu fmibLjHBqE1TcCBMiwusl9mLiH7Y0ZVt+8klGLyD9huEbvEh8S4SJvx/6xCu0ZCMby 6ahZiCoFsyczZ/7XcbJUi1KFpuQvMlg0fow1dGPg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728041AbgH0S7R (ORCPT ); Thu, 27 Aug 2020 14:59:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:49460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728035AbgH0S7Q (ORCPT ); Thu, 27 Aug 2020 14:59:16 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B3FF022BEB; Thu, 27 Aug 2020 18:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554755; bh=oefuxCdTWcUVkgR+QTDMbysB6a2BMg5jP1BMM4MlPAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/sQfpSo7FWbJ1e7nO0cc5ELrY71M4qw9gq+zL5IWGl2LIHkck1DuJp0tfK64WHgk sdS27aigrd1TaES47boxYWQCPRYu5dvQnuiiqsvj1Nv1fDMldOnndm3lPCkVEZzO/D qYjESQffZNPQ24XZuSs5xQr65MTB0NBSO9E+7nuU= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 10/27] Input: cy8ctma140 - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:12 +0200 Message-Id: <20200827185829.30096-11-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/cy8ctma140.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/cy8ctma140.c b/drivers/input/touchscreen/cy8ctma140.c index a9be29139cbf..23da5bb00ead 100644 --- a/drivers/input/touchscreen/cy8ctma140.c +++ b/drivers/input/touchscreen/cy8ctma140.c @@ -259,12 +259,8 @@ static int cy8ctma140_probe(struct i2c_client *client, ts->regulators[1].supply = "vdd"; error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators), ts->regulators); - if (error) { - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get regulators %d\n", - error); - return error; - } + if (error) + return dev_err_probe(dev, error, "Failed to get regulators\n"); error = cy8ctma140_power_up(ts); if (error) From patchwork Thu Aug 27 18:58:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741405 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D39B113A4 for ; Thu, 27 Aug 2020 19:00:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BACBE2087C for ; Thu, 27 Aug 2020 19:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554844; bh=E/Nqu7k08v69pmYNgRfgpit87lGs45F9vZiVl/29fKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jssYWQeQk+PZIbpwTZFE+SRQ63E0cgu/d1TQM2svJQBx3I/aTukfniaBPTPNfpuPr qh+jWLG3yiC45u2QsEYNUvpwVt5lg1ovBlcKRkORwhThXm4Vn5c1VNTmHv9pKKQBSj auaXly+esQwz1PmAC1zmG7bRlpkbBg/dZN4d90wo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728054AbgH0S7U (ORCPT ); Thu, 27 Aug 2020 14:59:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbgH0S7T (ORCPT ); Thu, 27 Aug 2020 14:59:19 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0DF6522BEA; Thu, 27 Aug 2020 18:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554758; bh=E/Nqu7k08v69pmYNgRfgpit87lGs45F9vZiVl/29fKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hadf1zyBhyuvwF6HlnRT6CWcw3uccgLCRNPwEn/21cy/oAfLzxahL6ff10c3qh/TU kfcqCx3hdEm1oPPWznU0kyRcJXR04ZBldWzEFS54dBplZPC5x4k7G3soobrkuMjsYY VKFl8b5cN8mLjcSzxlLq3oTMVsfG1SHBmKquMLGI= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 11/27] Input: edf-ft5x06 - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:13 +0200 Message-Id: <20200827185829.30096-12-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/edt-ft5x06.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 6ff81d48da86..d4827ac963b0 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -1098,13 +1098,9 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, tsdata->max_support_points = chip_data->max_support_points; tsdata->vcc = devm_regulator_get(&client->dev, "vcc"); - if (IS_ERR(tsdata->vcc)) { - error = PTR_ERR(tsdata->vcc); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "failed to request regulator: %d\n", error); - return error; - } + if (IS_ERR(tsdata->vcc)) + return dev_err_probe(&client->dev, PTR_ERR(tsdata->vcc), + "failed to request regulator\n"); error = regulator_enable(tsdata->vcc); if (error < 0) { From patchwork Thu Aug 27 18:58:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 683E7739 for ; Thu, 27 Aug 2020 18:59:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5130822CB3 for ; Thu, 27 Aug 2020 18:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554765; bh=D3W11RS5LQuK0NiOtRpaiYpfrAhdnBPWAZ5FOYkiWdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=db/76rGQETsf5tLX+wcy5oJq6LE4s4cwXyMSK7+kEVX+TLrq19LqaD0ic7r4tblR9 1VQELmdCh82AQUOsblAhDwBv0+pXcDZ0FwSlwCQF4bxJlFl9PDXZFMQO/ALSF1jznp zAytrtiYgxN4Uu5kEc4Z8P3ScQDiYS4+EPHWD/AY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728079AbgH0S7Y (ORCPT ); Thu, 27 Aug 2020 14:59:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:49600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbgH0S7W (ORCPT ); Thu, 27 Aug 2020 14:59:22 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7487D2087E; Thu, 27 Aug 2020 18:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554762; bh=D3W11RS5LQuK0NiOtRpaiYpfrAhdnBPWAZ5FOYkiWdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kxo8B7z/KfXCzKq6i9xdm5ZGZ30wxjrUHTxPxbWshx3XUfUIB4KPbrRyBxVzX7GGS AC6Be2aH8B/1ewVSYLxARvkdKZS8lDRb+CBweofoYewIqDTK9PYyhNZsPoH5xZWJzg 6aysKruXbFti6mJolKvpAN6Kl5u3Zr/Z9K/S7AcQ= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 12/27] Input: ektf2127 - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:14 +0200 Message-Id: <20200827185829.30096-13-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/ektf2127.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c index eadd389cf81f..cd41483cfae5 100644 --- a/drivers/input/touchscreen/ektf2127.c +++ b/drivers/input/touchscreen/ektf2127.c @@ -237,12 +237,8 @@ static int ektf2127_probe(struct i2c_client *client, /* This requests the gpio *and* turns on the touchscreen controller */ ts->power_gpios = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH); - if (IS_ERR(ts->power_gpios)) { - error = PTR_ERR(ts->power_gpios); - if (error != -EPROBE_DEFER) - dev_err(dev, "Error getting power gpio: %d\n", error); - return error; - } + if (IS_ERR(ts->power_gpios)) + return dev_err_probe(dev, PTR_ERR(ts->power_gpios), "Error getting power gpio\n"); input = devm_input_allocate_device(dev); if (!input) From patchwork Thu Aug 27 18:58:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741403 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D822E739 for ; Thu, 27 Aug 2020 19:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B67132087C for ; Thu, 27 Aug 2020 19:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554837; bh=AHh04oEDvUq+tXVnWK9UVr7jNcvZEi5a77snM2minWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IxmMThYY02QIRt7bmmisib0kJ23akGZkaP2QgNF540ywAnGWeSFOb7v5OyqqFQttr VGiC61+7sy3+hOjcTnfXxNe+d6i21fY5VizU0eQqh8wvdStBwvlnDC7isbi3wW290Y WzwblRww5xyyR+0hjl62EYGuYZS0uuqJ0VbZ8cdo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728074AbgH0S70 (ORCPT ); Thu, 27 Aug 2020 14:59:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:49710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728092AbgH0S70 (ORCPT ); Thu, 27 Aug 2020 14:59:26 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2A1922BEA; Thu, 27 Aug 2020 18:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554765; bh=AHh04oEDvUq+tXVnWK9UVr7jNcvZEi5a77snM2minWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1+KnT1PxVsXRGW10lrukFNu9QXdoZZkurTwmLXHL6A0k12Dm0i5LLG3Mk3scr5Ct iPhllP3f2cE+FGW7StRGOdNTiKsGOXdiy6dQq4jkwXNEdAX0+3maTaqNbOId+a/wC1 wssJ6KvWGbCyjHbYC4nbE4A62QCfMZS//CYq88Mk= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 13/27] Input: elants_i2c - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:15 +0200 Message-Id: <20200827185829.30096-14-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/elants_i2c.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index b0bd5bb079be..ad299eb333f1 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -1245,24 +1245,14 @@ static int elants_i2c_probe(struct i2c_client *client, i2c_set_clientdata(client, ts); ts->vcc33 = devm_regulator_get(&client->dev, "vcc33"); - if (IS_ERR(ts->vcc33)) { - error = PTR_ERR(ts->vcc33); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get 'vcc33' regulator: %d\n", - error); - return error; - } + if (IS_ERR(ts->vcc33)) + return dev_err_probe(&client->dev, PTR_ERR(ts->vcc33), + "Failed to get 'vcc33' regulator\n"); ts->vccio = devm_regulator_get(&client->dev, "vccio"); - if (IS_ERR(ts->vccio)) { - error = PTR_ERR(ts->vccio); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get 'vccio' regulator: %d\n", - error); - return error; - } + if (IS_ERR(ts->vccio)) + return dev_err_probe(&client->dev, PTR_ERR(ts->vccio), + "Failed to get 'vccio' regulator\n"); ts->reset_gpio = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ts->reset_gpio)) { From patchwork Thu Aug 27 18:58:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741401 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A73C6739 for ; Thu, 27 Aug 2020 19:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9067822B4D for ; Thu, 27 Aug 2020 19:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554835; bh=1aI34oflIhzPRAI0UU1xJacHYtSBrAKdYvjEbULjxgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dzBLj6lwIrvaDjO9RkYuKYF1rwjgoMVoKdUGmGSnIeGIk65JlyEGlkJCdPxA53x7u qp6wuIQ97NmcWecw/a+tNZSfzi8DWtLj//X5zKgVqsS4bUzkbt02f5CcDWsAZUvgiF HpwnEKb6GDbcuiacJtrPGOuRhUqnxHjF7TruYPhE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728114AbgH0S7b (ORCPT ); Thu, 27 Aug 2020 14:59:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:49802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728109AbgH0S73 (ORCPT ); Thu, 27 Aug 2020 14:59:29 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C9F022BEB; Thu, 27 Aug 2020 18:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554768; bh=1aI34oflIhzPRAI0UU1xJacHYtSBrAKdYvjEbULjxgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZ5SeS7/or+YYxyw8LKT7pd5+Sbn8tF2kNZ+KYwBareZGJe7MR7z1YEDE3TzDF6UE DOFBGa3fjUEh1VFYz3ZluCyw1VCk5NgXL8Dm2vq01VXIqfu7Vwj6W38GMwFMWtzpgU j+YY9wLeJt8vtrPUjv2IOOmWm2Xq+a9rEEOL3Lso= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 14/27] Input: goodix - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:16 +0200 Message-Id: <20200827185829.30096-15-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/goodix.c | 40 ++++++++---------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 02c75ea385e0..48c4c3d297fe 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -864,7 +864,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) */ static int goodix_get_gpio_config(struct goodix_ts_data *ts) { - int error; struct device *dev; struct gpio_desc *gpiod; bool added_acpi_mappings = false; @@ -874,33 +873,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) dev = &ts->client->dev; ts->avdd28 = devm_regulator_get(dev, "AVDD28"); - if (IS_ERR(ts->avdd28)) { - error = PTR_ERR(ts->avdd28); - if (error != -EPROBE_DEFER) - dev_err(dev, - "Failed to get AVDD28 regulator: %d\n", error); - return error; - } + if (IS_ERR(ts->avdd28)) + return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n"); ts->vddio = devm_regulator_get(dev, "VDDIO"); - if (IS_ERR(ts->vddio)) { - error = PTR_ERR(ts->vddio); - if (error != -EPROBE_DEFER) - dev_err(dev, - "Failed to get VDDIO regulator: %d\n", error); - return error; - } + if (IS_ERR(ts->vddio)) + return dev_err_probe(dev, PTR_ERR(ts->vddio), "Failed to get VDDIO regulator\n"); retry_get_irq_gpio: /* Get the interrupt GPIO pin number */ gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN); - if (IS_ERR(gpiod)) { - error = PTR_ERR(gpiod); - if (error != -EPROBE_DEFER) - dev_dbg(dev, "Failed to get %s GPIO: %d\n", - GOODIX_GPIO_INT_NAME, error); - return error; - } + if (IS_ERR(gpiod)) + return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n", + GOODIX_GPIO_INT_NAME); + if (!gpiod && has_acpi_companion(dev) && !added_acpi_mappings) { added_acpi_mappings = true; if (goodix_add_acpi_gpio_mappings(ts) == 0) @@ -911,13 +897,9 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) /* Get the reset line GPIO pin number */ gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_IN); - if (IS_ERR(gpiod)) { - error = PTR_ERR(gpiod); - if (error != -EPROBE_DEFER) - dev_dbg(dev, "Failed to get %s GPIO: %d\n", - GOODIX_GPIO_RST_NAME, error); - return error; - } + if (IS_ERR(gpiod)) + return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n", + GOODIX_GPIO_RST_NAME); ts->gpiod_rst = gpiod; From patchwork Thu Aug 27 18:58:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741397 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCE6F739 for ; Thu, 27 Aug 2020 19:00:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBEA422BEA for ; Thu, 27 Aug 2020 19:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554834; bh=Dqxv1PukEgIMN3bm5Lm6sGdSDukCKcjdzgy7iM6VbfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BZhKWrjh6Shfrdbcce0pjWOGdZLEWppi3LYu9atulBw8qnN0cFjVmBcfCASgev47Y QsCo0Aj8gISJ5a4YHHqHngxeKIxYoPK7ITC7uP8mSppz3YKAwO7r9Xw3lo5Y9WtcSq FXjSNLjaurgxj6k0wgamryCkf1FQOKgbLITV2zsA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbgH0S7f (ORCPT ); Thu, 27 Aug 2020 14:59:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:49860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728122AbgH0S7c (ORCPT ); Thu, 27 Aug 2020 14:59:32 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 610BC2087E; Thu, 27 Aug 2020 18:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554772; bh=Dqxv1PukEgIMN3bm5Lm6sGdSDukCKcjdzgy7iM6VbfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Liu8obZvNyBblM0iUyAt5drhqfZgaCB4+6wJWN+DwRYCnf7Mgmr8uAX19RUbFmArt ZOlo+IE3uAMOWUg8j4FVbgGc46w4mW/NEQS6O6UywtK/OzlsQpdOKaQGSJOfX40rfA /lDwnnd0Aw22mLJ8EzJDPcdL8QmRChehhgqrVK/o= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 15/27] Input: melfas_mip4 - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:17 +0200 Message-Id: <20200827185829.30096-16-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/melfas_mip4.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index f67efdd040b2..d43a8643adcd 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1451,13 +1451,8 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) ts->gpio_ce = devm_gpiod_get_optional(&client->dev, "ce", GPIOD_OUT_LOW); - if (IS_ERR(ts->gpio_ce)) { - error = PTR_ERR(ts->gpio_ce); - if (error != EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get gpio: %d\n", error); - return error; - } + if (IS_ERR(ts->gpio_ce)) + return dev_err_probe(&client->dev, PTR_ERR(ts->gpio_ce), "Failed to get gpio\n"); error = mip4_power_on(ts); if (error) From patchwork Thu Aug 27 18:58:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741367 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 697DB14E5 for ; Thu, 27 Aug 2020 18:59:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 525B422BEA for ; Thu, 27 Aug 2020 18:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554798; bh=+sCZf4QqZftn2qRoSs7JjNAyL5o05Qs6eKp7oldk8O8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mcHxYTvvKD3cQ4pfltX7cxB1LL8URqXHVFfdO3//xa9e6usXoCGjFQ6OfppAvPC8A BzumF6ku+Xq8+NL0LZhSiZlErNDcQcWrBjTqKlbkFNCuqX0vBKM1x03tmB+RltzQpa iHqK6I9elWmgnpNdvx0rYoXSVFcfNnCLJR0do/xY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728149AbgH0S7i (ORCPT ); Thu, 27 Aug 2020 14:59:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:49950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728140AbgH0S7g (ORCPT ); Thu, 27 Aug 2020 14:59:36 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA3AD22CAF; Thu, 27 Aug 2020 18:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554775; bh=+sCZf4QqZftn2qRoSs7JjNAyL5o05Qs6eKp7oldk8O8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qp/WwPiHeQAN4vaC3bm30YMRpTpoY8Vfm+505NKC12/OLIrHyJ5oEQuaeZy4la7+J YMqom7EapQ9bZ2cS4ar8Xe6O3+XCOZiwmWoSQhJSkYh8zdGWS45rDnNWMF88ZEJmDD uFNVkZqsOJAFNQc5iEW+eE3dgzBpm7W1j8lMWTWU= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 16/27] Input: pixcir_i2c_ts - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:18 +0200 Message-Id: <20200827185829.30096-17-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/pixcir_i2c_ts.c | 38 +++++++---------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 9aa098577350..fb37567e2d7e 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c @@ -515,41 +515,27 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client, input_set_drvdata(input, tsdata); tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN); - if (IS_ERR(tsdata->gpio_attb)) { - error = PTR_ERR(tsdata->gpio_attb); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to request ATTB gpio: %d\n", - error); - return error; - } + if (IS_ERR(tsdata->gpio_attb)) + return dev_err_probe(dev, PTR_ERR(tsdata->gpio_attb), + "Failed to request ATTB gpio\n"); tsdata->gpio_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(tsdata->gpio_reset)) { - error = PTR_ERR(tsdata->gpio_reset); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to request RESET gpio: %d\n", - error); - return error; - } + if (IS_ERR(tsdata->gpio_reset)) + return dev_err_probe(dev, PTR_ERR(tsdata->gpio_reset), + "Failed to request RESET gpio\n"); tsdata->gpio_wake = devm_gpiod_get_optional(dev, "wake", GPIOD_OUT_HIGH); - if (IS_ERR(tsdata->gpio_wake)) { - error = PTR_ERR(tsdata->gpio_wake); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get wake gpio: %d\n", error); - return error; - } + if (IS_ERR(tsdata->gpio_wake)) + return dev_err_probe(dev, PTR_ERR(tsdata->gpio_wake), + "Failed to get wake gpio\n"); tsdata->gpio_enable = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); - if (IS_ERR(tsdata->gpio_enable)) { - error = PTR_ERR(tsdata->gpio_enable); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get enable gpio: %d\n", error); - return error; - } + if (IS_ERR(tsdata->gpio_enable)) + return dev_err_probe(dev, PTR_ERR(tsdata->gpio_enable), + "Failed to get enable gpio\n"); if (tsdata->gpio_enable) msleep(100); From patchwork Thu Aug 27 18:58:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741353 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8E0C1731 for ; Thu, 27 Aug 2020 18:59:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFEAE22BF5 for ; Thu, 27 Aug 2020 18:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554781; bh=3hmVzlm79kXWB8lCrNJXeIgLjMWsqoIQvCQOPffnOq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AnmuvSt5Sn/3qO1LQXs/9ou7rB6JoXLzbKSYOPPTvZWPdxNmOqibErPxIWSaim11W nvBEq71Nu04+cJ1KcU/3CuYUsOuFE4yLll3wD8eeswKfLyf3nZplRxf5iZZ1HTP8dE 9UTTDGDAMWMbQzoa9um3Rgion59A+7/PUPMLuZjw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728169AbgH0S7k (ORCPT ); Thu, 27 Aug 2020 14:59:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:50048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728134AbgH0S7j (ORCPT ); Thu, 27 Aug 2020 14:59:39 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E09B22BEA; Thu, 27 Aug 2020 18:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554778; bh=3hmVzlm79kXWB8lCrNJXeIgLjMWsqoIQvCQOPffnOq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmzbWQbTXgsJOfBxLpp43mBeKKHuFbaz7RoatvJp7WIo6yLcTFbsignuLJWWdTJ4L ayYVusNyf+A+AfzK1MnPtZCbTmzdslEECp3k+ovKE2bhcaxPVvhoKV6Jm7K4IrESCy qUBgVz1GaZxCMo3oJ/+Wga4Oaw7qLa4/TqCi14wY= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 17/27] Input: raydium_i2c_ts - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:19 +0200 Message-Id: <20200827185829.30096-18-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/raydium_i2c_ts.c | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index fe245439adee..4017775f6466 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -1015,32 +1015,20 @@ static int raydium_i2c_probe(struct i2c_client *client, i2c_set_clientdata(client, ts); ts->avdd = devm_regulator_get(&client->dev, "avdd"); - if (IS_ERR(ts->avdd)) { - error = PTR_ERR(ts->avdd); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get 'avdd' regulator: %d\n", error); - return error; - } + if (IS_ERR(ts->avdd)) + return dev_err_probe(&client->dev, PTR_ERR(ts->avdd), + "Failed to get 'avdd' regulator\n"); ts->vccio = devm_regulator_get(&client->dev, "vccio"); - if (IS_ERR(ts->vccio)) { - error = PTR_ERR(ts->vccio); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get 'vccio' regulator: %d\n", error); - return error; - } + if (IS_ERR(ts->vccio)) + return dev_err_probe(&client->dev, PTR_ERR(ts->vccio), + "Failed to get 'vccio' regulator\n"); ts->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ts->reset_gpio)) { - error = PTR_ERR(ts->reset_gpio); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "failed to get reset gpio: %d\n", error); - return error; - } + if (IS_ERR(ts->reset_gpio)) + return dev_err_probe(&client->dev, PTR_ERR(ts->reset_gpio), + "Failed to get reset gpio\n"); error = raydium_i2c_power_on(ts); if (error) From patchwork Thu Aug 27 18:58:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741357 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE216739 for ; Thu, 27 Aug 2020 18:59:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9036A22CAF for ; Thu, 27 Aug 2020 18:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554787; bh=mhzjeNt2Pr/YS+s9dAme3pQs5JrjYzFjpcgQ00RtFAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s4/zMLhCuwwYE9hrOB1VOmvxZmltc1Sqw/sNo/9+KrAdpcaTnEYzcEm9uCSDD44lc EnAk9KNDD0PxXQw7iOwrytESCCDBE7eMmifhbdnkJTbXnE/0sdMPc0qwo+qcU4Fztj 1zkflNC2W8a8z9idO18YijYMlupPGGl/7TCbHgY4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728193AbgH0S7n (ORCPT ); Thu, 27 Aug 2020 14:59:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:50166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728184AbgH0S7m (ORCPT ); Thu, 27 Aug 2020 14:59:42 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 65D8022BEB; Thu, 27 Aug 2020 18:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554782; bh=mhzjeNt2Pr/YS+s9dAme3pQs5JrjYzFjpcgQ00RtFAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+xiDIZjnFhBHvG5TvPrMQV8EVlJ2n1bixQfrQX5amEM3jgHlmSe0FlQOZ/pX9HCM sd+w23D+hDANe/3ZIqpcm6csk0Z50O9jj5wDAWc2UNOMss9MzIJh6d41wfvhqVvpym ZqixYj8oXufIb8SIPneJQM+WH176VXiWEVBs670o= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 18/27] Input: resistive-adc-touch - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:20 +0200 Message-Id: <20200827185829.30096-19-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/resistive-adc-touch.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c index cfc8bb4553f7..46b5a6caef84 100644 --- a/drivers/input/touchscreen/resistive-adc-touch.c +++ b/drivers/input/touchscreen/resistive-adc-touch.c @@ -108,12 +108,8 @@ static int grts_probe(struct platform_device *pdev) /* get the channels from IIO device */ st->iio_chans = devm_iio_channel_get_all(dev); - if (IS_ERR(st->iio_chans)) { - error = PTR_ERR(st->iio_chans); - if (error != -EPROBE_DEFER) - dev_err(dev, "can't get iio channels.\n"); - return error; - } + if (IS_ERR(st->iio_chans)) + return dev_err_probe(dev, PTR_ERR(st->iio_chans), "can't get iio channels\n"); chan = &st->iio_chans[0]; st->pressure = false; From patchwork Thu Aug 27 18:58:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741365 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF1FF1731 for ; Thu, 27 Aug 2020 18:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B897122D06 for ; Thu, 27 Aug 2020 18:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554796; bh=Te+1Vs7Ex+t0jDtsc8vbPvvnKgzKCI3XcxqUUGiNU9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tXZG55x8uvugBtY3teKMqwO/zL9AUisjsiCgXge6Y1TUDz8yuKVoOZ9iqSB6fR4+G kepmjGErj1OPGyGW617qvBX+5VNYnEK3/gYlXyxWLACjIcaW6nCxoRti4o813/eyUy ILNGSjcu/WNCv1X4mVqbBEx3Jr1E3SZPksx3lCzY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728184AbgH0S7q (ORCPT ); Thu, 27 Aug 2020 14:59:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:50256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727031AbgH0S7q (ORCPT ); Thu, 27 Aug 2020 14:59:46 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8EA422BEA; Thu, 27 Aug 2020 18:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554785; bh=Te+1Vs7Ex+t0jDtsc8vbPvvnKgzKCI3XcxqUUGiNU9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e0SGEsni7PawLPsIP2R97uTY0qr9hyR3U3wZqfPOO62P4rFHeEGvvGzYu++3pVj4M EloGVJ1PSTUxyfSda5p8Lc45apAXiAtTTZA/lbEwS01kQalGdPN189l2q+RwN2GTPt PS4o0Ik0NkokatsH5vagMZenYvxMl+nUTx0DEMnc= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 19/27] Input: silead - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:21 +0200 Message-Id: <20200827185829.30096-20-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/silead.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index 8fa2f3b7cfd8..754debb4b2c4 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -512,11 +512,9 @@ static int silead_ts_probe(struct i2c_client *client, /* Power GPIO pin */ data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); - if (IS_ERR(data->gpio_power)) { - if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) - dev_err(dev, "Shutdown GPIO request failed\n"); - return PTR_ERR(data->gpio_power); - } + if (IS_ERR(data->gpio_power)) + return dev_err_probe(dev, PTR_ERR(data->gpio_power), + "Shutdown GPIO request failed\n"); error = silead_ts_setup(client); if (error) From patchwork Thu Aug 27 18:58:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741359 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECAE6739 for ; Thu, 27 Aug 2020 18:59:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D204E22CB3 for ; Thu, 27 Aug 2020 18:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554790; bh=AnyFBN6EM3t7oWURmykqll7xBtGomPY15LUxYtq0J1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ehlcU44fZ7xuAiDJJFl9GemsbSqryOyvZTf0RihxRfwKdG6IC+ZHOqQOdnp38j1Vo be2C/9jRCUd8EGGmuk3J1BStfQXsBISmw3cfR/42BuW5G/GxVrXl53n83E8sz0U04M oZM1aMkkiNF/dtrW6QrgQOcCiTZU2kVus5FzbjUk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728239AbgH0S7u (ORCPT ); Thu, 27 Aug 2020 14:59:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:50382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728227AbgH0S7t (ORCPT ); Thu, 27 Aug 2020 14:59:49 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 17D6B22BEB; Thu, 27 Aug 2020 18:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554789; bh=AnyFBN6EM3t7oWURmykqll7xBtGomPY15LUxYtq0J1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BkU6N7hm2z1w2u2o7lL0k0/AbBWw6EAuPH3CUmuhMYSIATbmb/cxBWKSwtzJ60EdT vyceKVUFvf2Z4PbUu43ZmaWXvkpAVJxYFq9LCt3zxj3qTU04VKM5A5rk+Ved1FuWCC jbdpApNnBk/C84GbuvVolro6OI+6RBapxmCC19jk= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 20/27] Input: sis_i2c - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:22 +0200 Message-Id: <20200827185829.30096-21-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/sis_i2c.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/sis_i2c.c b/drivers/input/touchscreen/sis_i2c.c index 6274555f1673..348a2ba9b7c9 100644 --- a/drivers/input/touchscreen/sis_i2c.c +++ b/drivers/input/touchscreen/sis_i2c.c @@ -311,23 +311,15 @@ static int sis_ts_probe(struct i2c_client *client, ts->attn_gpio = devm_gpiod_get_optional(&client->dev, "attn", GPIOD_IN); - if (IS_ERR(ts->attn_gpio)) { - error = PTR_ERR(ts->attn_gpio); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get attention GPIO: %d\n", error); - return error; - } + if (IS_ERR(ts->attn_gpio)) + return dev_err_probe(&client->dev, PTR_ERR(ts->attn_gpio), + "Failed to get attention GPIO\n"); ts->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ts->reset_gpio)) { - error = PTR_ERR(ts->reset_gpio); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "Failed to get reset GPIO: %d\n", error); - return error; - } + if (IS_ERR(ts->reset_gpio)) + return dev_err_probe(&client->dev, PTR_ERR(ts->reset_gpio), + "Failed to get reset GPIO\n"); sis_ts_reset(ts); From patchwork Thu Aug 27 18:58:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741393 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B1E91731 for ; Thu, 27 Aug 2020 19:00:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCAC520786 for ; Thu, 27 Aug 2020 19:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554832; bh=JMGBhCbFmH+9hMDpsQ5Azdm1zxEQ9lgD8y90ydoMsQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=B/UL+lpsY9aEpP6EyNiPP1H4Sjrn4/ctuyg9hsraqdYXz2UP4WpR99kFs21bxXhCj Y8+0vxcVewiXyXJlNS7sw+vfqb2rp1qStikMVbWV343wTHcwVrq6HqMs3HlvaBrJiT PmJdUP7+oHrmGM3NklaFl7PW4/J+vz3uiAtlBJec= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728261AbgH0S76 (ORCPT ); Thu, 27 Aug 2020 14:59:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:50462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728211AbgH0S7x (ORCPT ); Thu, 27 Aug 2020 14:59:53 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E4B42087E; Thu, 27 Aug 2020 18:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554792; bh=JMGBhCbFmH+9hMDpsQ5Azdm1zxEQ9lgD8y90ydoMsQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kOk7ctcGE2MBFeLLMWqu0pat1Qj7C19IKf9gJ4EkY61L5goHm2FHin3TtCBdZPaev BMQ3PvDTossgOGYqKdY/cbW/rZqHd+63DcaF5ZwxpB3Jlhiro2ol3ga/DUfgEoCJk8 RW3MROPytreat/iGj6aJAbBzdaeu4CPnwN6HPXNs= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 21/27] Input: surface3_spi - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:23 +0200 Message-Id: <20200827185829.30096-22-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/surface3_spi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c index ce4828b1415a..25bb77ddf2ef 100644 --- a/drivers/input/touchscreen/surface3_spi.c +++ b/drivers/input/touchscreen/surface3_spi.c @@ -223,7 +223,6 @@ static void surface3_spi_power(struct surface3_ts_data *data, bool on) */ static int surface3_spi_get_gpio_config(struct surface3_ts_data *data) { - int error; struct device *dev; struct gpio_desc *gpiod; int i; @@ -233,15 +232,9 @@ static int surface3_spi_get_gpio_config(struct surface3_ts_data *data) /* Get the reset lines GPIO pin number */ for (i = 0; i < 2; i++) { gpiod = devm_gpiod_get_index(dev, NULL, i, GPIOD_OUT_LOW); - if (IS_ERR(gpiod)) { - error = PTR_ERR(gpiod); - if (error != -EPROBE_DEFER) - dev_err(dev, - "Failed to get power GPIO %d: %d\n", - i, - error); - return error; - } + if (IS_ERR(gpiod)) + return dev_err_probe(dev, PTR_ERR(gpiod), + "Failed to get power GPIO %d\n", i); data->gpiod_rst[i] = gpiod; } From patchwork Thu Aug 27 18:58:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741369 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89E24739 for ; Thu, 27 Aug 2020 18:59:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 687B62087E for ; Thu, 27 Aug 2020 18:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554799; bh=uuRqkmEQUfrTFVyLKREdckixX1+af1YgVze1b7IwB/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nv0YAFRI7qbbbhiTkRKB3YkzzB40lVsptv0lY0P9r4lmAknkwIp3jmb0Vncu/mgxw /Ve13k5DdeGiPUL1amoaIh0zGT1nVPEfX8o4sIclHRd+ZQKTJ9pt1xXckLyggX6VQe Mm0b/NL8JyAjcipj0CnH0ZHrGjROP1b9ySftQkqY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728250AbgH0S75 (ORCPT ); Thu, 27 Aug 2020 14:59:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:50604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728227AbgH0S74 (ORCPT ); Thu, 27 Aug 2020 14:59:56 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12FA422BEA; Thu, 27 Aug 2020 18:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554795; bh=uuRqkmEQUfrTFVyLKREdckixX1+af1YgVze1b7IwB/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KKPFcFkSX0ci8UuDDGQh/QU7DazBDmgvPMk2uABsqU1ddu0Ncm1yFZm3PesMQZ8WL BDiv8KVM41hh7UNoGs7CIfc2BXK/aa9d6zGR71rd07NBeLrFtRpU19sFLcS8Jq9urg cN8hXbkjf6yFnwKx84VaaOxGeuAi2FsMU9m7DbFM= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 22/27] Input: sx8643 - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:24 +0200 Message-Id: <20200827185829.30096-23-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/input/touchscreen/sx8654.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c index de85e57b2486..d2ed9be64c3a 100644 --- a/drivers/input/touchscreen/sx8654.c +++ b/drivers/input/touchscreen/sx8654.c @@ -323,13 +323,9 @@ static int sx8654_probe(struct i2c_client *client, sx8654->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(sx8654->gpio_reset)) { - error = PTR_ERR(sx8654->gpio_reset); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, "unable to get reset-gpio: %d\n", - error); - return error; - } + if (IS_ERR(sx8654->gpio_reset)) + return dev_err_probe(&client->dev, PTR_ERR(sx8654->gpio_reset), + "unable to get reset-gpio\n"); dev_dbg(&client->dev, "got GPIO reset pin\n"); sx8654->data = device_get_match_data(&client->dev); From patchwork Thu Aug 27 18:58:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B76BF1731 for ; Thu, 27 Aug 2020 19:00:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9613E20786 for ; Thu, 27 Aug 2020 19:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554829; bh=gJBuFf1oCwqpqgKOzFQCvP4guTFRm3VdbyiI39bJxYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BdJBKk1w2NFanxd3THBsgyD1gdKPnrHhv/nkFZXISpuYzwSvQJsOxikhgU5p+3+wA YMWjQmj5LuJiNxI5iPMCoQn7KKKGmkvaPGiXFQ0zOvGOE6vQcNU80Jvvar7fI1E57R d9QOUSUMEXdaOnao2aM3VWyQx7VN95yGMduDzGGs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbgH0TAA (ORCPT ); Thu, 27 Aug 2020 15:00:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:50662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbgH0TAA (ORCPT ); Thu, 27 Aug 2020 15:00:00 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E5B122BEB; Thu, 27 Aug 2020 18:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554799; bh=gJBuFf1oCwqpqgKOzFQCvP4guTFRm3VdbyiI39bJxYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BnEeAY8AeQUcsrn9ezTciUPfH0UQujFaSFGrS/LRM3dBcIrWYCSaGLKOL2pT/37fa JXTKQnMyDI8JzjUam6oPm5Y+Vlc6Ci0Df6gWxH6WOrzOfsFK3U5sfUoR/gZIL42Cwo hFfoE8wd0ulvWycdGnUzBzhxvWdFgAInGVYmi/D4= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 23/27] Input: bcm-keypad - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:25 +0200 Message-Id: <20200827185829.30096-24-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe() and devm_clk_get_optional(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Use also devm_clk_get_optional() --- drivers/input/keyboard/bcm-keypad.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c index 2b771c3a5578..23e11b4efd13 100644 --- a/drivers/input/keyboard/bcm-keypad.c +++ b/drivers/input/keyboard/bcm-keypad.c @@ -376,17 +376,11 @@ static int bcm_kp_probe(struct platform_device *pdev) return PTR_ERR(kp->base); /* Enable clock */ - kp->clk = devm_clk_get(&pdev->dev, "peri_clk"); + kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk"); if (IS_ERR(kp->clk)) { - error = PTR_ERR(kp->clk); - if (error != -ENOENT) { - if (error != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to get clock\n"); - return error; - } - dev_dbg(&pdev->dev, - "No clock specified. Assuming it's enabled\n"); - kp->clk = NULL; + return dev_err_probe(&pdev->dev, error, "Failed to get clock\n"); + } else if (!kp->clk) { + dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n"); } else { unsigned int desired_rate; long actual_rate; From patchwork Thu Aug 27 18:58:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C723739 for ; Thu, 27 Aug 2020 19:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3322F2087C for ; Thu, 27 Aug 2020 19:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554827; bh=/jWrUvkyehWmpjjCPlltLr1JAG0sr6Qc32pKieuISoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=RTdeIiPQdPF0CXZEBkPUjPFGKGBerXQ3tOpyg6ixDyDVi+65K5tBVWyTIIr2HJdVS R4b+s48weCDt6/NNb1/HWXsW5zC1E+E7ZOESWZQ3RqiMpAVPfbBvgyz+vbaMB4rvt7 DptpVZE0+ZQT2NjTkBYx+7qKHMOB3MgZNhDFX+0s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbgH0TAJ (ORCPT ); Thu, 27 Aug 2020 15:00:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:50796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728289AbgH0TAD (ORCPT ); Thu, 27 Aug 2020 15:00:03 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C79802087E; Thu, 27 Aug 2020 18:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554802; bh=/jWrUvkyehWmpjjCPlltLr1JAG0sr6Qc32pKieuISoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uU1UvUH1cXvsczwBGXa7c2b7fVAWGWudB4/QyJq0LUX8Fo/UbfvO8lXfYnwyXYrCw LXbnh5ijhwFtmrU2B5UYMoV/aqaY42dvVzRNrqPzS8/DC9Y0LMqt75pu2mSGTPt8Q1 zhTS10dLDV3St6zkGpdDCqmqQpX9a7eHscujSwNk= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 24/27] gpio: Add devm_fwnode_gpiod_get_optional() helpers Date: Thu, 27 Aug 2020 20:58:26 +0200 Message-Id: <20200827185829.30096-25-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add devm_fwnode_gpiod_get_optional() and devm_fwnode_gpiod_get_index_optional() helpers, similar to regular devm_gpiod optional versions. Drivers getting GPIOs from a firmware node might use it to remove some boilerplate code. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- Changes since v2: 1. Return NULL Changes since v1: 1. New patch --- drivers/gpio/gpiolib-devres.c | 71 +++++++++++++++++++++++++++++++++++ include/linux/gpio/consumer.h | 30 +++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c index 7dbce4c4ebdf..f8476f6a65cc 100644 --- a/drivers/gpio/gpiolib-devres.c +++ b/drivers/gpio/gpiolib-devres.c @@ -184,6 +184,37 @@ struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, } EXPORT_SYMBOL_GPL(devm_gpiod_get_from_of_node); +/** + * devm_fwnode_gpiod_get_optional - Resource-managed fwnode_gpiod_get_index() + * for optional GPIO + * @dev: GPIO consumer + * @fwnode: firmware node containing GPIO reference + * @con_id: function within the GPIO consumer + * @flags: GPIO initialization flags + * @label: label to attach to the requested GPIO + * + * GPIO descriptors returned from this function are automatically disposed on + * driver detach. + * + * This is equivalent to devm_fwnode_gpiod_get_index(), except that when no + * GPIO with the specified index was assigned to the requested function it will + * return NULL. This is convenient for drivers that need to handle optional + * GPIOs. + * + * On successful request the GPIO pin is configured in accordance with + * provided @flags. + */ +struct gpio_desc *devm_fwnode_gpiod_get_optional(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id, + enum gpiod_flags flags, + const char *label) +{ + return devm_fwnode_gpiod_get_index_optional(dev, fwnode, con_id, 0, + flags, label); +} +EXPORT_SYMBOL_GPL(devm_fwnode_gpiod_get_optional); + /** * devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node * @dev: GPIO consumer @@ -226,6 +257,46 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, } EXPORT_SYMBOL_GPL(devm_fwnode_gpiod_get_index); +/** + * devm_fwnode_gpiod_get_index_optional - Resource-managed fwnode_gpiod_get_index() + * for optional GPIO + * @dev: GPIO consumer + * @fwnode: firmware node containing GPIO reference + * @con_id: function within the GPIO consumer + * @index: index of the GPIO to obtain in the consumer + * @flags: GPIO initialization flags + * @label: label to attach to the requested GPIO + * + * GPIO descriptors returned from this function are automatically disposed on + * driver detach. + * + * This is equivalent to devm_fwnode_gpiod_get_index(), except that when no + * GPIO with the specified index was assigned to the requested function it will + * return NULL. This is convenient for drivers that need to handle optional + * GPIOs. + * + * On successful request the GPIO pin is configured in accordance with + * provided @flags. + */ +struct gpio_desc *devm_fwnode_gpiod_get_index_optional(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id, int index, + enum gpiod_flags flags, + const char *label) +{ + struct gpio_desc *desc; + + desc = devm_fwnode_gpiod_get_index(dev, fwnode, con_id, index, flags, + label); + if (IS_ERR(desc)) { + if (PTR_ERR(desc) == -ENOENT) + return NULL; + } + + return desc; +} +EXPORT_SYMBOL_GPL(devm_fwnode_gpiod_get_index_optional); + /** * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional() * @dev: GPIO consumer diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 901aab89d025..7854d80b1e9a 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -183,11 +183,21 @@ struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, const char *con_id, int index, enum gpiod_flags flags, const char *label); +struct gpio_desc *devm_fwnode_gpiod_get_optional(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id, + enum gpiod_flags flags, + const char *label); struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, struct fwnode_handle *child, const char *con_id, int index, enum gpiod_flags flags, const char *label); +struct gpio_desc *devm_fwnode_gpiod_get_index_optional(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id, int index, + enum gpiod_flags flags, + const char *label); #else /* CONFIG_GPIOLIB */ @@ -562,6 +572,16 @@ struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, return ERR_PTR(-ENOSYS); } +static inline +struct gpio_desc *devm_fwnode_gpiod_get_optional(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id, + enum gpiod_flags flags, + const char *label) +{ + return NULL; +} + static inline struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, struct fwnode_handle *fwnode, @@ -572,6 +592,16 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, return ERR_PTR(-ENOSYS); } +static inline +struct gpio_desc *devm_fwnode_gpiod_get_index_optional(struct device *dev, + struct fwnode_handle *fwnode, + const char *con_id, int index, + enum gpiod_flags flags, + const char *label) +{ + return NULL; +} + #endif /* CONFIG_GPIOLIB */ static inline From patchwork Thu Aug 27 18:58:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741385 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB0DE13A4 for ; Thu, 27 Aug 2020 19:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B37F72087C for ; Thu, 27 Aug 2020 19:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554827; bh=AUHZeGZQ1QvvZ/NYV0F6hVwKHpi1jDQ3ZUVwX6+r8bQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nH704VvtoSu40FE2FRXxOKkPu7iggRNjTalbeXDUFT61i+pb6tbczTdJQJtroVVi0 AsvoW0qAFnhyRCkOWdmERb5fZXs0XEpV63q9cUTNW+GA/43NcYK33BEih7QcYljnNC Jcd7mNKdiWH2/v7Ac5t3p6BJ4EVMAHzOcull755Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728307AbgH0TAI (ORCPT ); Thu, 27 Aug 2020 15:00:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:50888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbgH0TAG (ORCPT ); Thu, 27 Aug 2020 15:00:06 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B4F922CBE; Thu, 27 Aug 2020 19:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554806; bh=AUHZeGZQ1QvvZ/NYV0F6hVwKHpi1jDQ3ZUVwX6+r8bQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zkF6n24lTgHqUVxU+PDGf00J7EB+I7AhGFYaUwlB4dHFu8cDAHSMJRo+YS6mG0Tbe KvRCoLchHn1quvZXYJAGypeGfXcAJJJpx6WOoLO95JIidHjm+SP93NL5rIDfgLOw44 z/bzXV7k+O56zTRMvRwHr5EbU5VMdXTRAmgckP10= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 25/27] Input: gpio_keys - Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 20:58:27 +0200 Message-Id: <20200827185829.30096-26-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe() and devm_fwnode_gpiod_get_optional(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Hans de Goede Reviewed-by: Andy Shevchenko --- Changes since v2: 1. Preserve comment, 2. Include to fix warning on clang (reported by kbuild), 3. Fix use of uninitialized "error" variable. Changes since v1: 1. Use devm_fwnode_gpiod_get_optional --- drivers/input/keyboard/gpio_keys.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index f2d4e4daa818..160d94b1c2c0 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -494,23 +495,13 @@ static int gpio_keys_setup_key(struct platform_device *pdev, spin_lock_init(&bdata->lock); if (child) { - bdata->gpiod = devm_fwnode_gpiod_get(dev, child, - NULL, GPIOD_IN, desc); - if (IS_ERR(bdata->gpiod)) { - error = PTR_ERR(bdata->gpiod); - if (error == -ENOENT) { - /* - * GPIO is optional, we may be dealing with - * purely interrupt-driven setup. - */ - bdata->gpiod = NULL; - } else { - if (error != -EPROBE_DEFER) - dev_err(dev, "failed to get gpio: %d\n", - error); - return error; - } - } + /* + * GPIO is optional, we may be dealing with purely + * interrupt-driven setup. + */ + bdata->gpiod = devm_fwnode_gpiod_get_optional(dev, child, NULL, GPIOD_IN, desc); + if (IS_ERR(bdata->gpiod)) + return dev_err_probe(dev, PTR_ERR(bdata->gpiod), "failed to get gpio\n"); } else if (gpio_is_valid(button->gpio)) { /* * Legacy GPIO number, so request the GPIO here and From patchwork Thu Aug 27 18:58:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8C43739 for ; Thu, 27 Aug 2020 19:00:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CBE1522BF3 for ; Thu, 27 Aug 2020 19:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554811; bh=dE13Onak/Gc/uQ/d4IanKlkvwyIbI6kr1ICwDOnvWk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2tc8UgAz/0UtYlmVwd5Q0kvZLW8fmJrs4juCwT67fHV8GWRwblLlO2edOuoFBQ+yY awtUC+RCt0V+E98CRo+CmjTR5cxxejtskYAViYuQdzLBU/uuw1Hf+yiZvFy7/9Um2q pcebTfkdS6X+9UoFlBufpjmWe//31uL+0U0uP/1k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728266AbgH0TAL (ORCPT ); Thu, 27 Aug 2020 15:00:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:50976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbgH0TAK (ORCPT ); Thu, 27 Aug 2020 15:00:10 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7497222BEB; Thu, 27 Aug 2020 19:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554809; bh=dE13Onak/Gc/uQ/d4IanKlkvwyIbI6kr1ICwDOnvWk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=taTq6e50W1h8zl1+4Wxnw9s6UcVHzZEHdlADQe/14qMsD1ymbSI6riRj7Az61yoPi iaI0+RWYCCSNqrZGLjnSbkHpXP7GM087R5y3c2BvmFJv2V2MWg8Wk8ex2fmKFTgbN2 v8NPEBKOnK1H+sWJF88Y8ER2Z+cMopMkomXDpse4= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 26/27] Input: bu21013_ts - Use local 'client->dev' variable in probe() Date: Thu, 27 Aug 2020 20:58:28 +0200 Message-Id: <20200827185829.30096-27-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 'dev' is shorter and simpler than '&client->dev' and in few cases it allows to skip line wrapping. Probe function uses '&client->dev' a lot, so this improves readability slightly. Andy Shevchenko Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- Changes since v2: 1. New patch --- drivers/input/touchscreen/bu21013_ts.c | 61 ++++++++++++-------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index 86bd38243d6c..f09204091ba5 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -411,31 +411,32 @@ static int bu21013_probe(struct i2c_client *client, struct input_dev *in_dev; struct input_absinfo *info; u32 max_x = 0, max_y = 0; + struct device *dev = &client->dev; int error; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - dev_err(&client->dev, "i2c smbus byte data not supported\n"); + dev_err(dev, "i2c smbus byte data not supported\n"); return -EIO; } if (!client->irq) { - dev_err(&client->dev, "No IRQ set up\n"); + dev_err(dev, "No IRQ set up\n"); return -EINVAL; } - ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); + ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); if (!ts) return -ENOMEM; ts->client = client; - ts->x_flip = device_property_read_bool(&client->dev, "rohm,flip-x"); - ts->y_flip = device_property_read_bool(&client->dev, "rohm,flip-y"); + ts->x_flip = device_property_read_bool(dev, "rohm,flip-x"); + ts->y_flip = device_property_read_bool(dev, "rohm,flip-y"); - in_dev = devm_input_allocate_device(&client->dev); + in_dev = devm_input_allocate_device(dev); if (!in_dev) { - dev_err(&client->dev, "device memory alloc failed\n"); + dev_err(dev, "device memory alloc failed\n"); return -ENOMEM; } ts->in_dev = in_dev; @@ -445,8 +446,8 @@ static int bu21013_probe(struct i2c_client *client, in_dev->name = DRIVER_TP; in_dev->id.bustype = BUS_I2C; - device_property_read_u32(&client->dev, "rohm,touch-max-x", &max_x); - device_property_read_u32(&client->dev, "rohm,touch-max-y", &max_y); + device_property_read_u32(dev, "rohm,touch-max-x", &max_x); + device_property_read_u32(dev, "rohm,touch-max-y", &max_y); input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0); input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, max_y, 0, 0); @@ -455,14 +456,14 @@ static int bu21013_probe(struct i2c_client *client, /* Adjust for the legacy "flip" properties, if present */ if (!ts->props.invert_x && - device_property_read_bool(&client->dev, "rohm,flip-x")) { + device_property_read_bool(dev, "rohm,flip-x")) { info = &in_dev->absinfo[ABS_MT_POSITION_X]; info->maximum -= info->minimum; info->minimum = 0; } if (!ts->props.invert_y && - device_property_read_bool(&client->dev, "rohm,flip-y")) { + device_property_read_bool(dev, "rohm,flip-y")) { info = &in_dev->absinfo[ABS_MT_POSITION_Y]; info->maximum -= info->minimum; info->minimum = 0; @@ -472,50 +473,46 @@ static int bu21013_probe(struct i2c_client *client, INPUT_MT_DIRECT | INPUT_MT_TRACK | INPUT_MT_DROP_UNUSED); if (error) { - dev_err(&client->dev, "failed to initialize MT slots"); + dev_err(dev, "failed to initialize MT slots"); return error; } - ts->regulator = devm_regulator_get(&client->dev, "avdd"); + ts->regulator = devm_regulator_get(dev, "avdd"); if (IS_ERR(ts->regulator)) { - dev_err(&client->dev, "regulator_get failed\n"); + dev_err(dev, "regulator_get failed\n"); return PTR_ERR(ts->regulator); } error = regulator_enable(ts->regulator); if (error) { - dev_err(&client->dev, "regulator enable failed\n"); + dev_err(dev, "regulator enable failed\n"); return error; } - error = devm_add_action_or_reset(&client->dev, bu21013_power_off, ts); + error = devm_add_action_or_reset(dev, bu21013_power_off, ts); if (error) { - dev_err(&client->dev, "failed to install power off handler\n"); + dev_err(dev, "failed to install power off handler\n"); return error; } /* Named "CS" on the chip, DT binding is "reset" */ - ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); + ts->cs_gpiod = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(ts->cs_gpiod)) - return dev_err_probe(&client->dev, PTR_ERR(ts->cs_gpiod), - "failed to get CS GPIO\n"); + return dev_err_probe(dev, PTR_ERR(ts->cs_gpiod), "failed to get CS GPIO\n"); gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS"); - error = devm_add_action_or_reset(&client->dev, - bu21013_disable_chip, ts); + error = devm_add_action_or_reset(dev, bu21013_disable_chip, ts); if (error) { - dev_err(&client->dev, - "failed to install chip disable handler\n"); + dev_err(dev, "failed to install chip disable handler\n"); return error; } /* Named "INT" on the chip, DT binding is "touch" */ - ts->int_gpiod = devm_gpiod_get_optional(&client->dev, - "touch", GPIOD_IN); + ts->int_gpiod = devm_gpiod_get_optional(dev, "touch", GPIOD_IN); error = PTR_ERR_OR_ZERO(ts->int_gpiod); if (error) - return dev_err_probe(&client->dev, error, "failed to get INT GPIO\n"); + return dev_err_probe(dev, error, "failed to get INT GPIO\n"); if (ts->int_gpiod) gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT"); @@ -523,22 +520,20 @@ static int bu21013_probe(struct i2c_client *client, /* configure the touch panel controller */ error = bu21013_init_chip(ts); if (error) { - dev_err(&client->dev, "error in bu21013 config\n"); + dev_err(dev, "error in bu21013 config\n"); return error; } - error = devm_request_threaded_irq(&client->dev, client->irq, - NULL, bu21013_gpio_irq, + error = devm_request_threaded_irq(dev, client->irq, NULL, bu21013_gpio_irq, IRQF_ONESHOT, DRIVER_TP, ts); if (error) { - dev_err(&client->dev, "request irq %d failed\n", - client->irq); + dev_err(dev, "request irq %d failed\n", client->irq); return error; } error = input_register_device(in_dev); if (error) { - dev_err(&client->dev, "failed to register input device\n"); + dev_err(dev, "failed to register input device\n"); return error; } From patchwork Thu Aug 27 18:58:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE6B91731 for ; Thu, 27 Aug 2020 19:00:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B758822BEA for ; Thu, 27 Aug 2020 19:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554823; bh=eXMt5GFmPiowNmxRcnRTBlnppZ3l++hl89a9Ed7/K7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qMQo3n48R3It0uAV4dVpHzeFmG8eBCzUpas9gOBNLsPAgTPSj4BGr/iM23w1lzyx4 4jZj1HZ6flG/XMZ/2pqrGCCA2VdYB1f9c7ofzarpLcvitVH8Zd3Ubgw9adigG9LwfZ afrC4jiB8ltOVqrrNIGjNe2qWBCYsG7j+kQc3ZEI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728286AbgH0TAR (ORCPT ); Thu, 27 Aug 2020 15:00:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:51066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbgH0TAN (ORCPT ); Thu, 27 Aug 2020 15:00:13 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BDBBB2087E; Thu, 27 Aug 2020 19:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598554812; bh=eXMt5GFmPiowNmxRcnRTBlnppZ3l++hl89a9Ed7/K7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXxgyKUdL7xGuMfB1bfTElJik7VRYtBtwaaL75FuGwNbJr7xwHf9QkQIHunQfTIpE 2u09AdH/xnxUGm7ud5J3aqywxiP0ar3VJQJ/17Qw6xC9qQAna9GmTEsYljIpmsyAsB 6ZpDJB0QgT3ab8dHoEDocg+PlYh74r7K9gkaV2o8= From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Dmitry Torokhov , Hans de Goede , Bastien Nocera , Sangwon Jee , Eugen Hristev , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Krzysztof Kozlowski Subject: [PATCH v3 27/27] Input: bu21029_ts - Use local 'client->dev' variable in probe() Date: Thu, 27 Aug 2020 20:58:29 +0200 Message-Id: <20200827185829.30096-28-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827185829.30096-1-krzk@kernel.org> References: <20200827185829.30096-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 'dev' is shorter and simpler than '&client->dev' and in few cases it allows to skip line wrapping. Probe function uses '&client->dev' a lot, so this improves readability slightly. Suggested-by: Andy Shevchenko Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v2: 1. New patch --- drivers/input/touchscreen/bu21029_ts.c | 37 +++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c index 96c178b606dc..78e256254764 100644 --- a/drivers/input/touchscreen/bu21029_ts.c +++ b/drivers/input/touchscreen/bu21029_ts.c @@ -334,6 +334,7 @@ static void bu21029_stop_chip(struct input_dev *dev) static int bu21029_probe(struct i2c_client *client, const struct i2c_device_id *id) { + struct device *dev = &client->dev; struct bu21029_ts_data *bu21029; struct input_dev *in_dev; int error; @@ -342,37 +343,33 @@ static int bu21029_probe(struct i2c_client *client, I2C_FUNC_SMBUS_WRITE_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA | I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - dev_err(&client->dev, - "i2c functionality support is not sufficient\n"); + dev_err(dev, "i2c functionality support is not sufficient\n"); return -EIO; } - bu21029 = devm_kzalloc(&client->dev, sizeof(*bu21029), GFP_KERNEL); + bu21029 = devm_kzalloc(dev, sizeof(*bu21029), GFP_KERNEL); if (!bu21029) return -ENOMEM; - error = device_property_read_u32(&client->dev, "rohm,x-plate-ohms", - &bu21029->x_plate_ohms); + error = device_property_read_u32(dev, "rohm,x-plate-ohms", &bu21029->x_plate_ohms); if (error) { - dev_err(&client->dev, - "invalid 'x-plate-ohms' supplied: %d\n", error); + dev_err(dev, "invalid 'x-plate-ohms' supplied: %d\n", error); return error; } - bu21029->vdd = devm_regulator_get(&client->dev, "vdd"); + bu21029->vdd = devm_regulator_get(dev, "vdd"); if (IS_ERR(bu21029->vdd)) - return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd), + return dev_err_probe(dev, PTR_ERR(bu21029->vdd), "failed to acquire 'vdd' supply\n"); - bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev, - "reset", GPIOD_OUT_HIGH); + bu21029->reset_gpios = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(bu21029->reset_gpios)) - return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios), + return dev_err_probe(dev, PTR_ERR(bu21029->reset_gpios), "failed to acquire 'reset' gpio\n"); - in_dev = devm_input_allocate_device(&client->dev); + in_dev = devm_input_allocate_device(dev); if (!in_dev) { - dev_err(&client->dev, "unable to allocate input device\n"); + dev_err(dev, "unable to allocate input device\n"); return -ENOMEM; } @@ -394,19 +391,17 @@ static int bu21029_probe(struct i2c_client *client, input_set_drvdata(in_dev, bu21029); irq_set_status_flags(client->irq, IRQ_NOAUTOEN); - error = devm_request_threaded_irq(&client->dev, client->irq, - NULL, bu21029_touch_soft_irq, - IRQF_ONESHOT, DRIVER_NAME, bu21029); + error = devm_request_threaded_irq(dev, client->irq, NULL, + bu21029_touch_soft_irq, IRQF_ONESHOT, + DRIVER_NAME, bu21029); if (error) { - dev_err(&client->dev, - "unable to request touch irq: %d\n", error); + dev_err(dev, "unable to request touch irq: %d\n", error); return error; } error = input_register_device(in_dev); if (error) { - dev_err(&client->dev, - "unable to register input device: %d\n", error); + dev_err(dev, "unable to register input device: %d\n", error); return error; }