From patchwork Wed Aug 26 18:16:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11739305 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 2064013B6 for ; Wed, 26 Aug 2020 18:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F31C022B49 for ; Wed, 26 Aug 2020 18:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598465917; bh=esFsNTUfCxBJtaN0CSI6BtiDlFy0zInX6pkriROGYdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=w0QMyjj1crPpBZtHZSV9fahUVZC4hie/tAa76cAAvaLxSflhB33W4AblE7CNS/5Sg bFLPW9ie6dD85ocanCyR57P4Msd4TRgrIjeCJBI6fIqMjAtSYK6YDpRPffJbLRzDJF RB9XHTcRjQB7KvHehRPkfbL/3U6IArjyqLsr3DBs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbgHZSSf (ORCPT ); Wed, 26 Aug 2020 14:18:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727815AbgHZSS2 (ORCPT ); Wed, 26 Aug 2020 14:18:28 -0400 Received: from kozik-lap.mshome.net (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 52FF1214F1; Wed, 26 Aug 2020 18:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598465908; bh=esFsNTUfCxBJtaN0CSI6BtiDlFy0zInX6pkriROGYdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzIhZG7XtyqfchxrNXADPABduEGpqWHX8oJFpMFrxB0ku7rQfV7RzeOBYTZ1afzog QdMW1s7VTuxAV3vUPtvvmM6qX1NXfzZ6+9a3XGzplEwmKE1mgEJvPMgxDfAeHiVWt3 xAmyf15Ue/JT0EWpfIp6xS98yPX22odlNLLZ6xnE= From: Krzysztof Kozlowski To: Dmitry Torokhov , Hans de Goede , Linus Walleij , Bastien Nocera , Sangwon Jee , Eugen Hristev , "Gustavo A. R. Silva" , Andy Shevchenko , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 15/24] Input: elants_i2c - Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 20:16:57 +0200 Message-Id: <20200826181706.11098-15-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826181706.11098-1-krzk@kernel.org> References: <20200826181706.11098-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: 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)) {