Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3309720pxj; Mon, 7 Jun 2021 07:38:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO1NvH81yRpWwP+yUDuluQ3KtVrwnrByqu2n52kHSFunvJBkOuXUSbXAmT6fFvHsSK06pm X-Received: by 2002:a17:906:dff2:: with SMTP id lc18mr18300929ejc.371.1623076703210; Mon, 07 Jun 2021 07:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623076703; cv=none; d=google.com; s=arc-20160816; b=uT2ruGigq+LtwNc1W6m9EL4/fzQCCASnLdub4k2FlFu/1y8P2A4I5iYr10PSol39gW 5XfBMacg+hU/VVe94+AQ2FwtLY51b6mph0E3egi1UfPidji/b3WWssLLv6e5GNLmyy3n Fq9w9F0dU79PIZKZjJmF0f7jewk/3GCuJiHoevKNVymbjF+NjnkFnDu/B7oHrt5LfmDW qPIqgXXkjGOgUObt+nzgD+aDd9rWj9DHjcUEkxXuXY/h/0z11grHkGUsYMbXV3oWEo8P Y81ArLEGOc/cDZMpPeccz+nHhz1VTwhAy5gai0KOy/tgUMl9EcmmjVXBwFbpDQg8FcB0 NYhA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=nne6zGr7+bl4m+OAR6Lr/a4VaFC0gQY1ovzszAYdp2s=; b=F+8rpDQKEQwff8H7cbTKOORGNOCEl2vY7o2992u0r0daxsVByx8OpQn+pLmln2Nl89 2z3OD1fnY29r1ejmAqaDYdXni45cHVmb35c1d0RBlrQhDBUJ6KPHTSzcAI165ysYExEW IpBnShDSd/3y8cPhAV1Cv40Jzum8UE535GBzUx1mUCwCHKgL6tzkpgLfOnstmQgV7pK1 YbdE6DHbx6yT86UKIl6oiV2s6f4/j9oJ4jq+/65GNaFWmEDpkrYzCEyyVlVJWL9bUDAW S7T0G9lTgKQRha6imU/ZU8eJtp0/Dma7gi0HQSlnKSjGaaF9ZCmeOs7Tjat9uNiKyzqh CpLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j21si12647839edj.143.2021.06.07.07.38.00; Mon, 07 Jun 2021 07:38:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbhFGOhE (ORCPT + 99 others); Mon, 7 Jun 2021 10:37:04 -0400 Received: from mga18.intel.com ([134.134.136.126]:32147 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230269AbhFGOhD (ORCPT ); Mon, 7 Jun 2021 10:37:03 -0400 IronPort-SDR: YHus5ZZzPt5RsI8lgm/Z+XWoGpEkWJN4P6hKwuDudl6LEP4KhqVXeL73D5Ki8T4505GmX8MxAM HHqoOdXwmJ1g== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="191959861" X-IronPort-AV: E=Sophos;i="5.83,255,1616482800"; d="scan'208";a="191959861" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2021 07:35:09 -0700 IronPort-SDR: lP96tSyzQjCd5f+8yCXUz1wRB/pPr/tGbKxcrARGSRDxd2Q/BLgej5NK5IkiqbXRJi+oZPq3Ct lijFHHJEdQ9g== X-IronPort-AV: E=Sophos;i="5.83,255,1616482800"; d="scan'208";a="447501697" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2021 07:35:07 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lqGLJ-000HE8-7E; Mon, 07 Jun 2021 17:35:05 +0300 Date: Mon, 7 Jun 2021 17:35:05 +0300 From: Andy Shevchenko To: Jarkko Nikula Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Mika Westerberg , wsa@kernel.org Subject: Re: [PATCH resend v1 1/3] units: Add SI metric prefix definitions Message-ID: References: <20210603160433.35816-1-andriy.shevchenko@linux.intel.com> <0466dab7-f2d2-3b7c-52a6-a12a6b09a67f@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 05:24:44PM +0300, Andy Shevchenko wrote: > On Mon, Jun 07, 2021 at 03:33:31PM +0300, Jarkko Nikula wrote: > > On 6/3/21 7:04 PM, Andy Shevchenko wrote: > > > Sometimes it's useful to have well-defined SI metric prefix to be used > > > to self-describe the formulas or equations. > > > > > > List most popular ones in the units.h. > > ... > > > > +/* Metric prefixes in accordance with Syst?me international (d'unit?s) */ > > > +#define PETA 1000000000000000LL > > > +#define TERA 1000000000000LL > > > +#define GIGA 1000000000L > > > +#define MEGA 1000000L > > > +#define KILO 1000L > > > +#define HECTO 100L > > > +#define DECA 10L > > > +#define DECI 10L > > > +#define CENTI 100L > > > +#define MILLI 1000L > > > +#define MICRO 1000000L > > > +#define NANO 1000000000L > > > +#define PICO 1000000000000LL > > > +#define FEMTO 1000000000000000LL > > > > For me milli is always 1/1000. > > For me as well. Kernel does not operate with float point numbers. > That's why it's ordered like this. > > > Might lead to confusion with these defines if > > idea is to multiply with KILO but divide with MILLI? > > If the author of the hypothetical driver doesn't understand this, maybe > they can ask first, but I am an optimist here and I assume that whoever > writes the driver for a sensor / etc has a minimum education to see > what's needed for the certain case. Writing this, I think that I'm not so educated :-) What we have in I?C case is kHz * ns = 10^3 * 10^-9, so we need to divide by 10^-6 to normalize the numbers. Sounds like MICRO is the correct thing to use there. -- With Best Regards, Andy Shevchenko