Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp376693pxa; Thu, 27 Aug 2020 05:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmWb+VE0NBnBPNBbY5yhpmJAcN5ovajT7QJ57ehpYCcn/ZTR5JIhK4I7+kxf3B99kmPkG/ X-Received: by 2002:aa7:d955:: with SMTP id l21mr20005445eds.343.1598529805626; Thu, 27 Aug 2020 05:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598529805; cv=none; d=google.com; s=arc-20160816; b=D3UPfxUwX+BTtdj9EnCo+I4Pq8DuIXV9ql6tqZgNGdScERmovHL3gX256aY9e86sWR sfbXv0M9NsYcfCPqOcTkzB2rYGMgqwZ06ubbpnKkYrnF7Ef5Bad05/MkTU2G7291c/+2 J2YTHqw54ZkuncFcYtwdnBN/KakHz/Pe0AbMJh2kxcWwWEYLjyLIhg0c6Wvg46H87ifa 72Q33kk1Kk2+uad11vMueFBRmj2Dpra1iP42tcBUN53xcspUZdZ+E+DmPzj1wOPxUCKf Lp9tqeYXVsJftJkvpxrhq93jLfnKogdo8GJfbigdLpc3mZChJmW0lRY7ELt8x6k4RZ1K 2W1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=4N+i/d88MMthsuI2vAroN/pUznOIHtigCOM07ME6EnU=; b=KWm3C/EE6BIQF4Oq8eZth8As+8uixd60AAryk4Cv3hCL5Jh45fHlmGgp7jBRhA2bFn scA6ySWrohI25/EiTXHh+XPaHvhui1ZLF71rnVrJvTLdbhvXYh0w6Uegw4RsZamI35nG MiDsNA7nguX5a7OUDIRjZmurMDRYausOMz1LdPKh6RZoCSefu9LhPdqvHLtoT2gEpLRo 2h1j8KUKa3zpG075o9E27RHlsT43IoCFmIg6kmfagncqAGLINLYL+BaMMs9oKSg7D8e7 qkSupDCJ1Ui5TA/PpQReb5n8BsBlt9PBORyBOjXOd0kshcdhm+7Y5ZWnd9X0/NEZ/aaq NZ5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rl11si1193179ejb.519.2020.08.27.05.03.01; Thu, 27 Aug 2020 05:03:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728907AbgH0MBx (ORCPT + 99 others); Thu, 27 Aug 2020 08:01:53 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2697 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728869AbgH0Loh (ORCPT ); Thu, 27 Aug 2020 07:44:37 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 386C1FEB9735C037E07C; Thu, 27 Aug 2020 12:26:06 +0100 (IST) Received: from localhost (10.227.96.57) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Thu, 27 Aug 2020 12:26:05 +0100 Date: Thu, 27 Aug 2020 12:26:05 +0100 From: Jonathan Cameron 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 , Jonathan Bakker , "Alexandru Ardelean" , , , , , Subject: Re: [PATCH 01/16] iio: accel: bma180: Simplify with dev_err_probe() Message-ID: <20200827122605.0000770f@huawei.com> In-Reply-To: <20200826145153.10444-1-krzk@kernel.org> References: <20200826145153.10444-1-krzk@kernel.org> Organization: Huawei tech. R&D (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.227.96.57] X-ClientProxiedBy: lhreml715-chm.china.huawei.com (10.201.108.66) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Aug 2020 16:51:38 +0200 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. > > Signed-off-by: Krzysztof Kozlowski Please make sure to send v2 to linux-iio@vger.kernel.org > --- > 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)