Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp2049860imm; Fri, 6 Jul 2018 10:53:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpezSSq8faIABkyoI9tAYfzKibAmTkm6is79np4MaZzlH57Spz8H7N6gETcXQoxoBsm891sa X-Received: by 2002:a63:951e:: with SMTP id p30-v6mr5622190pgd.318.1530899625738; Fri, 06 Jul 2018 10:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530899625; cv=none; d=google.com; s=arc-20160816; b=yq3xwZ8bJo0fs+034pRBsbfCqAFaNfRPg+ENiamtr5kzVzugROkSXCdpPR9QV+ZFMU Iw0wQV4tmxvH9Pzpq6HmntS/yPgINlenahcKSDLFlQvJNaSzzhe25T9AscApntWdzitE NBbUosZ0PC1qHby7M4latcFzGDRrb524gBcLig1ORKUbRwrIxQPumo6y7/Sy+bXxU7gj T+XaKWdld3YtdfUCDiQGurQAYTqRxALo21IZ/cwbicOsCK6w2loWSWBWqIngJHBJkp5p ZPO4wrfGIfjGvrThtsQo5oj6VYZI8NRp3KobvWSNQWi3i2A3WC/QtWlWpKFPAfD6dRSQ HP5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:arc-authentication-results; bh=puloyqQUrfy3DvST31cWPeLE+zdTL/DhGS43yBysiyo=; b=gwgynahPxADVbJQdfDAnRbKUt1PYlgcAVw9xz1Gbu3xxlw1QkfO/DzpFUxyDjS3/pD 0PEe7Q1j7TfL9QAAq7uJoliU5FudaRyej68Q2tm49MLe0YKEG4xYphplVmDLZ9BepD5w cOB0rbl21J3IXTsqI5lkc6UMY9at051ucyF3WlOXTH0Pm0AEA8e2v4HtbqAUAyme7R2q EMdyRPqaFfIvKZmBRJGyOmzF6vpRM6c8fGZF4yHR/UyEj8JRjfM4PluRPvUBXNzF0KGo fIU6haGe4/Ta7YAftX/OzbIrCoYTKw14p3dYzH78VXswC12eC0IC+EnyORs4F/g7frl8 A1OQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c15-v6si7964054pgw.550.2018.07.06.10.53.31; Fri, 06 Jul 2018 10:53:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934258AbeGFRwO convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Jul 2018 13:52:14 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:57678 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933775AbeGFRwN (ORCPT ); Fri, 6 Jul 2018 13:52:13 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 12277805-1500050 for multiple; Fri, 06 Jul 2018 18:51:00 +0100 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Randy Dunlap , linux-kernel@vger.kernel.org From: Chris Wilson In-Reply-To: <48904284-14d7-45c2-cf41-0c0b311ccf7e@infradead.org> Cc: Jani Nikula , Andy Gospodarek , "David S . Miller" , Thomas Gleixner , Andrew Morton , Ingo Molnar References: <20180706094458.14116-1-chris@chris-wilson.co.uk> <48904284-14d7-45c2-cf41-0c0b311ccf7e@infradead.org> Message-ID: <153089946144.7594.5374061827926275070@cwilso3-mobl.ger.corp.intel.com> User-Agent: alot/0.6 Subject: Re: [PATCH] bitops: Introduce BITS_PER_TYPE Date: Fri, 06 Jul 2018 18:51:01 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Randy Dunlap (2018-07-06 18:48:55) > > On 07/06/18 02:44, Chris Wilson wrote: > > net_dim.h has a rather useful extension to BITS_PER_BYTE to compute the > > number of bits in a type (BITS_PER_BYTE * sizeof(T)), so promote the > > macro to bitops.h, alongside BITS_PER_BYTE, for wider usage. > > > > Signed-off-by: Chris Wilson > > Cc: Jani Nikula > > Cc: Andy Gospodarek > > Cc: David S. Miller > > Cc: Thomas Gleixner > > Cc: Andrew Morton > > Cc: Ingo Molnar > > --- > > include/linux/bitops.h | 3 ++- > > include/linux/net_dim.h | 1 - > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > > index 4cac4e1a72ff..091cb17d1a9b 100644 > > --- a/include/linux/bitops.h > > +++ b/include/linux/bitops.h > > @@ -11,7 +11,8 @@ > > #define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) > > #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) > > #define BITS_PER_BYTE 8 > > -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) > > +#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) > > +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) > > #endif > > > > /* > > doesn't need to #include ? It already has to in order to obtain BITS_PER_BYTE. Just doesn't do so directly. -Chris