Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2559158pxb; Sat, 25 Sep 2021 10:35:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys29Qkrh08bBUxQnC3cbs55Zwuq0AkhSCq/rG0xfib81hOOSypx//cO+Ncw9pnjvODjDHT X-Received: by 2002:a05:6e02:4a4:: with SMTP id e4mr13125606ils.232.1632591327148; Sat, 25 Sep 2021 10:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632591327; cv=none; d=google.com; s=arc-20160816; b=lhgnZzU0cELlp3m2nmTrCT5un+L/k/Lud5OJ0mRRk9zIHMj9LPlcY6iZjHPPrg1f3L tiCycHfR2PKaNpCakfwGHWYIDOZ5Qovip9eIg6FwRXe5JVtZh/W3qzOYkpF5VvpHUQIg BPsSrQgwqsoWGatnxxeWLjd54aAEwmb7OxBdegUtYXT9vyay6z6EfbMf2xRinK+bPJaH hXjN9LDFU8ip1663z6bFCh0p2TqFLVb/sFSqtH0WWwU9jFIaKfVe6cXpeuaSuTMgIdjV HJaTB7ObcZYphdE3mGUe6gZuSD9LRkJZfC5pDKwtKMjILYEZWeVnQ1MnGzVH8i4WCza/ djww== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xOGXsR2lrn1dvNa/qlhz6wa9pGiy56aLxSKQi3X0iXU=; b=eNqk7IJkBTVhldva9RcjsSuzHx0Ec/Wq5wA4ud+q0QbhCvXrRwT18+4jkBTH0iTOdH c0YTnmSIca+Ckw4NlKPJ835beN/86gLFCS0R8Cxoi9+XDLqKho8tm5gs7acRe7Qc43+a XVZV/gDZA+c9vwF3lY8d827TRJ/TEC3py+dLiaPk8pGg9QyRJRVjSIirI9oHd1pO2VBz VYCXr8M4+WGinWhJg1TEKcIkYj+FU4Pl5Baah6aXAuOfJsn5Q9CQskhGfP8zGKmVNSKP g1dUQ2CM9XadvVipjOIQGfMwGUrhAfjLqf6nk9ILa/la07/NnlKQnpUbHmZs31NAd1XZ qLtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PCr602Qk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si17244911iom.82.2021.09.25.10.35.16; Sat, 25 Sep 2021 10:35:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PCr602Qk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbhIYRf7 (ORCPT + 99 others); Sat, 25 Sep 2021 13:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbhIYRf5 (ORCPT ); Sat, 25 Sep 2021 13:35:57 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E255C061570 for ; Sat, 25 Sep 2021 10:34:23 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id r2so13210342pgl.10 for ; Sat, 25 Sep 2021 10:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xOGXsR2lrn1dvNa/qlhz6wa9pGiy56aLxSKQi3X0iXU=; b=PCr602QkRq5ChttjxjsGMbOGLlm57bxLWVzHhG9I8KLAMRBFiMXX2mctmlGH0+wpzK +85vmB/dnmriHyyruQ8N2kWj3/x2a+61M0aamLwLNqj5dczTkXpeXS2ymEQHA50K+lBi XrTNd4n+tI1kq483mN0G8pWY1dNBQl+zUU/CLFZR8foGuquw/D68VsBh/gOK/i3rco9R 7w7jFS8K9GR86np6LCLeCaJ3ZdOIUcmJHMDF/rguCD4u3TCcyvu4lG0PjBcgQM3iYoug 9R8wL4g0V+VEll+NuJsxv2r9Sbb2qxpt/ZqrPHhexlUgPlXnr2jt3Ti5h4WIGGy8jRYe Xegw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xOGXsR2lrn1dvNa/qlhz6wa9pGiy56aLxSKQi3X0iXU=; b=4KRHWUgFs7yOjcVcSw0DhW5Oy3+C8RqQt34a64BifDA8X6qhVwYLQKhvz8HGjjCvd9 gDRGiYGcmQjlK6+Rq9XIRegSYtODYPFWbp5E4nMzkI/Av8GkkfcNRnWSM/A084jqydcz 5nBRUgvM8st3MeLDtGL1g5r09lJgl8GvSOKVrCZGZbKgM7UORZBJiOd2fu5epsd9UIvv H4Lb6xp7cR52txbkzurjMzcu6xkQFMjxSY2d/A6sutf2cInH5HynqKgyEpQt3GLgVXwi RHVJfIiM5w1u1pbHo50pXwiFeM/YIvu33S0/8HO76qS25LeOnnBpkVHG/pP6tSRvbGWF oomA== X-Gm-Message-State: AOAM5335aBgznYm69ZtpugTL0N77Leco6SPmasXmYU99dH228hGL13pO caKP7iO2zzgw5nMNt0m4Hpw= X-Received: by 2002:a63:a70e:: with SMTP id d14mr9093741pgf.431.1632591262567; Sat, 25 Sep 2021 10:34:22 -0700 (PDT) Received: from archl-c2lm.. ([103.51.72.30]) by smtp.gmail.com with ESMTPSA id j6sm13113980pgq.0.2021.09.25.10.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 10:34:22 -0700 (PDT) From: Anand Moon To: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon , Martin Blumenstingl , Liam Girdwood , Mark Brown Subject: [PATCHv4] regulator: pwm-regulator: Make use of the helper function dev_err_probe() Date: Sat, 25 Sep 2021 17:34:12 +0000 Message-Id: <20210925173413.1019-1-linux.amoon@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org devm_pwm_get() can return -EPROBE_DEFER if the pwm regulator is not ready yet. Use dev_err_probe() for pwm regulator resources to indicate the deferral reason when waiting for the resource to come up. Cc: Martin Blumenstingl Acked-by: Martin Blumenstingl Signed-off-by: Anand Moon --- V3 - Fix the coading style issue. dropped { } V2 - Fix the return message and drop the FIX tag in commit. V1 - Fix the wrong probe defer for devm_regulator_register. - Fix the commit message. --- drivers/regulator/pwm-regulator.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index 7629476d94ae..b9eeaff1c661 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c @@ -352,15 +352,9 @@ static int pwm_regulator_probe(struct platform_device *pdev) config.init_data = init_data; drvdata->pwm = devm_pwm_get(&pdev->dev, NULL); - if (IS_ERR(drvdata->pwm)) { - ret = PTR_ERR(drvdata->pwm); - if (ret == -EPROBE_DEFER) - dev_dbg(&pdev->dev, - "Failed to get PWM, deferring probe\n"); - else - dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret); - return ret; - } + if (IS_ERR(drvdata->pwm)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm), + "Failed to get PWM\n"); if (init_data->constraints.boot_on || init_data->constraints.always_on) gpio_flags = GPIOD_OUT_HIGH; -- 2.33.0