Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp677778pxa; Thu, 27 Aug 2020 12:42:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRJkq9dDiYSV9JMK8Tv+XaUfDXu8lwldvUbTNTBCX+H2HUIaIN1p37CKEvBLgE+baiD5o2 X-Received: by 2002:a17:906:a43:: with SMTP id x3mr22088280ejf.321.1598557353467; Thu, 27 Aug 2020 12:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598557353; cv=none; d=google.com; s=arc-20160816; b=Ly4FBHaFoubdKzDbiX9hEmZAPzU+ESUgATfVfL/b05KFEGFlMOP0Fn644itDphZumc Hj7/E1rKZhLL3UVR4Q3AWfIrCxRTAlGtZlpTpwX3QRjrran8ybNhNQE2N6kfHbMwBXMu muJSgvV16zCrIOA3yOJ1X6bTt+kF1vH02RI1KUh+u5UAunGbmla0BN9vHVd9led3bA6C 3WAebUtlUv5JqexKrXdrLwLb/Iy1Hr9h7GqTn+BXXyfaU0ko+bUIMajYzimxDpUMlXhE bXPk4dEGi2fWd3exihIPewpJEDrOLjj/Wddju/PpWpZkuYrzOhAsTUNZRBawfAxoPLWw lXJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=MZm/oywi3r1tbCCgZePyobFM2PGZReJQn7CQ3uKc+Ao=; b=S7Fv8LWXia+0ysNTBdDvHD56XDsfDT8B/FgNZs4nx50jdxnNJwMhrsf0TljrvojV4h izub9fduukPpW4CmxHqnhjyLbZAhzrfUS0RCcbVSUq4V1e+9exI84/wjN25KKazyMPbj /dwSMvUtphsXO7U53E9dOdxr63QWTpmOfsXOHWjHlnF0lvH/LW4Exst+Rr2M6Af3N9Mp smJt1IqpZ0tBtwgHbNW5Gb5FcrOLAI9c9UjlUz8L4X0PxANRM+jRW9nLUprBuMKz7L2b VOtdmrzkHAdfoaB5zKhNHm4W2iid9BLLMXJgsBBkmm05dPSvG0vUUdXETAoYUiNtzlqK WsgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f8n5VPrp; 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 t16si2085709ejt.27.2020.08.27.12.42.10; Thu, 27 Aug 2020 12:42:33 -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=20161025 header.b=f8n5VPrp; 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 S1726854AbgH0Tlf (ORCPT + 99 others); Thu, 27 Aug 2020 15:41:35 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35385 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0Tle (ORCPT ); Thu, 27 Aug 2020 15:41:34 -0400 Received: by mail-pg1-f196.google.com with SMTP id g29so3074047pgl.2; Thu, 27 Aug 2020 12:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MZm/oywi3r1tbCCgZePyobFM2PGZReJQn7CQ3uKc+Ao=; b=f8n5VPrpuTtwANe91fL3ceCKerjs9R1uZiyAXmwVy/cZqu3I8o92h7iWKeUrZbvTHI xv3f2KNykWxz9M4p+YEx/8qCMXuZ9zkFFj9z+dffQXJOEZsPQBZzrKqn6Xfw2iQuP5Af eIOEmUek3WrgS3fxMZwWJXrEDNbdzLAOraAWLfkDXyFr6h00Z7O9KvIpFIS9xEGr+3aX 9zXFJ0A9XeZY0Ce0KWz63fWV7wQ7VVhbTgUiEEsxac+lfKyxCqS913SAPiQ6itoN4Kdu Hp/smrljQR+JJGKvlfG5Wqu+EBGIUVqGeslwuBUsIrpvL2dILvRlZuex9jG0lt4PEcd9 UTOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MZm/oywi3r1tbCCgZePyobFM2PGZReJQn7CQ3uKc+Ao=; b=N+m23nxEuiXnMWvsECXxcBqXwrrt0Yez7OVPBlhddlFvrPBuTNr/ktkBKKer2NS0gd FWWC/gJQig/5p9eVIE844mWTgiRq0+dg6bey9bPzDDN6SdCMh+WpwFpwtGYzCvIkVI/6 GfW8U9KLmAPEL3WdFAqLjEh8023K02++4VO3N4umWQcYQijC0c1LB0qejkjwBYGdVy2V 3uX9EDP0phaILBjT9zQdo2GfdmQ7a0rerxIEd5uZO13kE1mzzd0bo83wNZrrS1mOx37X IvS4ab+G/9zHlSqBjw2pxDl8IUu9ML/1sU+T3vpp+3t0dqDtfN0KzwKx4DQU6kwTme7h z0DQ== X-Gm-Message-State: AOAM533Lav3OTTU/FAzSpj4Cb58uLGD3MJcu4f2gU7/nSwzNJ/CKMK/Z izAjwILIaR+H/CJNu0daSVplkl0ku1R9MWW7+B8= X-Received: by 2002:a63:ec18:: with SMTP id j24mr15210554pgh.74.1598557143681; Thu, 27 Aug 2020 12:39:03 -0700 (PDT) MIME-Version: 1.0 References: <20200827192642.1725-1-krzk@kernel.org> In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> From: Andy Shevchenko Date: Thu, 27 Aug 2020 22:38:46 +0300 Message-ID: Subject: Re: [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() To: Krzysztof Kozlowski Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , linux-iio , Linux Kernel Mailing List , linux-arm Mailing List , linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 10:27 PM Krzysztof Kozlowski wrote: > > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and also it prints the error value. > Reviewed-by: Andy Shevchenko > 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 > -- With Best Regards, Andy Shevchenko