Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3360138pxj; Mon, 7 Jun 2021 08:45:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMY0jvhZacJHMERv4aXE1mWqD+y0XjEfRlHB3nkzCnp0zZlGeIuWBoD6Ja7CylQahGQE1m X-Received: by 2002:aa7:dd57:: with SMTP id o23mr20342792edw.98.1623080755239; Mon, 07 Jun 2021 08:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623080755; cv=none; d=google.com; s=arc-20160816; b=USK0REak0MLzEcXP5+T91I9zfpU+mS3ZIcBllHGqO8DlVYpxxj9Nlul/0CSKxitpDl mYB3ssVWYiyXV6FkJuuxd/JFQyJEhieu1tkwaZmwzN2RQ4ej7cOpgwT+gU4miWHK4BRG DhNVQilK8IiyRXKPzTgihBGO2qa10csGkSglBeTZmfwZCwFKsLr02PMd+KuoPy8g5/MM ylX1dXtYedt/kIjOTeuEDJICQSMk4GEVqwsI1pIHRJmjawZ96ATKqJhCQkPK/Q0TXFeW XNZJRRJPxsQjdsNJslay8yte88aai33dY8jCw/L8p37Ak/d8LlrfPSNrDn9cBz/4fpWw zQXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=rb3g6DfREk5PQ35y9K1t3PsHD4pGqOtWifYWQvTpCCM=; b=b8KqYRzkbPdZaqm70IXG9xZC6uNCfXElWvF/jcGtrhTIY6A9omqOCBEETdPLFUm+Ex 608dVnWp+yUX970CtczEK9lpNauboHBvLNl/HOK8vr221u5M6RKje2ngUpMv1syEmV/e Ef/VhmNvUu1VHJHt+0Ll8gPpxDWiPYKvVSk1sdL5hEa+ndXEKD+ruzXsRVBN+qFX6Y74 Z8FsAYLS63y5KU+wrwP81LvcDdhLTA/STFMBrVMDkXxazMCrmDU6KoW69UE9cYqBAow1 w2BNGAP09hntE25lDBsJQOdm9okq0t4V/nwjujmu7b3FPqIpSmrDQ9Qb7YU6vYYLeAoY uZog== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si12868531ejx.554.2021.06.07.08.45.32; Mon, 07 Jun 2021 08:45:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbhFGPo6 (ORCPT + 99 others); Mon, 7 Jun 2021 11:44:58 -0400 Received: from smtprelay0029.hostedemail.com ([216.40.44.29]:41378 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231582AbhFGPo5 (ORCPT ); Mon, 7 Jun 2021 11:44:57 -0400 Received: from omf08.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 24B06837F24A; Mon, 7 Jun 2021 15:43:05 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA id 1BA771A29F9; Mon, 7 Jun 2021 15:43:03 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 1/3] units: Add SI metric prefix definitions From: Joe Perches To: Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jarkko Nikula , Mika Westerberg , wsa@kernel.org Date: Mon, 07 Jun 2021 08:43:02 -0700 In-Reply-To: <20210607152344.57458-1-andriy.shevchenko@linux.intel.com> References: <20210607152344.57458-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.90 X-Rspamd-Server: rspamout01 X-Rspamd-Queue-Id: 1BA771A29F9 X-Stat-Signature: mrgkembcckokhd5c6m9siy7a4ij7piwc X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+dXr/s0DMQTspylw0p8uO+ItJW9kzTZv0= X-HE-Tag: 1623080583-985749 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-06-07 at 18:23 +0300, 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. [] > diff --git a/include/linux/units.h b/include/linux/units.h [] > @@ -4,6 +4,22 @@ > ? > ?#include > ? > +/* 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 > + > ?#define MILLIWATT_PER_WATT 1000L > ?#define MICROWATT_PER_MILLIWATT 1000L > ?#define MICROWATT_PER_WATT 1000000L Somewhat surprisingly to me, this seems safe. (though I suggest using UL and ULL rather than L and LL) The only use of any of these seems to be: sound/pcmcia/vx/vxp_ops.c: [VX_MICRO] = 0x0c, // MICRO sound/pcmcia/vx/vxp_ops.c: vx_outb(chip, MICRO, level); sound/pcmcia/vx/vxp_ops.c: vx_outb(chip, MICRO, vx_compute_mic_level(chip->mic_level)); and these vx_outb uses are themselves macros that prepend VX_ to the 2nd arg.