From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCB9D7C for ; Sat, 6 Aug 2022 18:43:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4642C433C1; Sat, 6 Aug 2022 18:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659811398; bh=9zcEKsBlFaq2Abp3Ujre2SKv4E24ne+3Amc5GKr94r8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c9gsw5fxL6QdsooDIbb4X9vk/stoJ712TyCVJOtC9CJKSkjLFQCmXi/5mDrkXTPFl jwrx2ij+iN76kBuqX9E1RI3tmZt4rQAFUuSKPdHAlNEoeHtQQmFD+RkvIxrDw+QiHA pWSLiv4Et6Ox7W7nGspv5/wWXDvIqhyFgJ+QiSbeFsZXNY3pcirIGvvvl4tuSvzzRW x2bfobAuH8Qw/R6aRDHODz3poGX1Vras3COg4325mAbnVJjU+HP+0u4w7c6iC55bt2 JRB9CaMTRw+5fLxFkM46MspQLfkomAlJE7T8i/QU3kwz6vO3V2HaHuYdvxorrGC8LB mAA2JfHh4MrsA== Date: Sat, 6 Aug 2022 19:53:27 +0100 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: , , , , , , , , , Lad Prabhakar , , Gwendal Grignou , Saravanan Sekar , Tomer Maimon , Maxime Coquelin , "Alexandre Torgue" , Lorenzo Bianconi , Fabio Estevam , Shawn Guo , "Olivier Moysan" , Tali Perry , Thara Gopinath , Bjorn Andersson , Arnd Bergmann , Benjamin Fair , Nicolas Ferre , "Rafael J. Wysocki" , Patrick Venture , Pengutronix Kernel Team , Fabrice Gasnier , Daniel Lezcano , Benson Leung , Nancy Yuen , Miquel Raynal , "Alexandre Belloni" , Zhang Rui , Linus Walleij , Christophe Branchereau , Cai Huoqing , Avi Fishman , Eugen Hristev , Matthias Brugger , Sascha Hauer , Lars-Peter Clausen , "Andy Shevchenko" , Guenter Roeck , Paul Cercueil , Claudiu Beznea , Andy Gross , Amit Kucheria , Michael Hennerich , "Haibo Chen" , Jishnu Prakash Subject: Re: [PATCH v3 13/15] iio: adc: stm32-adc: convert to device properties Message-ID: <20220806195327.14626e0d@jic23-huawei> In-Reply-To: <20220806191538.7019ecfe@jic23-huawei> References: <20220715122903.332535-1-nuno.sa@analog.com> <20220715122903.332535-14-nuno.sa@analog.com> <20220806191538.7019ecfe@jic23-huawei> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, 6 Aug 2022 19:15:38 +0100 Jonathan Cameron wrote: > On Fri, 15 Jul 2022 14:29:01 +0200 > Nuno S=C3=A1 wrote: >=20 > > Make the conversion to firmware agnostic device properties. As part of > > the conversion the IIO inkern interface 'of_xlate()' is also converted = to > > 'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF > > dependencies from IIO. > >=20 > > Signed-off-by: Nuno S=C3=A1 > > Reviewed-by: Andy Shevchenko =20 > One query below. Otherwise LGTM (not that's true of the other patches I h= aven't > comment on at all) >=20 > > @@ -1885,8 +1887,12 @@ static int stm32_adc_get_legacy_chan_count(struc= t iio_dev *indio_dev, struct stm > > num_channels +=3D ret; > > } > > =20 > > - ret =3D of_property_count_elems_of_size(node, "st,adc-diff-channels", > > - sizeof(struct stm32_adc_diff_channel)); > > + /* > > + * each st,adc-diff-channels is a group of 2 u32 so we divide @ret > > + * to get the *real* number of channels. > > + */ > > + ret =3D device_property_count_u32(dev, "st,adc-diff-channels"); =20 >=20 > I think this can return an error code which should probably be handled. > More than possible that was true of original code though... >=20 > If it can't return an error for some reason I'm missing perhaps a > comment to explain why. Given this was only outstanding question I stuck a conservative if (ret < 0) return ret; here whilst applying. >=20 > > + ret /=3D (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32)); > > if (ret > adc_info->max_channels) { > > dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n"); > > return -EINVAL; =20