From patchwork Sun Jun 25 16:27:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13292059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A39F1EB64DD for ; Sun, 25 Jun 2023 16:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbjFYQ2w (ORCPT ); Sun, 25 Jun 2023 12:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbjFYQ2m (ORCPT ); Sun, 25 Jun 2023 12:28:42 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CD1E7C for ; Sun, 25 Jun 2023 09:28:35 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-98e25fa6f5bso160098266b.3 for ; Sun, 25 Jun 2023 09:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687710514; x=1690302514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e6wgHXQvCt97a66kq5RQ8NaDVI2/Jj/XxJYdNlS5IWY=; b=wf5uthm31KWYncxa45wPIq2Uq+k7DyNTVrLFQslg19SdzcfP3IWLjNCXniDo6YeW61 rSZBEBrhSFTpnD7iV5bycDTvOxDFhECWzBZJscYohglnyBO3jx6JWPA0vDkf39eSNQ1w fwyQ4veWBXLWvr1ltCdoifGDsKtOLpPM13OJtqNJuHqNCtNo3tnjtjoxg6Y7R0AB+oPz lgPGKjd8+Nl/pNKJgqa0maR7BPI3QTJLO8TfXKD8DvDeDA+X21jwRktFY9COYJHFS4fI fh15zOVXM2XpCIi3fd1xVoYpbIv56yV8SAGyCkIo+hmCbV8SHby1HMYrR3XtbMzSlmX+ 6xWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687710514; x=1690302514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e6wgHXQvCt97a66kq5RQ8NaDVI2/Jj/XxJYdNlS5IWY=; b=HGqrcp41wCcYDo550TGg7QsxHmIq5rsmItS0br2eNBPidogjAC9zqIhCBiT2QjoEV5 Gr6lEfWvc+uGonqcaM6la9eoIX+LhCl8e6OukXOD6QnvhSXTgFc44Fqjd5ARUStvGW7b 5g2HHeuMfcX/q2IDL7sg8aoq8BPzf82u1Ox6N5J9Tfxc2XNN7oXZzubLSWHTelyORfnZ g07KsrQdazPl/PJd8YTYze8k8C0I3FXZikv83CZ4UXguBgKZP5+tBG9XgCdH7lGp6KNe WBfq6IPpHhilja/qzdRhsmKkELD9urjDwUVK+3XiZZQkvgCfZp8Q8ghAWR01st84mU0C YsQg== X-Gm-Message-State: AC+VfDwb0XFzPyw1XK6HVsjKCaRQOgow8x8GYUlAnuxJfVNa71ME4s2N Ne9S4SmCFASyrLabHnLfH3HdCA== X-Google-Smtp-Source: ACHHUZ79BiNrh4irMMrCCyc6D6/cKxJ+ItXxRfOg69uAw9FWX5AKPeZFDAbqJ1zRHbTt1EnkpW6a4g== X-Received: by 2002:a17:907:6d97:b0:988:9621:d85d with SMTP id sb23-20020a1709076d9700b009889621d85dmr20163181ejc.46.1687710513865; Sun, 25 Jun 2023 09:28:33 -0700 (PDT) Received: from krzk-bin.. ([178.197.219.26]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm2277731ejb.172.2023.06.25.09.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 09:28:33 -0700 (PDT) From: Krzysztof Kozlowski To: Dmitry Torokhov , Hans de Goede , Linus Walleij , Bastien Nocera , Sangwon Jee , Eugen Hristev , =?utf-8?q?Mika_Penttil=C3=A4?= , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: Andi Shyti , Andy Shevchenko , Krzysztof Kozlowski , Andy Shevchenko Subject: [PATCH v4 06/24] Input: bu21013_ts - Simplify with dev_err_probe() Date: Sun, 25 Jun 2023 18:27:59 +0200 Message-Id: <20230625162817.100397-7-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230625162817.100397-1-krzysztof.kozlowski@linaro.org> References: <20230625162817.100397-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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 Acked-by: Linus Walleij Reviewed-by: Andy Shevchenko --- 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 85332cfaa29d..f811677a59f7 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -495,12 +495,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, @@ -515,11 +513,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");