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 F408A1C2D for ; Sat, 6 Aug 2022 18:05:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EB2FC433D6; Sat, 6 Aug 2022 18:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659809130; bh=0HzIP9SrV9O0nOfGbgmplxgNw0/6ojVp7tFkN11yVfo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iA++Zo5YNbwlgF1KdigAHMVod+mw3obkjxP4uPKJvKf80VHhLrMMeOcL794ocZ7EI ZH6j33/TxYpNNkeorROm7kBPIi6GZ3N4zGn+uVtPmCGpROUqPY/YzcTta1o5ae6x63 BsLUBDEE1UJVibwXbIeHCoFJqh/ffLdroa+3LM60I72Ff3nqzaADtLFYzV2vTVXYW4 rWf3HqA65ikztbAjdOeysHIm5F5igz/Igtcm4nrImlGhp+1uR8b0aqzZuTv2zwkYBQ HhnHAdImxE66ThSwNx/eE0E+QiMoHOmqTiw2OYQv1E8YoQgoTG3GGViObJghhs1Q4B 1Ipe76VEq8dFw== Date: Sat, 6 Aug 2022 19:15:38 +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: <20220806191538.7019ecfe@jic23-huawei> In-Reply-To: <20220715122903.332535-14-nuno.sa@analog.com> References: <20220715122903.332535-1-nuno.sa@analog.com> <20220715122903.332535-14-nuno.sa@analog.com> 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 Fri, 15 Jul 2022 14:29:01 +0200 Nuno S=C3=A1 wrote: > 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 One query below. Otherwise LGTM (not that's true of the other patches I hav= en't comment on at all) > @@ -1885,8 +1887,12 @@ static int stm32_adc_get_legacy_chan_count(struct = 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"); I think this can return an error code which should probably be handled. More than possible that was true of original code though... If it can't return an error for some reason I'm missing perhaps a comment to explain why. > + 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;