From patchwork Sun Jun 25 16:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 112654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7000419vqr; Sun, 25 Jun 2023 09:37:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5uMiqh6X27AU48NXSvIyAxpwuy0RYNDP6oP2Rtc72qJ1MhHAeopXYn1y9z2hXjOCYNU0yy X-Received: by 2002:a17:907:1b0b:b0:982:8ec0:15a3 with SMTP id mp11-20020a1709071b0b00b009828ec015a3mr23365175ejc.67.1687711044240; Sun, 25 Jun 2023 09:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687711044; cv=none; d=google.com; s=arc-20160816; b=GhDCXmwbwsuaIK0INhA5JxIDtLrgDxJ0navaAHFdIceh/EMuu/niHgAuN2RPRJsDK4 HFWp7RvvIZalbWu9z5mi4deh2sbNa4L7e4MMxOiLK7WJO5u4VtVGMjnMb5jGcmjcvE9V cHW3l/5mYiP+irKWV7azTEIN1TiTycdF4TfqXhe4S8GyVxoLhVsJoQQIBtKSzwtgvHBf VWhFrdMzHeDeKaRe6J//CILfBhngQ30mGY/uKPKjgF1Nwm298CkgY+3sK5MZuGmKKOwU UnldvtGbKdmmAv0ByAGa5ZgBkhRiu1CQBg5bFU6yxJbH7jthxYz1v6ibgmOvLceA918O 5P7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hrK9BhmeRbtcXzgi7rTTXpnSu/d5rWV1MCplOE4+PiY=; fh=9JCOumVf9dngCFHiV6Hmkcm2vnKQxEc42icPYm2blNQ=; b=xjGAmmUiG4xG7JXYxyqEaKF55MDtUEBx36xZ992F2iBa3P1vjKYWz2ZWrehWFdXoCb 03JIHe9o+qI1hp0hwKy803uJT7RdEfgK0GSOTb1LUocIeDF3wgrtleWHkTBFSqwt6tqs hO2voRVyIbmJ0PlE8DpGQVVov6aib5F4dMFSWPNp+BQRl7IkV0GUDlxJggQJybIeaXAH u3wq5EirC8DO8ZnxKVSAa4oVz3p0LvvOHlfx1Dbbrb2AfJdH1Vp1lorG45RboUuR4vZ8 YqiXyBPbbFwAXv6Ms6Scbu6moDWnikdmMpdoyMGnS0S6FWi4GweCirCnspDlwX5aXYWa zSTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qr9LMO/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k21-20020a170906055500b00977e0843714si1713165eja.1002.2023.06.25.09.37.00; Sun, 25 Jun 2023 09:37:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qr9LMO/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231962AbjFYQa1 (ORCPT + 99 others); Sun, 25 Jun 2023 12:30:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbjFYQ3q (ORCPT ); Sun, 25 Jun 2023 12:29:46 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CE79E4C for ; Sun, 25 Jun 2023 09:29:30 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-98e25fa6f5bso160146866b.3 for ; Sun, 25 Jun 2023 09:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687710543; x=1690302543; 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=hrK9BhmeRbtcXzgi7rTTXpnSu/d5rWV1MCplOE4+PiY=; b=qr9LMO/Q+uU19l25OB/u4TWDpd9xHm9oJH3Foo76AbbHQctIYRf5ZUFkY8L9AiHLl4 IOGoE/YwDvYjQ7Z/RoI8LAsyAb0Oou9jV/eNjnv0tRqSdclfwqq5uy94d6B0rnmCPUUR iSLOq5KkZanLgOR/nRBhyLxHONuPzS/nAZpnltsISPxUbmC0LUfNyXpYLU0YpLs1vWve AC96ifIl+9PInt0WomEwgqB0VL3ODDiMvq9dIQEL7Sq3bYrqAHuOVxVLoe7A0CTRvKCZ mcw9tPNo76ttBFw4192eFXvpbfamJYHlQPGZpjvPhBEBJagw7rmSeUJ7CKA6ktmCZMlI AgRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687710543; x=1690302543; 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=hrK9BhmeRbtcXzgi7rTTXpnSu/d5rWV1MCplOE4+PiY=; b=QgV+3sNIqE98BeTK555xxL/Sh7tx6F1xtbQ/+eNLRSB1oGMHmg3fcpBmhMU6DAMinn ZlQshJI/9DjMEYDYOmsGN1w8YVcirwpsjYDOkiR+0p7PTWChNCavSUrISJV857av0MB1 KG2a0gePzW1FyT9MHII2nuCwYhCtDX6LJMxrNTNNkB7SfQpfTYRVU7VJjbIfknOYzidl liXeSxvX5C8UAbU3rJK9UU71pceJZbSgbAPZnSKDfR4uOYVeAW7hxCUoQIKadPT/lLdP jelzd2KRNYLYjD5yhpHA69gcY6pQWwfx9FlFRgyEQ629FVCbpkRJfx9WjgHRBz0NSIi8 MCEQ== X-Gm-Message-State: AC+VfDwZckBC8t1MNbjXwaoxeWVucM5fLQtoAn3vxce/ICoPHC7FB13d 3CWnBZoFf53KVB0hFsdJTxCvDw== X-Received: by 2002:a17:906:58c5:b0:988:891b:28c6 with SMTP id e5-20020a17090658c500b00988891b28c6mr20998191ejs.15.1687710543723; Sun, 25 Jun 2023 09:29:03 -0700 (PDT) Received: from krzk-bin.. ([178.197.219.26]) by smtp.gmail.com with ESMTPSA id ec10-20020a170906b6ca00b00982be08a9besm2277731ejb.172.2023.06.25.09.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 09:29:03 -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 22/24] Input: bcm-keypad - Simplify with dev_err_probe() Date: Sun, 25 Jun 2023 18:28:15 +0200 Message-Id: <20230625162817.100397-23-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769693296109657240?= X-GMAIL-MSGID: =?utf-8?q?1769693296109657240?= 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 56a919ec23b5..05b09066df84 100644 --- a/drivers/input/keyboard/bcm-keypad.c +++ b/drivers/input/keyboard/bcm-keypad.c @@ -365,17 +365,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;