From patchwork Wed Aug 26 18:16:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 255065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA8C9C433DF for ; Wed, 26 Aug 2020 18:18:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE1E6208E4 for ; Wed, 26 Aug 2020 18:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598465891; bh=/d4BjFY2ap9+l6rWTJFZn1Ski4MoGXTAYNl4MMOq0gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=RzNJ7nOSlCJJT3x4BdLv1LjcC35mBp12BciDk1CT83L1J+cSYK23HXYAwlReyb9By EiJSztoR+PgT0jjck5CsLJaXJWIJHShjOsa1jRKfsBR4arqCNwVrOfpvEyaThE3vOS nfGFZtigO9uVIcLqhWElijP6r/w1dUNH/upwzMOI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726834AbgHZSSC (ORCPT ); Wed, 26 Aug 2020 14:18:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:41062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbgHZSSA (ORCPT ); Wed, 26 Aug 2020 14:18:00 -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 4167C22B47; Wed, 26 Aug 2020 18:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598465880; bh=/d4BjFY2ap9+l6rWTJFZn1Ski4MoGXTAYNl4MMOq0gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qSWpCUOKvobJmpH0O/23WwT/S7TFqh3Db4hqmp1qTMMEi0xx+gdN5JeZrmSmWzGpZ aCAkk9KVnvnpvYzArP7MOiyrKnuQ+XBfABs47/UtyPAeJrSQyUrpaXdR6hWqkiUH6c +9YPeScx7dfXKaYermxU71Js8+4n6If50x7WbQQM= 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 09/24] Input: bu21013_ts - Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 20:16:51 +0200 Message-Id: <20200826181706.11098-9-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 --- drivers/input/touchscreen/bu21013_ts.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index 2f1f0d7607f8..bb99405b5dac 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -497,11 +497,9 @@ 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 (error) + return dev_err_probe(&client->dev, error, "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");