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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 830EAC433F5 for ; Sun, 9 Oct 2022 12:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbiJIMmh (ORCPT ); Sun, 9 Oct 2022 08:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbiJIMmf (ORCPT ); Sun, 9 Oct 2022 08:42:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9438FFB; Sun, 9 Oct 2022 05:42:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79F1CB80D2A; Sun, 9 Oct 2022 12:42:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFAB2C433C1; Sun, 9 Oct 2022 12:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665319352; bh=f+mosKCYImVjf5AY2/cBN3jgVGzwj8LSrp7eU/MOFg4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=N7LKrwOdUGnlYeoUU0LVlhBi005V35WwkiVkWZ8iiLSsbA56VeiIhSPLaQl2WGzuW w89wOBey4yI/Nv6EqXwU36cMc7apcX5Uf9B2TGRzEXGMyLMXtpxWzigThXXwk8ymWG 0PyPUfA3HHJeAO7z5YHpAh7D2t8YlmwkCGdQbFsXI6AaoDZtBQCJa0YnwPbbRnkcb0 8AQpkbOB56CbaVDO8fhtNWXbyALhLkGTIwSBvWJxFaGAD9fJDI0PnyJm42+tQfLVSL yjEXuVd5XJV7H8igsKVNx6/+x7At2UcLA81rzCG5xix/uqbrnkgwMA/i7BDOPJ/HDa KOucznWY74CHg== Date: Sun, 9 Oct 2022 13:42:52 +0100 From: Jonathan Cameron To: Olivier Moysan Cc: Alexandre Torgue , Andy Shevchenko , Fabrice Gasnier , Lars-Peter Clausen , Maxime Coquelin , , Paul Cercueil , Sebastian Andrzej Siewior , Wan Jiabing , Yannick Brosseau , , , , Subject: Re: [PATCH v3 1/8] iio: adc: stm32-adc: fix channel sampling time init Message-ID: <20221009134252.2b636e0a@jic23-huawei> In-Reply-To: <20221005161424.4537-2-olivier.moysan@foss.st.com> References: <20221005161424.4537-1-olivier.moysan@foss.st.com> <20221005161424.4537-2-olivier.moysan@foss.st.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; 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 Wed, 5 Oct 2022 18:14:17 +0200 Olivier Moysan wrote: > Fix channel init for ADC generic channel bindings. > In generic channel initialization, stm32_adc_smpr_init() is called > to initialize channel sampling time. The "st,min-sample-time-ns" > property is an optional property. If it is not defined, > stm32_adc_smpr_init() is currently skipped. > However stm32_adc_smpr_init() must always be called, > to force a minimum sampling time for the internal channels, > as the minimum sampling time is known. > Make stm32_adc_smpr_init() call unconditional. Hi Olivier. Andy commented on this in v2... Line lengths in patch description are rather random and no where near the typical 72-75 chars. Should look more like: Fix channel init for ADC generic channel bindings. In generic channel initialization, stm32_adc_smpr_init() is called > to initialize channel sampling time. The "st,min-sample-time-ns" property is an optional property. If it is not defined, stm32_adc_smpr_init() is currently skipped. However stm32_adc_smpr_init() must always be called, to force a minimum sampling time for the internal channels, as the minimum sampling time is known. Make stm32_adc_smpr_init() call unconditional. Fine to have multiple paragraphs, but within each one, don't wrap too early. > > Fixes: 796e5d0b1e9b ("iio: adc: stm32-adc: use generic binding for sample-time") > Signed-off-by: Olivier Moysan > --- > drivers/iio/adc/stm32-adc.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c > index 6256977eb7f7..3cda529f081d 100644 > --- a/drivers/iio/adc/stm32-adc.c > +++ b/drivers/iio/adc/stm32-adc.c > @@ -2086,18 +2086,19 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, > stm32_adc_chan_init_one(indio_dev, &channels[scan_index], val, > vin[1], scan_index, differential); > > + val = 0; > ret = fwnode_property_read_u32(child, "st,min-sample-time-ns", &val); > /* st,min-sample-time-ns is optional */ > - if (!ret) { > - stm32_adc_smpr_init(adc, channels[scan_index].channel, val); > - if (differential) > - stm32_adc_smpr_init(adc, vin[1], val); > - } else if (ret != -EINVAL) { > + if (ret && ret != -EINVAL) { > dev_err(&indio_dev->dev, "Invalid st,min-sample-time-ns property %d\n", > ret); > goto err; > } > > + stm32_adc_smpr_init(adc, channels[scan_index].channel, val); > + if (differential) > + stm32_adc_smpr_init(adc, vin[1], val); > + > scan_index++; > } >