Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp352233rdb; Thu, 2 Nov 2023 05:50:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo6X+3BjGaZiyfSjVws698N9m53vbGVmaLe2wok6yqw9mmrBmSzw7lemzCjiG17A9gSvSe X-Received: by 2002:a05:6a00:180f:b0:6bf:4cb1:e78 with SMTP id y15-20020a056a00180f00b006bf4cb10e78mr24498113pfa.6.1698929447603; Thu, 02 Nov 2023 05:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698929447; cv=none; d=google.com; s=arc-20160816; b=KTEZwqjsUQjTMEW4Eb2w4QdAnpdVCCKf+IJv49q17lBnHYihZoLbiLIpSsZjSIX2TY 2U1qpg32xX1RpoC8KY4rk68iOJrP8TTaitKqeXhKI/aJwhuNHdliNHlz7n6+h4g5JImn CiG2bSvRJODwYn9kjo0VshMyNi1DNg4A+9wsR4K78fX0w18hPqCS6NrhvAWlnd8wh1ae qBNniMj1N8I+zQjVFY0bzOk7u1TtCcQaD1T6rDkIao6OeWoGu7rzEEoCMYAC+bXExJBn Sx8dS5AiyllfKMszKxIzjxr7UnNbTBFwWZDr9PDAHudUSNwQqt9DAioMufI95ueUz2W5 zDBQ== 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=9fJ9yEh4ryDkk5V9F+E60grT0bfFQzlUK11AUINples=; fh=/WrmyaLDeUIGZLM2cb/L0JladnCq1V446GKdpCoBWLQ=; b=MzKsw2gaGn/bc+b6qITH61M+mdsw5G0ZPJ/2W0CLZehUzOgR4BTpddLTHODpbr64mp T+ISFgNpFiroiw9HpK/iErKZagFU1KiSgH+PStCNMrDMz9xCNMZXvGjvJ5K4xK9RH9+K pNgHoSHSebuIxgBONEv9gu2FI+kYnUN/MtPGdm4qzAn+6JRV1OKfLx73bVVSDEBxt/L7 OzhtkbOT1SQjqi8DwagCrRHbdEqBPEkP7HmDklrEYsPFjyAXDA2kkV+0asLvLA+pQHoc sRXQiTo/tQyw/Ys7a98xpihEgM4IymZJKRG8kFax8zh3u+H1zcdoKouK7e3wRQlS75hw /SWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NJ4ossLP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z6-20020a056a00240600b006bdb7c5f75dsi3556531pfh.357.2023.11.02.05.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 05:50:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NJ4ossLP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id B5C3B80F6947; Thu, 2 Nov 2023 05:50:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234476AbjKBMuO (ORCPT + 99 others); Thu, 2 Nov 2023 08:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbjKBMuN (ORCPT ); Thu, 2 Nov 2023 08:50:13 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95FDA12F; Thu, 2 Nov 2023 05:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698929407; x=1730465407; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=c2vyFTVnaWpz+keCJtdyM0qcjQXSrJPEBxbkHvGNQoU=; b=NJ4ossLPK6kPRTsjQhW63j1H4mE9/dsNNOqWUZBZBX/rBsqgaB1IL2UB wVBUl9Cnc133GEAIULGM5cdcHb2/dUzQQcgqjIjryLcns0WNVMSE0jjjv LxklUtYkPRzhimQQca2vU70uuQv89vgGg5ncPUegnjMv6M8MvNT3MrUjS OP/JqYbYAuTbiUBuEa6BE8P23QYI/W1EENh4L2yKP7oEc4oIyCSDd/Qk/ m2YpsXDIZudHF2DV3yfrMQ7Xf8+AzDwUC8NcrGQgorN2CN+knWyrPH3Pe Mxk6cRe9io2yIMF0mqX8/O9TcWeTM/W3ZoW/mS59cHZi3XmQ3TOicVfY4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="455185831" X-IronPort-AV: E=Sophos;i="6.03,271,1694761200"; d="scan'208";a="455185831" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 05:50:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="711142226" X-IronPort-AV: E=Sophos;i="6.03,271,1694761200"; d="scan'208";a="711142226" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 05:50:03 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC3) (envelope-from ) id 1qyX96-0000000Agna-1mXE; Thu, 02 Nov 2023 14:50:00 +0200 Date: Thu, 2 Nov 2023 14:50:00 +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> <6d553aaa-279f-48bf-96c9-30fdac1ae372@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d553aaa-279f-48bf-96c9-30fdac1ae372@gmail.com> 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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 02 Nov 2023 05:50:42 -0700 (PDT) On Wed, Nov 01, 2023 at 08:16:32AM +0200, Matti Vaittinen wrote: > On 10/31/23 15:42, Andy Shevchenko wrote: > > 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? > > Now that I know of this macro - Maybe. It's just always scary to touch > things which seem like fundamental building blocks and which may be used by > many. Odds are something breaks, so I tend to be very conservative when > suggesting changes to widely used stuff. Especially when I have no idea when > and why the API has been added - and if the thing I'm trying to "fix" has > been a deliberate choice. Welcome to the club of the div overflow in macros discussion: https://lore.kernel.org/linux-clk/20231024161931.78567-1-sebastian.reichel@collabora.com/T/#t -- With Best Regards, Andy Shevchenko