Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp669594pxa; Thu, 27 Aug 2020 12:28:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFrdIasf8OIccKgtOFKPFYohuuV/u9tGWf6oIlKjb7QbfPpqyMCugK4je5yjKiefzVVMfR X-Received: by 2002:a17:907:2805:: with SMTP id eb5mr23708597ejc.254.1598556512558; Thu, 27 Aug 2020 12:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598556512; cv=none; d=google.com; s=arc-20160816; b=kTBZ159hPaGvJoU9uz0eDNRdbYoau+AjhRQlKPYNZqmWAPDOciE7XQ4RwmPeKV6Fzu wLS8bz4ccikrGbss1mQnnRbyyLou7lb5iedeIiQzBwP3v1iZBMOGdHZz4uSRXzsp7Dwy hNuri8jK8pI71okXuF4dLaqB6LG37o1QdI2D1C6214B8c+5kkOaF9/MQxJdmIwHpMoR1 QIHCEROb9fi+ZawU3RjpJUogGrKQeUQs5B7AjLUPCCPXR1ZByCsvxpbwkcBEI7iDGY41 TRwbGoYqQ5n/6Z11VxP0JM07XAC5AR9huyBF/1+IsGbpESbObAdBjbvwALAOtunljU4P 7sOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=wfPnhtRjNWJq0UXRxj1bc0ZJHZbDd/0QmVyfTj4RZ6U=; b=x+Q04XE/EvFrl59zFJTJGNtbWfNUXomJOqJq14TneNnXZmiNEKQ98EWJVzQ213Vt/g MgSI4KNSq1jo/kns6Er914KeSRv4gnW/kilw4mrTyvlKc8Bmb/41g9mHvhtkGtFrNKms rgI3jBdsDuRDP8PxXdMrkX++F5hc7LEbe2lg9lQDbq9XgCobXG2rZWbjLjTCQRm0wUeS J8BRSqHaptzQ9fY9Q2flhJhiyv+zCP3b2KgyNUx5ehDSJ8yQqJfSQ9MVvGQF6ZxdsRIf teuaL4vQ2d84uvCy0GKq+ZO1gi5+NZBoyZrjdR4WLS1xHAySt0/n5O3MfC8IgmPuRcub 4Wrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vDACDjMN; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay26si1704644edb.269.2020.08.27.12.28.07; Thu, 27 Aug 2020 12:28:32 -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=@kernel.org header.s=default header.b=vDACDjMN; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbgH0T1c (ORCPT + 99 others); Thu, 27 Aug 2020 15:27:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:58334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0T1b (ORCPT ); Thu, 27 Aug 2020 15:27:31 -0400 Received: from localhost.localdomain (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 06074207CD; Thu, 27 Aug 2020 19:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556450; bh=lwcapEqh1mnH2bnwZTOp+jWQ1z3sGCNA5lWoA1rbyV4=; h=From:To:Subject:Date:From; b=vDACDjMN6Ffk+dwJKEXdyHNYQl1LSRhWd4rY8FxqjQSlr3i+YVbeUVTTxaYwPuBLG Lr/cR0dCM+SEssxNVdI6rwYQTXpXr1iBRY3N+itjh9g+lhC9yZbflbrJ7DfFgCM4Ju wV+IT1ulsV3Xks9GuVRprBDSrQNGt8UtfSolXT94= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:25 +0200 Message-Id: <20200827192642.1725-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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/iio/accel/bma180.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 5b7a467c7b27..448faed001fd 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -1000,19 +1000,15 @@ static int bma180_probe(struct i2c_client *client, return ret; data->vdd_supply = devm_regulator_get(dev, "vdd"); - if (IS_ERR(data->vdd_supply)) { - if (PTR_ERR(data->vdd_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vdd regulator %d\n", - (int)PTR_ERR(data->vdd_supply)); - return PTR_ERR(data->vdd_supply); - } + if (IS_ERR(data->vdd_supply)) + return dev_err_probe(dev, PTR_ERR(data->vdd_supply), + "Failed to get vdd regulator\n"); + data->vddio_supply = devm_regulator_get(dev, "vddio"); - if (IS_ERR(data->vddio_supply)) { - if (PTR_ERR(data->vddio_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vddio regulator %d\n", - (int)PTR_ERR(data->vddio_supply)); - return PTR_ERR(data->vddio_supply); - } + if (IS_ERR(data->vddio_supply)) + return dev_err_probe(dev, PTR_ERR(data->vddio_supply), + "Failed to get vddio regulator\n"); + /* Typical voltage 2.4V these are min and max */ ret = regulator_set_voltage(data->vdd_supply, 1620000, 3600000); if (ret) -- 2.17.1