From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 035DFC433F5 for ; Wed, 29 Sep 2021 17:02:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D55186124C for ; Wed, 29 Sep 2021 17:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244242AbhI2RE1 (ORCPT ); Wed, 29 Sep 2021 13:04:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:53982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243396AbhI2RE0 (ORCPT ); Wed, 29 Sep 2021 13:04:26 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D2696124A; Wed, 29 Sep 2021 17:02:44 +0000 (UTC) Date: Wed, 29 Sep 2021 18:06:38 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Lars-Peter Clausen , , Subject: Re: [PATCH v2 2/2] iio: st_lsm9ds0: Make use of the helper function dev_err_probe() Message-ID: <20210929180638.6ddb313b@jic23-huawei> In-Reply-To: <20210928014055.1431-2-caihuoqing@baidu.com> References: <20210928014055.1431-1-caihuoqing@baidu.com> <20210928014055.1431-2-caihuoqing@baidu.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Tue, 28 Sep 2021 09:40:54 +0800 Cai Huoqing wrote: > When possible use dev_err_probe help to properly deal with the > PROBE_DEFER error, the benefit is that DEFER issue will be logged > in the devices_deferred debugfs file. > Using dev_err_probe() can reduce code size, and the error value > gets printed. > > Signed-off-by: Cai Huoqing Hi Cai, Picking a random patch to reply to... Thanks for your hard work on these. The ones I haven't replied to look fine to me. It might have been slightly better to slow down your initial submission of these as then we could perhaps have avoided 2-3 versions of every patch by identifying shared elements to improve in a smaller set. Still that's the benefit of hindsight! I'll not apply these quite yet so as to allow time for driver maintainers and others to take a look. If you could tidy up those few minor comments I have that would be great. Thanks, Jonathan > --- > drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c > index b3a43a3b04ff..9fb06b7cde3c 100644 > --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c > +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c > @@ -24,10 +24,10 @@ static int st_lsm9ds0_power_enable(struct device *dev, struct st_lsm9ds0 *lsm9ds > > /* Regulators not mandatory, but if requested we should enable them. */ > lsm9ds0->vdd = devm_regulator_get(dev, "vdd"); > - if (IS_ERR(lsm9ds0->vdd)) { > - dev_err(dev, "unable to get Vdd supply\n"); > - return PTR_ERR(lsm9ds0->vdd); > - } > + if (IS_ERR(lsm9ds0->vdd)) > + return dev_err_probe(dev, PTR_ERR(lsm9ds0->vdd), > + "unable to get Vdd supply\n"); > + > ret = regulator_enable(lsm9ds0->vdd); > if (ret) { > dev_warn(dev, "Failed to enable specified Vdd supply\n"); > @@ -36,9 +36,9 @@ static int st_lsm9ds0_power_enable(struct device *dev, struct st_lsm9ds0 *lsm9ds > > lsm9ds0->vdd_io = devm_regulator_get(dev, "vddio"); > if (IS_ERR(lsm9ds0->vdd_io)) { > - dev_err(dev, "unable to get Vdd_IO supply\n"); > regulator_disable(lsm9ds0->vdd); > - return PTR_ERR(lsm9ds0->vdd_io); > + return dev_err_probe(dev, PTR_ERR(lsm9ds0->vdd_io), > + "unable to get Vdd_IO supply\n"); > } > ret = regulator_enable(lsm9ds0->vdd_io); > if (ret) {