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 7C241C7EE2C for ; Sun, 28 May 2023 22:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbjE1Wmo (ORCPT ); Sun, 28 May 2023 18:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjE1Wmn (ORCPT ); Sun, 28 May 2023 18:42:43 -0400 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CF1B9 for ; Sun, 28 May 2023 15:42:41 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id f31d08a1-fda8-11ed-b972-005056bdfda7; Mon, 29 May 2023 01:42:39 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Mon, 29 May 2023 01:42:39 +0300 To: Astrid Rost Cc: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@axis.com, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Mathieu Othacehe Subject: Re: [PATCH v4 3/7] iio: light: vcnl4000: Add als_it for vcnl4040/4200 Message-ID: References: <20230522142621.1680563-1-astrid.rost@axis.com> <20230522142621.1680563-4-astrid.rost@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230522142621.1680563-4-astrid.rost@axis.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mon, May 22, 2023 at 04:26:17PM +0200, Astrid Rost kirjoitti: > Add illuminance integration time for vcnl4040 and vcnl4200. > Add read/write attribute for illuminance integration time and read > attribute for available integration times. > Set scale and sampling rate according to the integration time. ... > + data->vcnl4200_al.sampling_rate = ktime_set(0, val * 1200000); > + if (data->id == VCNL4200) > + /* 24000 µlux/step * 50000 µs / val */ > + data->al_scale = div_u64(1200000000, val); Without type these constant are integers. Is this okay with 32-bit builds? > + else > + /* 100000 µlux/step * 80000 µs / val */ > + data->al_scale = div_u64(8000000000, val); Ditto. Also, can you use constants from units.h (KILO) and time.h (USEC_PER_MSEC)? ... > +out: out_unlock: > + mutex_unlock(&data->vcnl4000_lock); > + return ret; -- With Best Regards, Andy Shevchenko