From patchwork Sun Jun 25 16:28:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 697570 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 7BF24C001B0 for ; Sun, 25 Jun 2023 16:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231432AbjFYQ3r (ORCPT ); Sun, 25 Jun 2023 12:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230459AbjFYQ3i (ORCPT ); Sun, 25 Jun 2023 12:29:38 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D7210F2 for ; Sun, 25 Jun 2023 09:29:13 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-98934f000a5so290924666b.2 for ; Sun, 25 Jun 2023 09:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687710530; x=1690302530; 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=HFr85Va+I3JFQ/CS1AHNqQf8ybLG0IaDbtC5ESPVDI4=; b=P4/793FflPwuLOra9+yrjA1oii1q+mVvOCozzGq6xWF1CWxQa5aZaBBkMLzabIuC62 Yvd4/yFuCpxebdB1dgr8lR14V4yBjqIr5vrShuzX7UtrZ6Xmj6TDNHeJDvsL540s/0kh jg1bjAJJlDKifdR5vSy9w+PBoKbOBp2JmHYqnkWjUeuxy5lMtNflQkL/YHpfyMBTx6Sr /xf8EdttzMS2cRAbvHLzP3cnSiWJMPbRAEDoeBCXxOqfw9uBus9Wio2VRQxTTEMdrYES 53N507f6V0yvEqvE8EnkwGCgxv9U0V2LkZJHk1M1Kzl9vCqW1qNzKUhQ3uUJEEIM6rb6 g9kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687710530; x=1690302530; 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=HFr85Va+I3JFQ/CS1AHNqQf8ybLG0IaDbtC5ESPVDI4=; b=WX2dP6PUNMtt4o5pvjaxl23gb/jk05Efp5hvSwxmMMr4vZKwIhHoNjNaJxGHg/jjEj M2WicFhIrp/38O93GCCxrcb0W/l87OlmQvyDJX2mCEirt0UdZJdWIz9zmrLWZA3H7MOZ M8Smo6lfTMDiofTRLNuozkFJ5CHrf/lZm0ECZ5DvlZqabE1PY2RejSmA46MhTi6ZQVe4 rjm/BaK1qhI3ohYdi7zR53JloWZCTKkb/vFnBlKdK6XGZcLgv5ksmA5zj1hLFtzagrAc ekDR0tsZm9jnyrgpWUPNsvamRO21FLr5WFMh6Dm5YuTQsHVNoUTHMfOhDrG5laClO9gj cYgg== X-Gm-Message-State: AC+VfDydwgMBXUWVq/bkZEbTzzAYMUcHBghnpLzO0iAQEPIBH+vx5qGb IbslplhT2P4J+DwEnRdFAktGPQ== X-Google-Smtp-Source: ACHHUZ4iIpuVAQ8JeSeF/0XeL1REszISpgqSO7v4nyUS+OWRO4inwAZIh67lnuhSqW8mMFQdRGOTpg== X-Received: by 2002:a17:907:3e88:b0:97d:cdf4:719f with SMTP id hs8-20020a1709073e8800b0097dcdf4719fmr25395707ejc.68.1687710530492; Sun, 25 Jun 2023 09:28:50 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 09:28:50 -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 15/24] Input: pixcir_i2c_ts - Simplify with dev_err_probe() Date: Sun, 25 Jun 2023 18:28:08 +0200 Message-Id: <20230625162817.100397-16-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: 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 554e179c2e48..0b4576091dac 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);