Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp252550rdb; Tue, 31 Oct 2023 06:43:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEls3CeN0QjtZwxR1JaM8SLErAtFrPJygR0uAeS4QygvV1UdlmrqpDfOJ9vmfpwTpG6obxX X-Received: by 2002:a17:902:ec82:b0:1cc:6acc:8fa4 with SMTP id x2-20020a170902ec8200b001cc6acc8fa4mr1523835plg.32.1698759785904; Tue, 31 Oct 2023 06:43:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698759785; cv=none; d=google.com; s=arc-20160816; b=Z8c1wQ2nhP+Qpu5hiiIrFouwET2+KJJz3kGC2RvPX5XHlE0dW56uuw9NtUQLjgEYln RD7PXmn0L4UoOgKRF149oYZmyvPO/AXaNhoywlk1DN3wTg6KPDmzLlZTZO7UqhA2Djr5 GZu2r0GiC+W4hvj2k5n+4x3h54ymjwm9KkzhLTKxgQpzshbQm6x6VIHqxBOKrsuVMO8t s+wt2dzz46OZ4XABneeHiaWEk16BbFHP1n5ffeObRDun7LwwR5jK8ydl98MRRswq/3D9 qJipHF2Q5EmD9aUfAHeIRO/EKDxtNOfyBaod4tuFn4vHTOXode64orOsz5l05wDoGbgT 7q2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=60yqfyAhggPCdfep8maExf2Ej3ZOODZQ2VH5Pg+RW08=; fh=/WrmyaLDeUIGZLM2cb/L0JladnCq1V446GKdpCoBWLQ=; b=Xgoz5p/2b6JcgSdUvNiuGOWL93FPgSeHX6XTOlGI/xyj5yvL8iyTwy3B9tXz0wDQio KmiagOvpyBbLvCOi8FskPECIZR4kky0rau73twJ+MwUpgTuMyEhmTzFr9bf4vp4nKMP6 zC2zZwH6QTQSL5y8tkPpRzesQXYf/YRx7YlKfQe/MNv4Qv/4k3dm+RpluVTIKqO5msBB FusoUzi651XD4jy0zIZwd6N41lshyxNwmYIWhIEwHPHIao8U3DxLzqvxn2QbM5Boz9Gx t5xlIjd0lxqiC0B4Ftqe78Q8zd17Vl5joCCuQzlOVPuhvt02BBS6yknQF7JbUlxL6OpJ LmBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KLw0FFKk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id k1-20020a170902c40100b001cc385b457asi1035876plk.284.2023.10.31.06.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 06:43:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KLw0FFKk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 15962809C66D; Tue, 31 Oct 2023 06:43:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344599AbjJaNmu (ORCPT + 99 others); Tue, 31 Oct 2023 09:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344561AbjJaNmt (ORCPT ); Tue, 31 Oct 2023 09:42:49 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6250A9F; Tue, 31 Oct 2023 06:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698759767; x=1730295767; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aJcpi54mkMrL0wdJC8MpLSy7I+gdOKYWH8wlzsQiXAI=; b=KLw0FFKk9Nf812PGKvbS1gYGeMnNrbGW1RY1t+nCzM3si+JEYbf1UMzE wasfcIQCoB5KOXo5GjmstJGq6++2Gfr4sBEpmJJ0Lq26eRiTGFuc6m2Wu i5Lo0bM0qHesBhPRrDfWDxIGxng3tu8dj9Ktn7zty9uEUf0FOmTCH8hmS q4n7dd4kO79EyMW52/isPQtsxp8E35YAvwHNz6DIuFHt07g7AMVIBip+c 1z5a5Ez9dvxzBgBbemqsJTdik8OxxXvPqoIMvmgL08I+8gXFlLXFnQAym FDQE29DsAMPfgf/mS0Z+utWQ4vgVmfS8QZzvnja+gft0gcLNRsRlI0L3r A==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="391158031" X-IronPort-AV: E=Sophos;i="6.03,265,1694761200"; d="scan'208";a="391158031" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 06:42:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="737070285" X-IronPort-AV: E=Sophos;i="6.03,265,1694761200"; d="scan'208";a="737070285" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 06:42:43 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC3) (envelope-from ) id 1qxp0y-0000000A9sT-0EmV; Tue, 31 Oct 2023 15:42:40 +0200 Date: Tue, 31 Oct 2023 15:42:39 +0200 From: Andy Shevchenko To: Matti Vaittinen Cc: Jonathan Cameron , Subhajit Ghosh , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Gazzillo , Matt Ranostay , Stefan Windfeldt-Prytz , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] iio: light: Add support for APDS9306 Light Sensor Message-ID: References: <20231027074545.6055-1-subhajit.ghosh@tweaklogic.com> <20231027074545.6055-3-subhajit.ghosh@tweaklogic.com> <20231028162025.4259f1cc@jic23-huawei> <84d7c283-e8e5-4c98-835c-fe3f6ff94f4b@gmail.com> <6a697c62-6a7c-4b31-bc8e-10f40db0363d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 31 Oct 2023 06:43:03 -0700 (PDT) On Tue, Oct 31, 2023 at 02:07:46PM +0200, Matti Vaittinen wrote: > On 10/31/23 12:38, Andy Shevchenko wrote: > > On Tue, Oct 31, 2023 at 09:11:37AM +0200, Matti Vaittinen wrote: > > > On 10/30/23 12:21, Matti Vaittinen wrote: > > > > On 10/29/23 17:51, Matti Vaittinen wrote: > > > > > On 10/28/23 18:20, Jonathan Cameron wrote: ... > > > tmp = gts->max_scale; > > > > > > rem = do_div(tmp, total_gain); > > > if (total_gain > 1 && rem >= total_gain / 2) > > > tmp += 1ULL; > > > > ...which is NIH DIV_ROUND_CLOSEST_ULL() > > There is a difference though. The DIV_ROUND_CLOSEST_ULL() does > > tmp + total_gain / 2; > > before division - which in theory may overflow. Then you can fix it there for everybody, no? -- With Best Regards, Andy Shevchenko